{
  "$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"
    },
    "PiiClass": {
      "description": "Personal-data classification on every record carrying personal data, per\nBDR 0070 / BDR 0069 / BDR 0078. Used by `corpospec-report` to gate\nrendering and by the privacy pillar's RoPA records to determine\nsafeguards.",
      "oneOf": [
        {
          "const": "none",
          "description": "No personal data.",
          "type": "string"
        },
        {
          "const": "public_personal",
          "description": "Public personal data (already disclosed by the subject, e.g. CEO name).",
          "type": "string"
        },
        {
          "const": "internal",
          "description": "Internal-only personal data (employee directory).",
          "type": "string"
        },
        {
          "const": "personal",
          "description": "Personal data per GDPR Art. 4(1).",
          "type": "string"
        },
        {
          "const": "special_category",
          "description": "Special-category data per GDPR Art. 9 (health, biometric, genetic,\nreligion, ethnicity, sex life, political opinion, trade union).",
          "type": "string"
        },
        {
          "const": "criminal_data",
          "description": "Criminal data per GDPR Art. 10.",
          "type": "string"
        },
        {
          "const": "sensitive",
          "description": "CCPA / CPRA \"sensitive personal information\".",
          "type": "string"
        }
      ]
    },
    "RequestOutcome": {
      "description": "Outcome / decision narrative.",
      "properties": {
        "narrative": {
          "description": "Free-form narrative.",
          "type": "string"
        },
        "refusal_grounds": {
          "description": "Refusal grounds (e.g. \"Art. 12(5)(b) — manifestly excessive\",\n\"Art. 23(1)(e) — important objective of public interest\").",
          "type": [
            "string",
            "null"
          ]
        },
        "response_ref": {
          "anyOf": [
            {
              "$ref": "#/$defs/PathRef"
            },
            {
              "type": "null"
            }
          ],
          "description": "PathRef to the response artefact (export ZIP, redacted log,\nconfirmation letter)."
        },
        "status": {
          "$ref": "#/$defs/SubjectRequestStatus"
        }
      },
      "required": [
        "status",
        "narrative"
      ],
      "type": "object"
    },
    "SubjectRequestKind": {
      "description": "Request type per GDPR article.",
      "oneOf": [
        {
          "const": "art_15_access",
          "description": "Art. 15 — right of access.",
          "type": "string"
        },
        {
          "const": "art_16_rectification",
          "description": "Art. 16 — right to rectification.",
          "type": "string"
        },
        {
          "const": "art_17_erasure",
          "description": "Art. 17 — right to erasure (RTBF).",
          "type": "string"
        },
        {
          "const": "art_18_restriction",
          "description": "Art. 18 — right to restriction of processing.",
          "type": "string"
        },
        {
          "const": "art_19_notification",
          "description": "Art. 19 — notification obligation to recipients.",
          "type": "string"
        },
        {
          "const": "art_20_portability",
          "description": "Art. 20 — right to data portability.",
          "type": "string"
        },
        {
          "const": "art_21_objection",
          "description": "Art. 21 — right to object.",
          "type": "string"
        },
        {
          "const": "art_22_adm",
          "description": "Art. 22 — right re. automated decision-making.",
          "type": "string"
        },
        {
          "const": "other_jurisdiction",
          "description": "CCPA / CPRA / FADP equivalent (catch-all).",
          "type": "string"
        }
      ]
    },
    "SubjectRequestStatus": {
      "description": "Lifecycle.",
      "oneOf": [
        {
          "enum": [
            "received",
            "in_progress",
            "closed"
          ],
          "type": "string"
        },
        {
          "const": "identity_verified",
          "description": "Identity verified.",
          "type": "string"
        },
        {
          "const": "extended",
          "description": "Deadline extended (Art. 12(3) — 2 month extension; subject\nnotified).",
          "type": "string"
        },
        {
          "const": "fulfilled",
          "description": "Fulfilled (positive outcome).",
          "type": "string"
        },
        {
          "const": "partially_fulfilled",
          "description": "Partially fulfilled (some data refused with reasoning).",
          "type": "string"
        },
        {
          "const": "refused",
          "description": "Refused (manifestly unfounded / excessive / Art. 23 derogation).",
          "type": "string"
        },
        {
          "const": "withdrawn",
          "description": "Withdrawn by data subject.",
          "type": "string"
        }
      ]
    }
  },
  "$id": "https://corpospec.com/schemas/v0.16.0/gdpr-subject-request.schema.json",
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "additionalProperties": false,
  "description": "Subject request record.",
  "properties": {
    "deadline": {
      "$ref": "#/$defs/IsoDate",
      "description": "Statutory deadline (received_at + 1 month, or +3 months if\nextended)."
    },
    "entity": {
      "$ref": "#/$defs/PathRef"
    },
    "extended": {
      "description": "Whether the deadline was extended under Art. 12(3).",
      "type": "boolean"
    },
    "id": {
      "$ref": "#/$defs/PathRef"
    },
    "identity_verified_at": {
      "anyOf": [
        {
          "$ref": "#/$defs/IsoDate"
        },
        {
          "type": "null"
        }
      ],
      "description": "Date identity was verified."
    },
    "kind": {
      "$ref": "#/$defs/SubjectRequestKind"
    },
    "outcome": {
      "anyOf": [
        {
          "$ref": "#/$defs/RequestOutcome"
        },
        {
          "type": "null"
        }
      ],
      "description": "Outcome (None until the request is closed)."
    },
    "pii_class": {
      "$ref": "#/$defs/PiiClass"
    },
    "received_at": {
      "$ref": "#/$defs/IsoDate",
      "description": "Date the request was received."
    },
    "request_ref": {
      "anyOf": [
        {
          "$ref": "#/$defs/PathRef"
        },
        {
          "type": "null"
        }
      ],
      "description": "PathRef to the request-text artefact (email, form submission)."
    },
    "retention_until": {
      "$ref": "#/$defs/IsoDate",
      "description": "Retention: 3 years after closure (BGB §195) — narrow because\nthe record itself contains PII pseudonyms."
    },
    "scoped_processing_records": {
      "description": "PathRefs to processing records the request scans.",
      "items": {
        "$ref": "#/$defs/PathRef"
      },
      "type": "array"
    },
    "status": {
      "$ref": "#/$defs/SubjectRequestStatus"
    },
    "subject_pseudonym": {
      "description": "Pseudonymised subject reference (e.g. hash of email; never the\nemail itself in this record).",
      "type": "string"
    },
    "subject_ref": {
      "anyOf": [
        {
          "$ref": "#/$defs/PathRef"
        },
        {
          "type": "null"
        }
      ],
      "description": "Optional PathRef into the canonical subject record (people/, or\ncustomer-of-tenant ledger). Only present when the subject is an\ninternal known person."
    }
  },
  "required": [
    "id",
    "entity",
    "kind",
    "subject_pseudonym",
    "received_at",
    "deadline",
    "extended",
    "status",
    "retention_until",
    "pii_class"
  ],
  "title": "GdprSubjectRequest",
  "type": "object",
  "x-corpospec-pillar": "privacy"
}