{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://uklsp.org/schemas/v0.1/service-capability.schema.json",
  "title": "ServiceCapability",
  "description": "One service a provider can deliver: what, where, at what price model, under which certification.",
  "type": "object",
  "properties": {
    "service_code": {
      "type": "string",
      "enum": [
        "cp12_gas_safety",
        "eicr",
        "epc",
        "fire_door_inspection",
        "pat_testing",
        "legionella_risk_assessment",
        "landlord_compliance_bundle",
        "emergency_boiler_repair",
        "boiler_service",
        "drain_unblocking",
        "cctv_drain_survey",
        "roof_repair",
        "roof_replacement",
        "other"
      ],
      "description": "Closed list v0.1; extension via 'other' + service_label. New codes via governance process."
    },
    "service_label": {
      "type": "string",
      "description": "Human/agent-readable name. Required when service_code='other'."
    },
    "coverage": {
      "type": "array",
      "items": {
        "type": "string",
        "pattern": "^[A-Z]{1,2}[0-9][A-Z0-9]?$",
        "description": "UK postcode district, e.g. LS6, M14, B1."
      },
      "description": "Optional narrowing of provider coverage for this service."
    },
    "pricing": {
      "type": "object",
      "properties": {
        "model": {
          "type": "string",
          "enum": [
            "fixed",
            "from",
            "quote_only"
          ]
        },
        "price": {
          "type": "object",
          "properties": {
            "amount": {
              "type": "number",
              "minimum": 0
            },
            "currency": {
              "type": "string",
              "const": "GBP"
            },
            "vat_treatment": {
              "type": "string",
              "enum": [
                "inc_vat",
                "ex_vat",
                "not_vat_registered"
              ]
            }
          },
          "required": [
            "amount",
            "currency",
            "vat_treatment"
          ],
          "additionalProperties": false
        },
        "callout_fee": {
          "type": "object",
          "properties": {
            "amount": {
              "type": "number",
              "minimum": 0
            },
            "currency": {
              "type": "string",
              "const": "GBP"
            },
            "vat_treatment": {
              "type": "string",
              "enum": [
                "inc_vat",
                "ex_vat",
                "not_vat_registered"
              ]
            }
          },
          "required": [
            "amount",
            "currency",
            "vat_treatment"
          ],
          "additionalProperties": false
        },
        "price_notes": {
          "type": "string",
          "maxLength": 300
        }
      },
      "required": [
        "model"
      ],
      "additionalProperties": false,
      "description": "model=fixed \u2192 price binding; from \u2192 price is minimum; quote_only \u2192 no price fields."
    },
    "required_credential_types": {
      "type": "array",
      "items": {
        "type": "string"
      },
      "description": "Credential types that MUST appear in provider.credentials for this capability to be valid, e.g. ['gas_safe']."
    },
    "lead_time_days_min": {
      "type": "integer",
      "minimum": 0
    },
    "duration_minutes_typical": {
      "type": "integer",
      "minimum": 5
    },
    "certificate_issued": {
      "type": "boolean",
      "description": "True if the job produces a compliance certificate/report deliverable."
    }
  },
  "required": [
    "service_code",
    "pricing"
  ],
  "additionalProperties": false
}
