{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/tramitapp/json-schema/tramitapp-quadrant-schema.json",
  "title": "quadrant",
  "x-generated": "2026-11-25",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/tramitapp-openapi.json#/components/schemas/quadrant",
  "type": "object",
  "properties": {
    "company_id": {
      "type": "string"
    },
    "mode": {
      "type": "string",
      "enum": [
        "full",
        "delta"
      ]
    },
    "start": {
      "type": "string",
      "format": "date"
    },
    "end": {
      "type": "string",
      "format": "date"
    },
    "as_of": {
      "type": "string",
      "format": "date-time"
    },
    "next_cursor": {
      "type": [
        "string",
        "null"
      ]
    },
    "refs": {
      "type": "object",
      "properties": {
        "workplaces": {
          "type": "object",
          "additionalProperties": {
            "type": "object",
            "properties": {
              "correlation_id": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "name": {
                "type": [
                  "string",
                  "null"
                ]
              }
            }
          }
        },
        "locations": {
          "type": "object",
          "additionalProperties": {
            "type": "object",
            "properties": {
              "name": {
                "type": [
                  "string",
                  "null"
                ]
              }
            }
          }
        },
        "schedules": {
          "type": "object",
          "additionalProperties": {
            "type": "object",
            "properties": {
              "intervals": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "start": {
                      "type": "string"
                    },
                    "end": {
                      "type": "string"
                    },
                    "end_day_offset": {
                      "type": "integer",
                      "description": "Número de días desde el inicio hasta la fecha de fin del horario. Se omite si termina el mismo día."
                    }
                  }
                }
              }
            }
          }
        },
        "holidays": {
          "type": "object",
          "additionalProperties": {
            "type": "object",
            "properties": {
              "date": {
                "type": "string",
                "format": "date"
              },
              "name": {
                "type": "string"
              }
            }
          }
        }
      }
    },
    "employees": {
      "type": "object",
      "additionalProperties": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string"
          },
          "correlation_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "absences": {
            "type": "object",
            "additionalProperties": {
              "type": "object",
              "properties": {
                "type": {
                  "type": "string",
                  "enum": [
                    "absence",
                    "sickness",
                    "vacation"
                  ]
                },
                "subtype": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "status": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "start": {
                  "type": [
                    "string",
                    "null"
                  ],
                  "format": "date-time"
                },
                "end": {
                  "type": [
                    "string",
                    "null"
                  ],
                  "format": "date-time"
                }
              }
            }
          },
          "days": {
            "type": "object",
            "additionalProperties": {
              "type": [
                "object",
                "null"
              ],
              "properties": {
                "timezone": {
                  "type": "string"
                },
                "workplace_id": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "schedules": {
                  "type": "array",
                  "items": {
                    "type": "string"
                  }
                },
                "holidays": {
                  "type": "array",
                  "items": {
                    "type": "string"
                  }
                },
                "absences": {
                  "type": "array",
                  "items": {
                    "type": "string"
                  }
                },
                "clockings": {
                  "type": "object",
                  "properties": {
                    "worked_hours": {
                      "type": "number",
                      "description": "Horas trabajadas que el cuadrante atribuye a los fichajes cerrados, aplicando las reglas de tiempo efectivo de la empresa. duration_hours mide la duración completa entre los marcajes efectivos de cada tramo. Un tramo abierto tiene duración null y no suma. Las horas se expresan en decimales con hasta seis cifras decimales."
                    },
                    "intervals": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "request_id": {
                            "type": "string"
                          },
                          "status": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "original": {
                            "type": "object",
                            "properties": {
                              "start": {
                                "type": [
                                  "string",
                                  "null"
                                ],
                                "format": "date-time"
                              },
                              "end": {
                                "type": [
                                  "string",
                                  "null"
                                ],
                                "format": "date-time"
                              }
                            },
                            "description": "Entrada y salida registradas. Un extremo sin captura conservada vale null."
                          },
                          "adjusted": {
                            "type": "object",
                            "properties": {
                              "start": {
                                "type": [
                                  "string",
                                  "null"
                                ],
                                "format": "date-time"
                              },
                              "end": {
                                "type": [
                                  "string",
                                  "null"
                                ],
                                "format": "date-time"
                              }
                            },
                            "description": "Solo contiene los extremos efectivos que difieren del original. La presencia de la clave prevalece incluso cuando su valor es null. Los tramos se ordenan por entrada efectiva."
                          },
                          "duration_hours": {
                            "type": [
                              "number",
                              "null"
                            ]
                          },
                          "location_in": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "location_out": {
                            "type": [
                              "string",
                              "null"
                            ]
                          }
                        }
                      }
                    }
                  }
                }
              },
              "description": "En delta sustituye la jornada completa de la proyección elegida. Una jornada eliminada se devuelve como null. Si se anula su último fichaje y la jornada continúa, intervals se devuelve vacío. El centro es el asignado en la fecha, con el centro actual como respaldo cuando falta historial."
            }
          }
        }
      }
    }
  },
  "required": [
    "company_id",
    "mode",
    "start",
    "end",
    "as_of",
    "next_cursor",
    "refs",
    "employees"
  ]
}