{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://schemas.opencityitalia.it/website/comuni/time_indexed_role/v1.json",
  "title": "Incarico",
  "description": "Incarico o ruolo ricoperto da una persona pubblica in un ente, con date di validità. I campi elencati sono il contratto minimo garantito; tenant con moduli opzionali possono esporre campi aggiuntivi.",
  "type": "object",
  "properties": {
    "id": {
      "title": "Identificativo",
      "type": "string",
      "description": "Identificativo composito nel formato tenantId:objectId (es. bugliano:228)"
    },
    "label": {
      "title": "Etichetta",
      "type": [
        "string",
        "null"
      ]
    },
    "role": {
      "title": "Ruolo",
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "type": {
      "title": "Tipo incarico",
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "person": {
      "title": "Persona",
      "description": "Persona pubblica titolare dell'incarico (ezobjectrelationlist — array con un elemento).",
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "type_id": {
            "type": "string"
          },
          "id": {
            "type": "string",
            "description": "Formato: tenantId:objectId (es. \"bugliano:228\")"
          },
          "object_id": {
            "type": "string"
          },
          "remote_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "title": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "id",
          "object_id"
        ]
      },
      "minItems": 1,
      "maxItems": 1
    },
    "start_date": {
      "title": "Data inizio",
      "type": [
        "string",
        "null"
      ],
      "format": "date-time"
    },
    "end_date": {
      "title": "Data fine",
      "type": [
        "string",
        "null"
      ],
      "format": "date-time"
    },
    "tenant_id": {
      "title": "Ente",
      "type": "string",
      "format": "uuid"
    },
    "created_at": {
      "title": "Data creazione",
      "type": "string",
      "format": "date-time"
    },
    "updated_at": {
      "title": "Data aggiornamento",
      "type": "string",
      "format": "date-time"
    },
    "executive_position": {
      "title": "Incarico dirigenziale",
      "type": [
        "boolean",
        "null"
      ]
    },
    "primary_role": {
      "title": "Ruolo principale",
      "type": [
        "boolean",
        "null"
      ]
    },
    "organizational_position": {
      "title": "Posizione organizzativa",
      "type": [
        "boolean",
        "null"
      ]
    },
    "priority": {
      "title": "Priorità",
      "description": "ezinteger serializzato come stringa da ocopendata.",
      "type": [
        "string",
        "null"
      ]
    }
  },
  "required": [
    "id",
    "person",
    "tenant_id",
    "created_at",
    "updated_at"
  ]
}
