{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://raw.githubusercontent.com/api-evangelist/pagopa/main/json-schema/pagopa-agreement-schema.json",
  "title": "Agreement",
  "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/Agreement",
  "type": "object",
  "additionalProperties": false,
  "properties": {
    "id": {
      "type": "string",
      "format": "uuid"
    },
    "eserviceId": {
      "type": "string",
      "format": "uuid"
    },
    "descriptorId": {
      "type": "string",
      "format": "uuid"
    },
    "producerId": {
      "type": "string",
      "format": "uuid"
    },
    "consumerId": {
      "type": "string",
      "format": "uuid"
    },
    "delegationId": {
      "type": "string",
      "format": "uuid"
    },
    "state": {
      "$ref": "#/$defs/AgreementState"
    },
    "suspendedByConsumer": {
      "type": "boolean"
    },
    "suspendedByProducer": {
      "type": "boolean"
    },
    "suspendedByPlatform": {
      "type": "boolean"
    },
    "consumerNotes": {
      "type": "string"
    },
    "rejectionReason": {
      "type": "string"
    },
    "createdAt": {
      "type": "string",
      "format": "date-time"
    },
    "updatedAt": {
      "type": "string",
      "format": "date-time"
    },
    "suspendedAt": {
      "type": "string",
      "format": "date-time"
    }
  },
  "required": [
    "id",
    "eserviceId",
    "descriptorId",
    "producerId",
    "consumerId",
    "state",
    "createdAt"
  ],
  "$defs": {
    "AgreementState": {
      "type": "string",
      "description": "Agreement State",
      "enum": [
        "DRAFT",
        "ACTIVE",
        "ARCHIVED",
        "PENDING",
        "SUSPENDED",
        "MISSING_CERTIFIED_ATTRIBUTES",
        "REJECTED"
      ]
    }
  }
}