> For the complete documentation index, see [llms.txt](https://teamleader-sdk.mcore-services.dev/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://teamleader-sdk.mcore-services.dev/api-reference/general/day-off-types.md).

# Day Off Types

Manage day off types in Teamleader Focus.

```php
Teamleader::dayOffTypes()
```

|                          |                                                             |
| ------------------------ | ----------------------------------------------------------- |
| Class                    | `McoreServices\TeamleaderSDK\Resources\General\DayOffTypes` |
| Create / update / delete | ✓ / ✓ / ✓                                                   |
| Pagination               | No                                                          |

## Endpoints

* `dayOffTypes.create`
* `dayOffTypes.delete`
* `dayOffTypes.list`
* `dayOffTypes.update`

## Filters

`list()` takes no filters.

## Accepted values

Public constants on the class. Body fields and enum values outside these lists throw before the request is sent.

| Constant       | Values                           |
| -------------- | -------------------------------- |
| `WRITE_FIELDS` | `name`, `color`, `date_validity` |

## Methods

### `list()`

```php
list(array $filters = [], array $options = []): array
```

List all day off types

`dayOffTypes.list` takes no request body — no filter, page or sort parameter exists for it. Arguments are rejected rather than discarded.

* `$filters` — Must be empty — this endpoint accepts no filters
* `$options` — Must be empty — this endpoint accepts no sorting or pagination

**Throws** `InvalidArgumentException` When any argument is passed

### `delete()`

```php
delete($id, ...$additionalParams): array
```

Delete a day off type

* `$id` — Day off type UUID

### `createWithValidity()`

```php
createWithValidity(string $name, ?string $color = null, ?string $fromDate = null, ?string $untilDate = null): array
```

Create a day off type with date validity period

* `$name` — Name of the day off type
* `$color` — Hex color code (optional)
* `$fromDate` — Start date (YYYY-MM-DD)
* `$untilDate` — End date (YYYY-MM-DD, optional)

### `create()`

```php
create(array $data)
```

Create a new day off type

* `$data` — Day off type data

### `updateColor()`

```php
updateColor(string $id, string $color): array
```

Update day off type color

* `$id` — Day off type UUID
* `$color` — Hex color code

### `update()`

```php
update($id, array $data): array
```

Update an existing day off type

* `$id` — Day off type UUID
* `$data` — Updated data

### `updateValidity()`

```php
updateValidity(string $id, string $fromDate, ?string $untilDate = null): array
```

Update day off type validity dates

* `$id` — Day off type UUID
* `$fromDate` — Start date (YYYY-MM-DD)
* `$untilDate` — End date (YYYY-MM-DD, optional)

### `getCommonColors()`

```php
getCommonColors(): array
```

Get available color options for day off types

### `bulkCreate()`

```php
bulkCreate(array $dayOffTypes): array
```

Bulk create day off types

* `$dayOffTypes` — Array of day off type data

### `getValidationRules()`

```php
getValidationRules(): array
```

Get validation rules for day off type data

## Examples

Get all day off types:

```php
$dayOffTypes = Teamleader::dayOffTypes()->list();
```

Create a basic day off type:

```php
$dayOffType = Teamleader::dayOffTypes()->create(['name' => 'Vacation', 'color' => '#00B2B2']);
```

Create day off type with date validity:

```php
$dayOffType = Teamleader::dayOffTypes()->create([
    'name' => 'Summer Leave',
    'color' => '#FFB600',
    'date_validity' => [
        'from' => '2024-06-01',
        'until' => '2024-08-31'
    ]
]);
```

Update an existing day off type:

```php
$result = Teamleader::dayOffTypes()->update('uuid-here', ['name' => 'Updated Name', 'color' => '#FF0000']);
```

Delete a day off type:

```php
$result = Teamleader::dayOffTypes()->delete('uuid-here');
```
