# Shifts

Shifts define recurring time windows during which a restaurant operates. Each shift specifies days of the week, start/end times, and visual settings. Shifts drive POS behavior such as automatic period closures and reporting boundaries.

#### Shift Properties

daysOfWeek

A comma-separated string of day indices (e.g. `"1,2,3,4,5"` for Monday through Friday).

start / end

Time expressed as minutes from midnight (e.g. `480` = 08:00, `1320` = 22:00).

endsTomorrow

Set to `true` if the shift crosses midnight (e.g. 22:00 - 02:00).

### `GET /restaurants/{restaurantId}/shifts` - List all shifts for a restaurant

Retrieve all shifts configured for a restaurant. Returns an array of shift definitions including schedule, color coding, and enabled status.

#### Parameters

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| restaurantId | integer | Yes | The unique identifier of the restaurant. |

#### Response

```json
{
  "status": 200,
  "code": "shifts_found",
  "message": "Shifts found.",
  "data": [
    {
      "shiftId": 301,
      "brandId": 15,
      "restaurantId": 4200,
      "name": "Lunch Service",
      "daysOfWeek": "1,2,3,4,5",
      "start": 690,
      "end": 900,
      "endsTomorrow": false,
      "color": "#4CAF50",
      "isEnabled": true,
      "isDefault": true
    },
    {
      "shiftId": 302,
      "brandId": 15,
      "restaurantId": 4200,
      "name": "Dinner Service",
      "daysOfWeek": "1,2,3,4,5,6",
      "start": 1140,
      "end": 1380,
      "endsTomorrow": false,
      "color": "#2196F3",
      "isEnabled": true,
      "isDefault": false
    }
  ]
}
```

##### Response Properties

Every field in the example is listed below. Explicit requiredness is shown when the endpoint contract defines it.

| Property | Type | Example | Description |
| --- | --- | --- | --- |
| status | integer | 200 | HTTP status code returned by the API. |
| code | string | "shifts\_found" | Machine-readable application code for the result. |
| message | string | "Shifts found." | Human-readable result message. Do not use this value for program logic. |
| data | array | \[…\] | Endpoint-specific response payload. |
| data\[\] | object | {…} | Endpoint-specific response payload. |
| data\[\].shiftId | integer | 301 | Identifier of the associated shift. |
| data\[\].brandId | integer | 15 | Identifier of the brand. |
| data\[\].restaurantId | integer | 4200 | Identifier of the restaurant. |
| data\[\].name | string | "Lunch Service" | The name value. |
| data\[\].daysOfWeek | string | "1,2,3,4,5" | The days of week value. |
| data\[\].start | integer | 690 | The start value. |
| data\[\].end | integer | 900 | The end value. |
| data\[\].endsTomorrow | boolean | false | The ends tomorrow value. |
| data\[\].color | string | "#4CAF50" | The color value. |
| data\[\].isEnabled | boolean | true | Whether this feature is enabled. |
| data\[\].isDefault | boolean | true | Whether default is enabled or applies. |

### `POST /shifts` - Create a shift

Create a new shift definition for a restaurant. The authenticated user must have Brand-level access or above.

#### Request Body

```json
{
  "brandId": 15,
  "restaurantId": 4200,
  "name": "Night Service",
  "daysOfWeek": "5,6",
  "start": 1320,
  "end": 120,
  "endsTomorrow": true,
  "color": "#9C27B0",
  "isEnabled": true,
  "isDefault": false
}
```

##### Request Body Properties

Every field in the example is listed below. Explicit requiredness is shown when the endpoint contract defines it.

| Property | Type | Example | Description |
| --- | --- | --- | --- |
| brandId | integer | 15 | Identifier of the brand. |
| restaurantId | integer | 4200 | Identifier of the restaurant. |
| name | string | "Night Service" | The name value. |
| daysOfWeek | string | "5,6" | The days of week value. |
| start | integer | 1320 | The start value. |
| end | integer | 120 | The end value. |
| endsTomorrow | boolean | true | The ends tomorrow value. |
| color | string | "#9C27B0" | The color value. |
| isEnabled | boolean | true | Whether this feature is enabled. |
| isDefault | boolean | false | Whether default is enabled or applies. |

#### Response

```json
{
  "status": 201,
  "code": "shift_created",
  "message": "Shift created.",
  "data": {
    "shiftId": 303,
    "brandId": 15,
    "restaurantId": 4200,
    "name": "Night Service",
    "daysOfWeek": "5,6",
    "start": 1320,
    "end": 120,
    "endsTomorrow": true,
    "color": "#9C27B0",
    "isEnabled": true,
    "isDefault": false
  }
}
```

##### Response Properties

Every field in the example is listed below. Explicit requiredness is shown when the endpoint contract defines it.

| Property | Type | Example | Description |
| --- | --- | --- | --- |
| status | integer | 201 | HTTP status code returned by the API. |
| code | string | "shift\_created" | Machine-readable application code for the result. |
| message | string | "Shift created." | Human-readable result message. Do not use this value for program logic. |
| data | object | {…} | Endpoint-specific response payload. |
| data.shiftId | integer | 303 | Identifier of the associated shift. |
| data.brandId | integer | 15 | Identifier of the brand. |
| data.restaurantId | integer | 4200 | Identifier of the restaurant. |
| data.name | string | "Night Service" | The name value. |
| data.daysOfWeek | string | "5,6" | The days of week value. |
| data.start | integer | 1320 | The start value. |
| data.end | integer | 120 | The end value. |
| data.endsTomorrow | boolean | true | The ends tomorrow value. |
| data.color | string | "#9C27B0" | The color value. |
| data.isEnabled | boolean | true | Whether this feature is enabled. |
| data.isDefault | boolean | false | Whether default is enabled or applies. |

### `GET /shifts/{shiftId}` - Get a single shift

Retrieve a specific shift by its ID.

#### Parameters

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| shiftId | string | Yes | The unique identifier of the shift. |

#### Response

```json
{
  "status": 200,
  "code": "shift_found",
  "message": "Shift found.",
  "data": {
    "shiftId": 301,
    "brandId": 15,
    "restaurantId": 4200,
    "name": "Lunch Service",
    "daysOfWeek": "1,2,3,4,5",
    "start": 690,
    "end": 900,
    "endsTomorrow": false,
    "color": "#4CAF50",
    "isEnabled": true,
    "isDefault": true
  }
}
```

##### Response Properties

Every field in the example is listed below. Explicit requiredness is shown when the endpoint contract defines it.

| Property | Type | Example | Description |
| --- | --- | --- | --- |
| status | integer | 200 | HTTP status code returned by the API. |
| code | string | "shift\_found" | Machine-readable application code for the result. |
| message | string | "Shift found." | Human-readable result message. Do not use this value for program logic. |
| data | object | {…} | Endpoint-specific response payload. |
| data.shiftId | integer | 301 | Identifier of the associated shift. |
| data.brandId | integer | 15 | Identifier of the brand. |
| data.restaurantId | integer | 4200 | Identifier of the restaurant. |
| data.name | string | "Lunch Service" | The name value. |
| data.daysOfWeek | string | "1,2,3,4,5" | The days of week value. |
| data.start | integer | 690 | The start value. |
| data.end | integer | 900 | The end value. |
| data.endsTomorrow | boolean | false | The ends tomorrow value. |
| data.color | string | "#4CAF50" | The color value. |
| data.isEnabled | boolean | true | Whether this feature is enabled. |
| data.isDefault | boolean | true | Whether default is enabled or applies. |

### `PUT /shifts/{shiftId}` - Update a shift

Update an existing shift definition. All body fields are required and will replace the current values.

#### Parameters

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| shiftId | string | Yes | The unique identifier of the shift. |

#### Request Body

```json
{
  "name": "Lunch Service (Extended)",
  "daysOfWeek": "1,2,3,4,5,6",
  "start": 660,
  "end": 930,
  "endsTomorrow": false,
  "color": "#4CAF50",
  "isEnabled": true
}
```

##### Request Body Properties

Every field in the example is listed below. Explicit requiredness is shown when the endpoint contract defines it.

| Property | Type | Example | Description |
| --- | --- | --- | --- |
| name | string | "Lunch Service (Extended)" | The name value. |
| daysOfWeek | string | "1,2,3,4,5,6" | The days of week value. |
| start | integer | 660 | The start value. |
| end | integer | 930 | The end value. |
| endsTomorrow | boolean | false | The ends tomorrow value. |
| color | string | "#4CAF50" | The color value. |
| isEnabled | boolean | true | Whether this feature is enabled. |

#### Response

```json
{
  "status": 200,
  "code": "shift_updated",
  "message": "Shift updated.",
  "data": {
    "shiftId": 301,
    "brandId": 15,
    "restaurantId": 4200,
    "name": "Lunch Service (Extended)",
    "daysOfWeek": "1,2,3,4,5,6",
    "start": 660,
    "end": 930,
    "endsTomorrow": false,
    "color": "#4CAF50",
    "isEnabled": true,
    "isDefault": true
  }
}
```

##### Response Properties

Every field in the example is listed below. Explicit requiredness is shown when the endpoint contract defines it.

| Property | Type | Example | Description |
| --- | --- | --- | --- |
| status | integer | 200 | HTTP status code returned by the API. |
| code | string | "shift\_updated" | Machine-readable application code for the result. |
| message | string | "Shift updated." | Human-readable result message. Do not use this value for program logic. |
| data | object | {…} | Endpoint-specific response payload. |
| data.shiftId | integer | 301 | Identifier of the associated shift. |
| data.brandId | integer | 15 | Identifier of the brand. |
| data.restaurantId | integer | 4200 | Identifier of the restaurant. |
| data.name | string | "Lunch Service (Extended)" | The name value. |
| data.daysOfWeek | string | "1,2,3,4,5,6" | The days of week value. |
| data.start | integer | 660 | The start value. |
| data.end | integer | 930 | The end value. |
| data.endsTomorrow | boolean | false | The ends tomorrow value. |
| data.color | string | "#4CAF50" | The color value. |
| data.isEnabled | boolean | true | Whether this feature is enabled. |
| data.isDefault | boolean | true | Whether default is enabled or applies. |

### `DELETE /shifts/{shiftId}` - Delete a shift

Delete a shift definition. The authenticated user must have Brand-level access or above.

#### Parameters

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| shiftId | string | Yes | The unique identifier of the shift. |

#### Response

```json
{
  "status": 200,
  "code": "shift_deleted",
  "message": "Shift updated.",
  "data": {}
}
```

##### Response Properties

Every field in the example is listed below. Explicit requiredness is shown when the endpoint contract defines it.

| Property | Type | Example | Description |
| --- | --- | --- | --- |
| status | integer | 200 | HTTP status code returned by the API. |
| code | string | "shift\_deleted" | Machine-readable application code for the result. |
| message | string | "Shift updated." | Human-readable result message. Do not use this value for program logic. |
| data | object | {…} | Endpoint-specific response payload. |
