{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://darkpatternaudit.tech/format/osas-v0.1.schema.json",
  "title": "Open Self-Audit Statement, version 0.1",
  "description": "A dark-pattern self-audit statement under Rule 4(15) of the Consumer Protection (E-Commerce) Rules, 2020, as amended by G.S.R. 789(E) dated 9 September 2026. Licence: CC BY 4.0.",
  "type": "object",
  "additionalProperties": false,
  "required": ["format", "statutoryBasis", "entity", "properties", "dates", "scope", "exclusions", "method", "coverage", "openItems", "attestation", "limitations", "disclaimer"],
  "properties": {
    "format": {
      "type": "object",
      "additionalProperties": false,
      "required": ["name", "version"],
      "properties": {
        "name": { "const": "Open Self-Audit Statement" },
        "version": { "const": "0.1" },
        "url": { "type": "string", "format": "uri" }
      }
    },
    "statutoryBasis": { "type": "string", "minLength": 1 },
    "entity": {
      "type": "object",
      "additionalProperties": false,
      "required": ["legalName"],
      "properties": {
        "legalName": { "type": "string", "minLength": 1 },
        "cin": { "type": ["string", "null"] },
        "gstin": { "type": ["string", "null"] },
        "registeredAddress": { "type": ["string", "null"] }
      }
    },
    "properties": {
      "type": "object",
      "additionalProperties": false,
      "required": ["websites", "apps"],
      "properties": {
        "websites": { "type": "array", "items": { "type": "string", "minLength": 1 } },
        "apps": { "type": "array", "items": { "type": "string", "minLength": 1 } }
      },
      "anyOf": [
        { "properties": { "websites": { "minItems": 1 } } },
        { "properties": { "apps": { "minItems": 1 } } }
      ]
    },
    "dates": {
      "type": "object",
      "additionalProperties": false,
      "required": ["auditDate", "nextAuditDue"],
      "properties": {
        "auditDate": { "type": "string", "format": "date" },
        "periodStart": { "type": ["string", "null"], "format": "date" },
        "periodEnd": { "type": ["string", "null"], "format": "date" },
        "nextAuditDue": { "type": "string", "format": "date" }
      }
    },
    "scope": {
      "type": "object",
      "additionalProperties": false,
      "required": ["surfaces"],
      "properties": {
        "surfaces": {
          "type": "array",
          "minItems": 1,
          "uniqueItems": true,
          "items": { "enum": ["public_web", "authenticated", "mobile_app"] }
        },
        "journeys": { "type": ["string", "null"] }
      }
    },
    "exclusions": {
      "description": "Everything not examined. Must be displayed with the same prominence as the scope.",
      "type": "array",
      "items": { "type": "string", "minLength": 1 }
    },
    "method": {
      "type": "object",
      "additionalProperties": false,
      "required": ["description"],
      "properties": {
        "description": { "type": "string", "minLength": 1 },
        "evidenceRecord": {
          "type": ["object", "null"],
          "additionalProperties": false,
          "properties": {
            "sha256": { "type": ["string", "null"], "pattern": "^[a-fA-F0-9]{64}$" },
            "verificationUrl": { "type": ["string", "null"], "format": "uri" }
          }
        }
      }
    },
    "coverage": {
      "description": "One entry per specified dark pattern (DP01-DP13) and per listed duty.",
      "type": "array",
      "minItems": 13,
      "items": {
        "type": "object",
        "additionalProperties": false,
        "required": ["id", "group", "item", "basis", "outcome"],
        "properties": {
          "id": { "type": "string", "pattern": "^(DP(0[1-9]|1[0-3])|R[0-9]+-[0-9]+[a-z]?)$" },
          "group": { "enum": ["dark_pattern", "duty"] },
          "item": { "type": "string", "minLength": 1 },
          "basis": { "type": "string", "minLength": 1 },
          "outcome": { "enum": ["no_issue_identified", "issue_remediated", "issue_open", "not_applicable", "not_examined"] }
        }
      }
    },
    "openItems": {
      "type": "object",
      "additionalProperties": false,
      "required": ["count", "remediatedCount"],
      "properties": {
        "count": { "type": "integer", "minimum": 0 },
        "remediatedCount": { "type": "integer", "minimum": 0 },
        "owner": { "type": ["string", "null"] },
        "targetDate": { "type": ["string", "null"], "format": "date" },
        "notes": { "type": ["string", "null"] }
      },
      "if": { "properties": { "count": { "minimum": 1 } } },
      "then": {
        "required": ["owner", "targetDate"],
        "properties": { "owner": { "type": "string", "minLength": 1 }, "targetDate": { "type": "string" } }
      }
    },
    "attestation": {
      "type": "object",
      "additionalProperties": false,
      "required": ["name", "designation", "date", "declaration"],
      "properties": {
        "name": { "type": "string", "minLength": 1 },
        "designation": { "type": "string", "minLength": 1 },
        "date": { "type": "string", "format": "date" },
        "declaration": { "type": "string", "minLength": 1 }
      }
    },
    "limitations": { "type": "array", "minItems": 1, "items": { "type": "string" } },
    "disclaimer": { "type": "string", "minLength": 1 }
  }
}
