# Update Calendar

Updates an automation date-rule calendar’s settings. Supplying entries replaces the whole list; keep existing entry IDs and omit id for new entries. Active automation use blocks entry changes; country and weekday changes affect future date calculations.

## Input schema:

```json
{
  "type": "object",
  "properties": {
    "id": {
      "type": "integer",
      "minimum": 1
    },
    "settings": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "name": {
          "type": "string",
          "minLength": 1,
          "maxLength": 250
        },
        "entries": {
          "type": "array",
          "maxItems": 500,
          "items": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "name",
              "type"
            ],
            "properties": {
              "id": {
                "type": "integer",
                "minimum": 1,
                "description": "Preserve existing IDs; omit for automatic assignment."
              },
              "name": {
                "type": "string",
                "minLength": 1,
                "maxLength": 250
              },
              "type": {
                "type": "integer",
                "enum": [
                  1,
                  2
                ],
                "description": "1 relative; 2 fixed date or range."
              },
              "from": {
                "type": "string",
                "format": "date"
              },
              "to": {
                "type": "string",
                "description": "Optional inclusive end date YYYY-MM-DD, at most 365 days after from."
              },
              "base": {
                "type": "integer",
                "enum": [
                  1,
                  2,
                  3,
                  4
                ],
                "description": "1 holidays; 2 quarters; 3 months; 4 ISO weeks."
              },
              "op": {
                "type": "integer",
                "enum": [
                  1,
                  2,
                  3,
                  4,
                  5,
                  6,
                  20,
                  21,
                  22,
                  23,
                  24,
                  25,
                  40,
                  41,
                  42,
                  43,
                  44,
                  60,
                  61,
                  62
                ],
                "description": "Holidays: 1 original, 2 day offset, 3 next weekday, 4 previous weekday, 5 next business day, 6 previous business day. Quarters: 20 first day, 21 last day, 22 first business day, 23 last business day, 24 first weekday, 25 last weekday. Months: 40 first day, 41 last day, 42 first business day, 43 last business day, 44 nth weekday. Weeks: 60 first business day, 61 last business day, 62 weekday."
              },
              "holidays": {
                "type": "array",
                "items": {
                  "type": "string"
                },
                "description": "Holiday IDs from get-calendar ui.holidays, e.g. nys, eas, xd1."
              },
              "quarters": {
                "type": "array",
                "items": {
                  "type": "integer",
                  "minimum": 1,
                  "maximum": 4
                }
              },
              "months": {
                "type": "array",
                "items": {
                  "type": "integer",
                  "minimum": 1,
                  "maximum": 12
                }
              },
              "weeks": {
                "type": "array",
                "items": {
                  "type": "integer",
                  "minimum": 1,
                  "maximum": 53
                }
              },
              "weekdays": {
                "type": "array",
                "items": {
                  "type": "integer",
                  "minimum": 1,
                  "maximum": 7
                }
              },
              "nthweekday": {
                "type": "integer",
                "minimum": 1,
                "maximum": 5,
                "description": "For operation 44; 5 is last."
              },
              "strtotime": {
                "type": "string",
                "description": "For operation 2; a day offset such as +3 days or -2 days, within ±365 days."
              }
            }
          }
        },
        "countries": {
          "type": "array",
          "items": {
            "type": "string",
            "enum": [
              "DE",
              "AT",
              "CH",
              "CHRISTIAN"
            ]
          }
        },
        "businessdays": {
          "type": "array",
          "items": {
            "type": "integer",
            "minimum": 1,
            "maximum": 7
          }
        },
        "metalabels": {
          "type": "array",
          "items": {
            "type": "string",
            "maxLength": 250
          }
        }
      }
    },
    "accountId": {
      "type": [
        "null",
        "integer"
      ],
      "default": null,
      "minimum": 1
    }
  },
  "required": [
    "id",
    "settings"
  ],
  "additionalProperties": false
}
```

## Output schema:

```json
{
  "type": "object",
  "required": [
    "accountId",
    "id",
    "settings",
    "ui",
    "year",
    "dates",
    "editLink",
    "dependencies"
  ],
  "properties": {
    "accountId": {
      "type": "integer"
    },
    "id": {
      "type": "integer"
    },
    "settings": {
      "type": "object",
      "properties": {
        "name": {
          "type": "string"
        },
        "entries": {
          "type": "array",
          "items": {
            "type": "object",
            "description": "One entry rule with the fields of create-calendar entries."
          }
        },
        "countries": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "businessdays": {
          "type": "array",
          "items": {
            "type": [
              "integer",
              "string"
            ]
          }
        },
        "metalabels": {
          "type": "array",
          "items": {
            "type": "string"
          }
        }
      }
    },
    "ui": {
      "type": "object",
      "properties": {
        "id": {
          "type": [
            "integer",
            "string"
          ]
        },
        "name": {
          "type": "string"
        },
        "type": {
          "type": "string"
        },
        "entries": {
          "type": "array",
          "items": {
            "type": "object",
            "description": "One entry rule with the fields of create-calendar entries."
          }
        },
        "countries": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "businessdays": {
          "type": "array",
          "items": {
            "type": [
              "integer",
              "string"
            ]
          }
        },
        "holidays": {
          "type": "object",
          "description": "Holiday ID => holiday of the requested year; the IDs are what entries holidays accept."
        },
        "isEditable": {
          "type": "integer",
          "enum": [
            0,
            1
          ]
        },
        "metalabels": {
          "type": "array",
          "items": {
            "type": "string"
          }
        }
      }
    },
    "year": {
      "type": "integer"
    },
    "dates": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "id": {
            "type": [
              "integer",
              "string"
            ],
            "description": "ID of the entry that produced the date."
          },
          "name": {
            "type": "string"
          },
          "date": {
            "type": "string",
            "format": "date"
          }
        }
      }
    },
    "editLink": {
      "type": "string"
    },
    "dependencies": {
      "type": [
        "object",
        "array"
      ],
      "description": "Empty list when nothing references the calendar; otherwise dependency category => automation ID => {id, type, name, editLink}."
    }
  }
}
```

