{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/brixsignage-com/json-schema/brixsignage-com-power-policy-schema.json",
  "title": "PowerPolicy",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/brixsignage-com-power-policies-api-openapi.yml#/components/schemas/PowerPolicy",
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "description": "Power policy id."
    },
    "spaceId": {
      "type": "string"
    },
    "name": {
      "type": "string"
    },
    "description": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ]
    },
    "windows": {
      "$ref": "#/$defs/WeeklyWindows"
    },
    "rebootHourLocal": {
      "anyOf": [
        {
          "type": "integer"
        },
        {
          "type": "null"
        }
      ],
      "description": "Hour (0–23, local time) the device restarts each day; null = no scheduled restart."
    },
    "timezone": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "description": "IANA time zone the windows use; null = each screen's own time zone."
    },
    "createdAt": {
      "type": "string",
      "description": "ISO-8601 timestamp (UTC)."
    },
    "updatedAt": {
      "type": "string",
      "description": "ISO-8601 timestamp (UTC)."
    },
    "deletedAt": {
      "anyOf": [
        {
          "type": "string",
          "description": "ISO-8601 timestamp (UTC)."
        },
        {
          "type": "null"
        }
      ],
      "description": "Always null on these reads."
    },
    "screenCount": {
      "type": "integer",
      "description": "Screens that use this policy."
    }
  },
  "required": [
    "id",
    "spaceId",
    "name",
    "description",
    "windows",
    "rebootHourLocal",
    "timezone",
    "createdAt",
    "updatedAt",
    "deletedAt",
    "screenCount"
  ],
  "$defs": {
    "OpenWindow": {
      "type": "object",
      "properties": {
        "start": {
          "type": "string",
          "description": "Opening time, `HH:MM` 24-hour, local time."
        },
        "end": {
          "type": "string",
          "description": "Closing time, `HH:MM`. An `end` at or before `start` runs past midnight."
        },
        "volume": {
          "description": "Volume 0–100 while open; absent or null keeps the screen's own.",
          "anyOf": [
            {
              "type": "integer"
            },
            {
              "type": "null"
            }
          ]
        },
        "brightness": {
          "description": "Backlight 0–100 while open; absent or null keeps the screen's own.",
          "anyOf": [
            {
              "type": "integer"
            },
            {
              "type": "null"
            }
          ]
        },
        "muted": {
          "description": "Mute (true) or unmute (false) while open; absent or null keeps the screen's own.",
          "anyOf": [
            {
              "type": "boolean"
            },
            {
              "type": "null"
            }
          ]
        }
      },
      "required": [
        "start",
        "end"
      ]
    },
    "WeeklyWindows": {
      "type": "object",
      "properties": {
        "mon": {
          "$ref": "#/$defs/OpenWindow"
        },
        "tue": {
          "$ref": "#/$defs/OpenWindow"
        },
        "wed": {
          "$ref": "#/$defs/OpenWindow"
        },
        "thu": {
          "$ref": "#/$defs/OpenWindow"
        },
        "fri": {
          "$ref": "#/$defs/OpenWindow"
        },
        "sat": {
          "$ref": "#/$defs/OpenWindow"
        },
        "sun": {
          "$ref": "#/$defs/OpenWindow"
        }
      },
      "description": "Open window per weekday (`mon` … `sun`). A day that is absent is closed."
    }
  }
}