{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://raw.githubusercontent.com/api-evangelist/pagopa/main/json-schema/pagopa-purpose-template-schema.json",
  "title": "PurposeTemplate",
  "x-generated": "2026-10-09",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/pagopa-pdnd-interop-v2-openapi.yml#/components/schemas/PurposeTemplate",
  "type": "object",
  "additionalProperties": false,
  "properties": {
    "id": {
      "type": "string",
      "format": "uuid"
    },
    "targetDescription": {
      "type": "string"
    },
    "targetTenantKind": {
      "$ref": "#/$defs/TargetTenantKind"
    },
    "creatorId": {
      "type": "string",
      "format": "uuid",
      "description": "The ID of the Tenant that created the Purpose Template"
    },
    "state": {
      "$ref": "#/$defs/PurposeTemplateState"
    },
    "createdAt": {
      "type": "string",
      "format": "date-time"
    },
    "updatedAt": {
      "type": "string",
      "format": "date-time"
    },
    "purposeTitle": {
      "type": "string"
    },
    "purposeDescription": {
      "type": "string"
    },
    "purposeIsFreeOfCharge": {
      "type": "boolean"
    },
    "purposeFreeOfChargeReason": {
      "type": "string"
    },
    "purposeDailyCalls": {
      "description": "Maximum number of daily calls that the purpose can perform",
      "type": "integer",
      "format": "int32",
      "minimum": 1,
      "maximum": 1000000000
    },
    "handlesPersonalData": {
      "type": "boolean"
    }
  },
  "required": [
    "id",
    "targetDescription",
    "targetTenantKind",
    "creatorId",
    "state",
    "createdAt",
    "purposeTitle",
    "purposeDescription",
    "purposeIsFreeOfCharge",
    "handlesPersonalData"
  ],
  "$defs": {
    "PurposeTemplateState": {
      "type": "string",
      "description": "Purpose Template State",
      "enum": [
        "PUBLISHED",
        "DRAFT",
        "SUSPENDED",
        "ARCHIVED"
      ]
    },
    "TargetTenantKind": {
      "type": "string",
      "description": "The Target Tenant Kind of a Purpose Template",
      "enum": [
        "PA",
        "PRIVATE"
      ]
    }
  }
}