{
  "$defs": {
    "IsoDate": {
      "description": "ISO 8601 date (YYYY-MM-DD).",
      "format": "date",
      "type": "string"
    },
    "PathRef": {
      "description": "Path-based cross-reference relative to .corpospec/ root.\nPattern: `^[a-z0-9_-]+(/[a-z0-9_.-]+)+$`",
      "pattern": "^[a-z0-9_-]+(/[a-z0-9_.-]+)+$",
      "type": "string"
    },
    "PeriodKind": {
      "description": "Period granularity.",
      "enum": [
        "month",
        "quarter",
        "half_year",
        "year"
      ],
      "type": "string"
    },
    "PeriodStatus": {
      "description": "Period lifecycle status.",
      "oneOf": [
        {
          "const": "open",
          "description": "Accepting new journal entries freely.",
          "type": "string"
        },
        {
          "const": "soft_close",
          "description": "Soft-closed — new entries require approval but are still accepted.\nTypical management-reporting state 5-10 days after period end.",
          "type": "string"
        },
        {
          "const": "hard_close",
          "description": "Hard-closed — no new entries land in this period. Corrections\npost in the current open period as reversing entries.",
          "type": "string"
        },
        {
          "const": "reopened",
          "description": "Reopened after hard-close. Requires reopened_reason and a BDR\nreference per BDR 0066 L4-PERIOD-3.",
          "type": "string"
        }
      ]
    }
  },
  "$id": "https://corpospec.com/schemas/v0.16.0/accounting-period.schema.json",
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "additionalProperties": false,
  "description": "Period record with lifecycle.",
  "properties": {
    "adjusting_entries": {
      "description": "Period-close adjusting entries.",
      "items": {
        "$ref": "#/$defs/PathRef"
      },
      "type": "array"
    },
    "closed_at": {
      "anyOf": [
        {
          "$ref": "#/$defs/IsoDate"
        },
        {
          "type": "null"
        }
      ],
      "description": "When the period transitioned to soft_close / hard_close."
    },
    "closed_by": {
      "anyOf": [
        {
          "$ref": "#/$defs/PathRef"
        },
        {
          "type": "null"
        }
      ],
      "description": "PathRef into the person who closed the period."
    },
    "end": {
      "$ref": "#/$defs/IsoDate",
      "description": "End date (inclusive)."
    },
    "entity": {
      "$ref": "#/$defs/PathRef",
      "description": "Subject entity."
    },
    "fiscal_year": {
      "description": "Fiscal-year label (typically `\"2026\"`; diverges from calendar for\nnon-calendar fiscal years).",
      "type": "string"
    },
    "id": {
      "$ref": "#/$defs/PathRef",
      "description": "PathRef identifier, conventionally\n`financials/periods/<entity>-<YYYY-MM>` or `<YYYY-Qn>` or `<YYYY>`."
    },
    "kind": {
      "$ref": "#/$defs/PeriodKind",
      "description": "Period granularity."
    },
    "next_close_target": {
      "anyOf": [
        {
          "$ref": "#/$defs/IsoDate"
        },
        {
          "type": "null"
        }
      ],
      "description": "Target date for moving from soft_close to hard_close."
    },
    "note": {
      "description": "Free-form note.",
      "type": [
        "string",
        "null"
      ]
    },
    "parent_period": {
      "anyOf": [
        {
          "$ref": "#/$defs/PathRef"
        },
        {
          "type": "null"
        }
      ],
      "description": "Roll-up: month → quarter → year. PathRef into the parent\nAccountingPeriod record."
    },
    "reopened_reason": {
      "description": "Required when status: Reopened — justification + BDR reference.",
      "type": [
        "string",
        "null"
      ]
    },
    "start": {
      "$ref": "#/$defs/IsoDate",
      "description": "Start date (inclusive)."
    },
    "status": {
      "$ref": "#/$defs/PeriodStatus",
      "description": "Current status."
    }
  },
  "required": [
    "id",
    "entity",
    "kind",
    "start",
    "end",
    "fiscal_year",
    "status"
  ],
  "title": "AccountingPeriod",
  "type": "object",
  "x-corpospec-pillar": "financials"
}