{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/panembrivdienu-lv/json-schema/panembrivdienu-lv-calendar-statistics-response-schema.json",
  "title": "CalendarStatisticsResponse",
  "x-generated": "2026-11-20",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/panembrivdienu-lv-openapi.yml#/components/schemas/CalendarStatisticsResponse",
  "type": "object",
  "required": [
    "year",
    "transfers_applied",
    "total_days",
    "working_days",
    "weekend_days",
    "holidays",
    "moved_working_days",
    "moved_days_off",
    "total_days_off",
    "working_hours",
    "months"
  ],
  "properties": {
    "year": {
      "type": "integer"
    },
    "transfers_applied": {
      "type": "boolean"
    },
    "total_days": {
      "type": "integer"
    },
    "working_days": {
      "type": "integer"
    },
    "weekend_days": {
      "type": "integer"
    },
    "holidays": {
      "type": "integer"
    },
    "moved_working_days": {
      "type": "integer"
    },
    "moved_days_off": {
      "type": "integer"
    },
    "total_days_off": {
      "type": "integer",
      "description": "Weekends, holidays and transferred days off."
    },
    "working_hours": {
      "type": "integer",
      "description": "Working hours of the year: 8 per working day, minus one hour for each pre-holiday day."
    },
    "months": {
      "type": "array",
      "description": "Working time of each month, January first. months[].working_days includes transferred working Saturdays, while the top-level working_days does not. months[].weekday_holidays counts only holidays on weekdays, while the top-level holidays counts all. pre_holiday_dates are computed on the selected calendar: with apply_transfers the day before a transferred day off is not shortened.",
      "items": {
        "$ref": "#/$defs/MonthStatistics"
      }
    }
  },
  "$defs": {
    "MonthStatistics": {
      "type": "object",
      "required": [
        "month",
        "working_days",
        "working_hours",
        "weekday_holidays",
        "pre_holiday_dates",
        "moved_days_off",
        "moved_workdays"
      ],
      "properties": {
        "month": {
          "type": "integer",
          "minimum": 1,
          "maximum": 12
        },
        "working_days": {
          "type": "integer",
          "description": "Working days, including Saturdays that became working days through a transfer."
        },
        "working_hours": {
          "type": "integer",
          "description": "8 hours per working day, minus one hour for each pre-holiday day."
        },
        "weekday_holidays": {
          "type": "integer",
          "description": "Public holidays that fall on a weekday; holidays on a weekend are not counted."
        },
        "pre_holiday_dates": {
          "type": "array",
          "description": "Working days shortened by one hour because a public holiday follows on the next calendar day (Article 135 of the Labour Law).",
          "items": {
            "type": "string",
            "format": "date"
          }
        },
        "moved_days_off": {
          "type": "array",
          "description": "Weekdays that became days off through a transfer; empty unless apply_transfers is true.",
          "items": {
            "type": "string",
            "format": "date"
          }
        },
        "moved_workdays": {
          "type": "array",
          "description": "Saturdays that became working days through a transfer; empty unless apply_transfers is true.",
          "items": {
            "type": "string",
            "format": "date"
          }
        }
      }
    }
  }
}