# Project Schema

This document describes the Project object schema returned by the globalMOO API.

## Structure

```json
{
  "id": 456,                                     // Unique identifier
  "createdAt": "2025-01-31T10:00:00.000Z",      // Creation timestamp
  "updatedAt": "2025-01-31T10:00:00.000Z",      // Last update timestamp
  "disabledAt": null,                           // Optional disable timestamp
  "developedAt": "2025-01-31T15:00:00.000Z",    // Timestamp when project was developed
  "name": "Q1 Planning",                         // Project name
  "inputCount": 3,                              // Number of input variables
  "minimums": [0, 0, 0],                        // Minimum values for each input
  "maximums": [1, 1, 1],                        // Maximum values for each input
  "inputTypes": ["float", "float", "float"],    // Type of each input variable
  "categories": [                               // Categories for categorical inputs
    ["red", "green", "blue"],
    [],
    []
  ],
  "inputCases": [                               // Input test cases
    [0.1, 0.2, 0.7],
    [0.3, 0.3, 0.4],
    [0.5, 0.1, 0.4]
  ],
  "caseCount": 3,                               // Number of test cases
  "trials": [                                   // Associated trials
    {
      "id": 789,
      // ... other trial properties
    }
  ]
}
```

## Fields

| Field         | Type                                                                                         | Description                                                     |
| ------------- | -------------------------------------------------------------------------------------------- | --------------------------------------------------------------- |
| `id`          | integer                                                                                      | Unique identifier for the project                               |
| `createdAt`   | string (ISO 8601)                                                                            | Timestamp when the project was created                          |
| `updatedAt`   | string (ISO 8601)                                                                            | Timestamp when the project was last updated                     |
| `disabledAt`  | string (ISO 8601) or null                                                                    | Timestamp when the project was disabled, null if active         |
| `developedAt` | string (ISO 8601) or null                                                                    | Timestamp when the project was developed, null if not developed |
| `name`        | string                                                                                       | Name of the project (minimum 4 characters)                      |
| `inputCount`  | integer                                                                                      | Number of input variables in the optimization model             |
| `minimums`    | array of numbers                                                                             | Minimum allowed values for each input variable                  |
| `maximums`    | array of numbers                                                                             | Maximum allowed values for each input variable                  |
| `inputTypes`  | array of strings                                                                             | Type of each input variable (boolean, category, float, integer) |
| `categories`  | array of arrays                                                                              | For categorical inputs, the possible values for each input      |
| `inputCases`  | array of arrays                                                                              | Test cases with specific input values                           |
| `caseCount`   | integer                                                                                      | Number of test cases                                            |
| `trials`      | array of [Trial](https://globalmoo.gitbook.io/globalmoo-documentation/schemas/trial) objects | List of trials associated with this project                     |

## Input Types

| Type       | Description                                          |
| ---------- | ---------------------------------------------------- |
| `boolean`  | Boolean input (0 or 1)                               |
| `category` | Categorical input (from a predefined set of options) |
| `float`    | Floating point number input                          |
| `integer`  | Integer number input                                 |

## SDK Representations

### JavaScript SDK

In the JavaScript SDK, the Project object uses snake\_case naming for fields, translating from the API's camelCase:

```javascript
{
  id: 456,
  created_at: Date("2025-01-31T10:00:00.000Z"),  // Converted to Date object
  updated_at: Date("2025-01-31T10:00:00.000Z"),  // Converted to Date object
  disabled_at: null,
  developed_at: Date("2025-01-31T15:00:00.000Z"),  // Converted to Date object
  name: "Q1 Planning",
  input_count: 3,
  minimums: [0, 0, 0],
  maximums: [1, 1, 1],
  input_types: ["float", "float", "float"],  // Simple strings in lowercase
  categories: [
    ["red", "green", "blue"],
    [],
    []
  ],
  input_cases: [
    [0.1, 0.2, 0.7],
    [0.3, 0.3, 0.4],
    [0.5, 0.1, 0.4]
  ],
  case_count: 3,
  trials: [
    // Trial objects
  ]
}
```

### Python SDK

The Python SDK also uses snake\_case naming and converts timestamps to datetime objects:

```python
Project(
  id=456,
  created_at=datetime(2025, 1, 31, 10, 0, 0),    # Converted to datetime object
  updated_at=datetime(2025, 1, 31, 10, 0, 0),    # Converted to datetime object
  disabled_at=None,
  developed_at=datetime(2025, 1, 31, 15, 0, 0),  # Converted to datetime object
  name="Q1 Planning",
  input_count=3,
  minimums=[0, 0, 0],
  maximums=[1, 1, 1],
  input_types=[InputType.FLOAT, InputType.FLOAT, InputType.FLOAT],  # Enum values
  categories=[
    ["red", "green", "blue"],
    [],
    []
  ],
  input_cases=[
    [0.1, 0.2, 0.7],
    [0.3, 0.3, 0.4],
    [0.5, 0.1, 0.4]
  ],
  case_count=3,
  trials=[
    # Trial objects
  ]
)
```

### PHP SDK

The PHP SDK maintains camelCase naming to match the API and converts timestamps to DateTimeImmutable objects:

```php
Project(
  id: 456,
  createdAt: DateTimeImmutable("2025-01-31T10:00:00.000Z"),  // DateTimeImmutable object
  updatedAt: DateTimeImmutable("2025-01-31T10:00:00.000Z"),  // DateTimeImmutable object
  disabledAt: null,
  developedAt: DateTimeImmutable("2025-01-31T15:00:00.000Z"),  // DateTimeImmutable object
  name: "Q1 Planning",
  inputCount: 3,
  minimums: [0, 0, 0],
  maximums: [1, 1, 1],
  inputTypes: [InputType::Float, InputType::Float, InputType::Float],  // Enum values
  categories: [
    ["red", "green", "blue"],
    [],
    []
  ],
  inputCases: [
    [0.1, 0.2, 0.7],
    [0.3, 0.3, 0.4],
    [0.5, 0.1, 0.4]
  ],
  caseCount: 3,
  trials: [
    // Trial objects
  ]
)
```

## Examples

### Simple Project

```json
{
  "id": 456,
  "createdAt": "2025-01-31T10:00:00.000Z",
  "updatedAt": "2025-01-31T10:00:00.000Z",
  "disabledAt": null,
  "developedAt": null,
  "name": "Basic Project",
  "inputCount": 2,
  "minimums": [0, 0],
  "maximums": [100, 1],
  "inputTypes": ["integer", "boolean"],
  "categories": [[], []],
  "inputCases": [
    [50, 1],
    [75, 0]
  ],
  "caseCount": 2,
  "trials": []
}
```

### Project with Categorical Inputs

```json
{
  "id": 789,
  "createdAt": "2025-01-15T10:30:00.000Z",
  "updatedAt": "2025-01-20T14:45:00.000Z",
  "disabledAt": null,
  "developedAt": "2025-01-20T15:00:00.000Z",
  "name": "Marketing Channel Optimization",
  "inputCount": 3,
  "minimums": [0, 0, 0],
  "maximums": [2, 1, 100000],
  "inputTypes": ["category", "boolean", "integer"],
  "categories": [
    ["email", "social", "search"],
    [],
    []
  ],
  "inputCases": [
    [0, 1, 50000],  // email, with remarketing, $50,000 budget
    [1, 0, 75000],  // social, no remarketing, $75,000 budget
    [2, 1, 60000]   // search, with remarketing, $60,000 budget
  ],
  "caseCount": 3,
  "trials": [
    {
      "id": 101,
      "status": "completed",
      "createdAt": "2025-01-20T15:00:00.000Z",
      "updatedAt": "2025-01-20T15:10:00.000Z"
    }
  ]
}
```

## Related Endpoints

* [Project Endpoints](https://globalmoo.gitbook.io/globalmoo-documentation/endpoints/projects/index)
* [Create Project](https://globalmoo.gitbook.io/globalmoo-documentation/endpoints/projects/create)
