{
    "openapi": "3.0.0",
    "info": {
        "title": "Eszerzodes API",
        "description": "API documentation for Eszerzodes",
        "contact": {
            "email": "info@eszerzodes.hu"
        },
        "version": "1.0.0"
    },
    "paths": {
        "/api/agent/ai/extract": {
            "post": {
                "tags": [
                    "Ai"
                ],
                "summary": "Start data layer extraction",
                "description": "Extracts contract data using a selected schema or returns an existing result.",
                "operationId": "dataLayer",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "required": [
                                    "contract_id",
                                    "schema_key"
                                ],
                                "properties": {
                                    "contract_id": {
                                        "description": "ID of a contract you own or participate in.",
                                        "type": "integer"
                                    },
                                    "schema_key": {
                                        "description": "Name of your extraction schema.",
                                        "type": "string"
                                    },
                                    "webhook_url": {
                                        "description": "Optional callback URL for the extraction.",
                                        "type": "string",
                                        "format": "uri",
                                        "nullable": true,
                                        "maxLength": 500
                                    }
                                },
                                "type": "object"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Extraction result. Check status for progress or failure.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "required": [
                                        "data_layer_result_id",
                                        "status",
                                        "result",
                                        "callback_status"
                                    ],
                                    "properties": {
                                        "data_layer_result_id": {
                                            "type": "integer"
                                        },
                                        "status": {
                                            "description": "Current extraction status.",
                                            "type": "string",
                                            "example": "waiting",
                                            "nullable": true,
                                            "enum": [
                                                "waiting",
                                                "success",
                                                "failed"
                                            ]
                                        },
                                        "result": {
                                            "description": "Extracted JSON data, or null when unavailable.",
                                            "nullable": true
                                        },
                                        "callback_status": {
                                            "description": "Callback HTTP status code, or null when unavailable.",
                                            "type": "string",
                                            "example": "200",
                                            "nullable": true
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "400": {
                        "description": "Invalid request or extraction could not start.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "required": [
                                        "status",
                                        "message"
                                    ],
                                    "properties": {
                                        "status": {
                                            "type": "string",
                                            "example": "error",
                                            "enum": [
                                                "error"
                                            ]
                                        },
                                        "message": {
                                            "type": "string"
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Unauthenticated.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "required": [
                                        "message"
                                    ],
                                    "properties": {
                                        "message": {
                                            "type": "string",
                                            "example": "Unauthenticated."
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "Membership inactive or access denied.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "anyOf": [
                                        {
                                            "required": [
                                                "status",
                                                "message"
                                            ],
                                            "properties": {
                                                "status": {
                                                    "type": "string",
                                                    "example": "error",
                                                    "enum": [
                                                        "error"
                                                    ]
                                                },
                                                "message": {
                                                    "type": "string",
                                                    "example": "No active membership! - You cannot send API requests because your subscription is not active."
                                                }
                                            },
                                            "type": "object"
                                        },
                                        {
                                            "required": [
                                                "message"
                                            ],
                                            "properties": {
                                                "message": {
                                                    "type": "string",
                                                    "example": "Access denied from this IP address."
                                                }
                                            },
                                            "type": "object"
                                        }
                                    ]
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "Too many requests.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "required": [
                                        "status",
                                        "message"
                                    ],
                                    "properties": {
                                        "status": {
                                            "type": "string",
                                            "example": "error",
                                            "enum": [
                                                "error"
                                            ]
                                        },
                                        "message": {
                                            "type": "string"
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "sanctum": []
                    }
                ]
            }
        },
        "/api/agent/ai/data-layers": {
            "get": {
                "tags": [
                    "Ai"
                ],
                "summary": "List available data layers (schemas)",
                "description": "Lists your enabled extraction schemas.",
                "operationId": "listDataLayers",
                "responses": {
                    "200": {
                        "description": "Available extraction schemas.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "array",
                                    "items": {
                                        "required": [
                                            "id",
                                            "name",
                                            "is_enabled",
                                            "schema"
                                        ],
                                        "properties": {
                                            "id": {
                                                "type": "integer",
                                                "example": 1
                                            },
                                            "name": {
                                                "description": "Schema name to use for extraction.",
                                                "type": "string",
                                                "example": "szerzodes_alap_adatok"
                                            },
                                            "is_enabled": {
                                                "type": "boolean",
                                                "example": true,
                                                "enum": [
                                                    true
                                                ]
                                            },
                                            "schema": {
                                                "description": "Expected extraction output structure.",
                                                "type": "object",
                                                "additionalProperties": true
                                            }
                                        },
                                        "type": "object"
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Unauthenticated.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "required": [
                                        "message"
                                    ],
                                    "properties": {
                                        "message": {
                                            "type": "string",
                                            "example": "Unauthenticated."
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "Membership inactive or access denied.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "anyOf": [
                                        {
                                            "required": [
                                                "status",
                                                "message"
                                            ],
                                            "properties": {
                                                "status": {
                                                    "type": "string",
                                                    "example": "error",
                                                    "enum": [
                                                        "error"
                                                    ]
                                                },
                                                "message": {
                                                    "type": "string",
                                                    "example": "No active membership! - You cannot send API requests because your subscription is not active."
                                                }
                                            },
                                            "type": "object"
                                        },
                                        {
                                            "required": [
                                                "message"
                                            ],
                                            "properties": {
                                                "message": {
                                                    "type": "string",
                                                    "example": "Access denied from this IP address."
                                                }
                                            },
                                            "type": "object"
                                        }
                                    ]
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "Too many requests.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "required": [
                                        "status",
                                        "message"
                                    ],
                                    "properties": {
                                        "status": {
                                            "type": "string",
                                            "example": "error",
                                            "enum": [
                                                "error"
                                            ]
                                        },
                                        "message": {
                                            "type": "string"
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "sanctum": []
                    }
                ]
            }
        },
        "/api/agent/contracts": {
            "get": {
                "tags": [
                    "Contract"
                ],
                "summary": "List contracts",
                "description": "Lists your contracts, 20 per page.",
                "operationId": "contracts",
                "parameters": [
                    {
                        "name": "page",
                        "in": "query",
                        "description": "Page number.",
                        "required": false,
                        "schema": {
                            "type": "integer",
                            "default": 1,
                            "minimum": 1
                        }
                    },
                    {
                        "name": "search_query",
                        "in": "query",
                        "description": "Search contracts.",
                        "required": false,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "search_contract_type",
                        "in": "query",
                        "description": "Template ID.",
                        "required": false,
                        "schema": {
                            "type": "integer"
                        }
                    },
                    {
                        "name": "contract_creator",
                        "in": "query",
                        "description": "Creator user ID.",
                        "required": false,
                        "schema": {
                            "type": "integer"
                        }
                    },
                    {
                        "name": "user_id",
                        "in": "query",
                        "description": "Participant user ID.",
                        "required": false,
                        "schema": {
                            "type": "integer"
                        }
                    },
                    {
                        "name": "finalized_at",
                        "in": "query",
                        "description": "Finalization date.",
                        "required": false,
                        "schema": {
                            "type": "string",
                            "format": "date"
                        }
                    },
                    {
                        "name": "status",
                        "in": "query",
                        "description": "Contract state: 0 draft, 1 pending, 2 finalized.",
                        "required": false,
                        "schema": {
                            "type": "integer"
                        }
                    },
                    {
                        "name": "is_archived",
                        "in": "query",
                        "description": "Filter archived contracts.",
                        "required": false,
                        "schema": {
                            "type": "boolean"
                        }
                    },
                    {
                        "name": "sort_direction",
                        "in": "query",
                        "description": "Sort by contract ID.",
                        "required": false,
                        "schema": {
                            "type": "string",
                            "default": "DESC",
                            "enum": [
                                "ASC",
                                "DESC"
                            ]
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "List contracts.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "required": [
                                        "data"
                                    ],
                                    "properties": {
                                        "data": {
                                            "$ref": "#/components/schemas/ContractPage"
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Unauthenticated.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "required": [
                                        "message"
                                    ],
                                    "properties": {
                                        "message": {
                                            "type": "string",
                                            "example": "Unauthenticated."
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "Requires contracts:read. The contract or account may not allow this action.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "anyOf": [
                                        {
                                            "required": [
                                                "status",
                                                "message"
                                            ],
                                            "properties": {
                                                "status": {
                                                    "type": "string",
                                                    "enum": [
                                                        "error"
                                                    ]
                                                },
                                                "message": {
                                                    "type": "string",
                                                    "example": "You are not authorized for this operation (contracts:read)",
                                                    "enum": [
                                                        "You are not authorized for this operation (contracts:read)"
                                                    ]
                                                }
                                            },
                                            "type": "object"
                                        },
                                        {
                                            "required": [
                                                "message"
                                            ],
                                            "properties": {
                                                "message": {
                                                    "type": "string",
                                                    "example": "Access denied from this IP address."
                                                }
                                            },
                                            "type": "object"
                                        },
                                        {
                                            "required": [
                                                "error"
                                            ],
                                            "properties": {
                                                "error": {
                                                    "description": "Localized access denial message.",
                                                    "type": "string"
                                                }
                                            },
                                            "type": "object"
                                        }
                                    ]
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "Too many requests.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "required": [
                                        "status",
                                        "message"
                                    ],
                                    "properties": {
                                        "status": {
                                            "type": "string",
                                            "enum": [
                                                "error"
                                            ]
                                        },
                                        "message": {
                                            "description": "Localized rate limit message.",
                                            "type": "string"
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "sanctum": []
                    }
                ]
            },
            "post": {
                "tags": [
                    "Contract"
                ],
                "summary": "Create new contract",
                "description": "Creates a new contract from a template. You can pre-fill template variables and partner details.",
                "operationId": "storeContract",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "required": [
                                    "contract_type_id",
                                    "title"
                                ],
                                "properties": {
                                    "contract_type_id": {
                                        "description": "ID of the template (Contract Type)",
                                        "type": "string"
                                    },
                                    "title": {
                                        "description": "Title (Subject) of the contract",
                                        "type": "string"
                                    },
                                    "client_title": {
                                        "description": "Override Client title (Sender)",
                                        "type": "string"
                                    },
                                    "trustee_title": {
                                        "description": "Override Trustee title (Receiver)",
                                        "type": "string"
                                    },
                                    "allowed_user_type": {
                                        "description": "Restriction for signer type: 0=Any, 1=Company Only, 2=Private Individual Only",
                                        "type": "integer",
                                        "enum": [
                                            0,
                                            1,
                                            2
                                        ]
                                    },
                                    "own_id": {
                                        "description": "Optional internal ID (must be unique per user)",
                                        "type": "string"
                                    },
                                    "has_expiration_date": {
                                        "description": "Whether the contract has an expiration date",
                                        "type": "boolean"
                                    },
                                    "expiration_date": {
                                        "description": "Expiration ID (YYYY-MM-DD), required if has_expiration_date is true",
                                        "type": "string",
                                        "format": "date"
                                    },
                                    "expiration_date_title": {
                                        "description": "Label for the expiration date",
                                        "type": "string"
                                    },
                                    "intro_disabled": {
                                        "description": "If true, the intro section is disabled",
                                        "type": "boolean"
                                    },
                                    "accompanying_message": {
                                        "description": "Custom email message to accompany the invitation",
                                        "type": "string"
                                    },
                                    "need_validation": {
                                        "description": "Validation level: 0=Basic (Email), 1=Phone (+1 timestamp), 2=eID, 3=Video KYC (Didit)",
                                        "type": "integer"
                                    },
                                    "callback_url": {
                                        "description": "Optional callback URL for contract events",
                                        "type": "string"
                                    },
                                    "copy_to_email": {
                                        "description": "Optional comma-separated email addresses (max 5) to receive a copy of the contract",
                                        "type": "string"
                                    },
                                    "redirect_url": {
                                        "description": "Optional redirect URL for user after signing",
                                        "type": "string"
                                    },
                                    "template_data": {
                                        "description": "Key-value pairs to replace variables in the template (e.g. [[variable]] -> value)",
                                        "type": "object"
                                    },
                                    "contract_public_url": {
                                        "type": "boolean",
                                        "example": false
                                    },
                                    "partners": {
                                        "description": "List of partners to invite (Position 2+).",
                                        "type": "array",
                                        "items": {
                                            "properties": {
                                                "position": {
                                                    "description": "Position (2 = Main Counterparty, 3+ = Others)",
                                                    "type": "integer"
                                                },
                                                "email": {
                                                    "description": "Partner email",
                                                    "type": "string"
                                                },
                                                "title": {
                                                    "description": "Specific title for this partner (e.g. 'Witness 1')",
                                                    "type": "string"
                                                },
                                                "partner_details": {
                                                    "description": "Optional partner details",
                                                    "type": "object"
                                                }
                                            },
                                            "type": "object"
                                        }
                                    }
                                },
                                "type": "object"
                            },
                            "examples": {
                                "create_simple": {
                                    "summary": "Create with Simple Invite",
                                    "value": {
                                        "contract_type_id": 10,
                                        "title": "Simple Contract",
                                        "own_id": "MY-INT-123",
                                        "has_expiration_date": true,
                                        "expiration_date": "2025-12-31",
                                        "allowed_user_type": 0,
                                        "expiration_date_title": "Valid until",
                                        "intro_disabled": true,
                                        "contract_public_url": false,
                                        "accompanying_message": "Please sign this.",
                                        "callback_url": "https://site.com/callback",
                                        "redirect_url": "https://site.com/redirect",
                                        "template_data": {
                                            "price": "1000 EUR"
                                        },
                                        "partners": [
                                            {
                                                "position": 2,
                                                "email": "partner@example.com"
                                            }
                                        ],
                                        "sign_now": true
                                    }
                                },
                                "create_multiparty": {
                                    "summary": "Create Multipary Contract",
                                    "value": {
                                        "contract_type_id": 10,
                                        "title": "Multiparty Contract",
                                        "own_id": "MY-INT-456",
                                        "has_expiration_date": true,
                                        "expiration_date": "2025-12-31",
                                        "allowed_user_type": 0,
                                        "expiration_date_title": "Valid until",
                                        "intro_disabled": true,
                                        "accompanying_message": "Please sign everyone.",
                                        "sign_now": true,
                                        "callback_url": "https://site.com/callback",
                                        "redirect_url": "https://site.com/redirect",
                                        "partners": [
                                            {
                                                "position": 2,
                                                "email": "pos2@example.com"
                                            },
                                            {
                                                "position": 3,
                                                "email": "pos3@example.com"
                                            },
                                            {
                                                "position": 4,
                                                "email": "pos4@example.com",
                                                "partner_details": {
                                                    "partner_type": 1,
                                                    "signatory_name": "Pos4 Name",
                                                    "phone_number": "+36301234567",
                                                    "address": "1234 City, Street 1",
                                                    "mothers_name": "Mother Name",
                                                    "birthday": "1980-01-01",
                                                    "place_of_birth": "City"
                                                }
                                            }
                                        ]
                                    }
                                },
                                "create_mixed": {
                                    "summary": "Create Mixed (Business & Individual)",
                                    "value": {
                                        "contract_type_id": 10,
                                        "title": "Mixed Partners Contract",
                                        "own_id": "MY-INT-789",
                                        "has_expiration_date": true,
                                        "expiration_date": "2025-12-31",
                                        "allowed_user_type": 0,
                                        "expiration_date_title": "Valid until",
                                        "intro_disabled": true,
                                        "accompanying_message": "Please sign this.",
                                        "sign_now": true,
                                        "callback_url": "https://site.com/callback",
                                        "redirect_url": "https://site.com/redirect",
                                        "copy_to_email": "copy@example.com",
                                        "template_data": {
                                            "price": "1000 EUR"
                                        },
                                        "partners": [
                                            {
                                                "position": 2,
                                                "email": "ceo@example.com",
                                                "partner_details": {
                                                    "partner_type": 2,
                                                    "company_name": "Example Ltd.",
                                                    "company_tax_number": "12345678-1-42",
                                                    "company_registered_office": "1234 City, Street 1",
                                                    "signatory_name": "John CEO"
                                                }
                                            },
                                            {
                                                "position": 3,
                                                "email": "private@example.com",
                                                "partner_details": {
                                                    "partner_type": 1,
                                                    "signatory_name": "Jane Private",
                                                    "phone_number": "+36301234567",
                                                    "address": "5678 Town, Road 2",
                                                    "mothers_name": "Mother Name",
                                                    "birthday": "1980-01-01",
                                                    "place_of_birth": "City"
                                                }
                                            }
                                        ]
                                    }
                                },
                                "create_unilateral": {
                                    "summary": "Create Unilateral Declaration",
                                    "value": {
                                        "contract_type_id": 10,
                                        "title": "Unilateral Declaration",
                                        "own_id": "MY-INT-UNI",
                                        "has_expiration_date": true,
                                        "expiration_date": "2025-12-31",
                                        "allowed_user_type": 0,
                                        "expiration_date_title": "Valid until",
                                        "intro_disabled": true,
                                        "accompanying_message": "Please sign this.",
                                        "is_one_sided": 1,
                                        "copy_to_email": "copy@example.com",
                                        "sign_now": true,
                                        "callback_url": "https://site.com/callback",
                                        "redirect_url": "https://site.com/redirect",
                                        "template_data": {
                                            "field": "value"
                                        },
                                        "signer_count": 1
                                    }
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Contract created successfully",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "required": [
                                        "message",
                                        "contract"
                                    ],
                                    "properties": {
                                        "message": {
                                            "type": "string",
                                            "example": "Contract created successfully"
                                        },
                                        "contract": {
                                            "$ref": "#/components/schemas/ContractDetail"
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "400": {
                        "description": "Bad Request",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "status": {
                                            "type": "string",
                                            "example": "error"
                                        },
                                        "message": {
                                            "type": "string",
                                            "example": "Invalid data"
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "Not Found",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "status": {
                                            "type": "string",
                                            "example": "error"
                                        },
                                        "message": {
                                            "type": "string",
                                            "example": "Template not found"
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "Forbidden",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "status": {
                                            "type": "string",
                                            "example": "error"
                                        },
                                        "message": {
                                            "type": "string",
                                            "example": "You are not authorized for this operation (contracts:write)"
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "sanctum": []
                    }
                ]
            }
        },
        "/api/agent/contracts/{id}": {
            "get": {
                "tags": [
                    "Contract"
                ],
                "summary": "Get contract details",
                "description": "Returns a contract’s details.",
                "operationId": "showContract",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "description": "Contract ID.",
                        "required": true,
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Get contract details.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "required": [
                                        "data"
                                    ],
                                    "properties": {
                                        "data": {
                                            "$ref": "#/components/schemas/ContractDetail"
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Unauthenticated.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "required": [
                                        "message"
                                    ],
                                    "properties": {
                                        "message": {
                                            "type": "string",
                                            "example": "Unauthenticated."
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "Requires contracts:read. The contract or account may not allow this action.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "anyOf": [
                                        {
                                            "required": [
                                                "status",
                                                "message"
                                            ],
                                            "properties": {
                                                "status": {
                                                    "type": "string",
                                                    "enum": [
                                                        "error"
                                                    ]
                                                },
                                                "message": {
                                                    "type": "string",
                                                    "example": "You are not authorized for this operation (contracts:read)",
                                                    "enum": [
                                                        "You are not authorized for this operation (contracts:read)"
                                                    ]
                                                }
                                            },
                                            "type": "object"
                                        },
                                        {
                                            "required": [
                                                "message"
                                            ],
                                            "properties": {
                                                "message": {
                                                    "type": "string",
                                                    "example": "Access denied from this IP address."
                                                }
                                            },
                                            "type": "object"
                                        },
                                        {
                                            "required": [
                                                "error"
                                            ],
                                            "properties": {
                                                "error": {
                                                    "description": "Localized access denial message.",
                                                    "type": "string"
                                                }
                                            },
                                            "type": "object"
                                        }
                                    ]
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "Contract not found or unavailable.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "required": [
                                        "status",
                                        "message"
                                    ],
                                    "properties": {
                                        "status": {
                                            "type": "string",
                                            "enum": [
                                                "error"
                                            ]
                                        },
                                        "message": {
                                            "type": "string",
                                            "example": "Contract not found or access denied",
                                            "enum": [
                                                "Contract not found or access denied"
                                            ]
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "Too many requests.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "required": [
                                        "status",
                                        "message"
                                    ],
                                    "properties": {
                                        "status": {
                                            "type": "string",
                                            "enum": [
                                                "error"
                                            ]
                                        },
                                        "message": {
                                            "description": "Localized rate limit message.",
                                            "type": "string"
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "sanctum": []
                    }
                ]
            },
            "delete": {
                "tags": [
                    "Contract"
                ],
                "summary": "Delete a contract",
                "description": "Deletes a contract that has not been finalized.",
                "operationId": "deleteContract",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "description": "Contract ID.",
                        "required": true,
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Delete a contract.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "required": [
                                        "data",
                                        "message"
                                    ],
                                    "properties": {
                                        "data": {
                                            "required": [
                                                "contract_id",
                                                "result"
                                            ],
                                            "properties": {
                                                "contract_id": {
                                                    "type": "string",
                                                    "example": "123"
                                                },
                                                "result": {
                                                    "type": "string",
                                                    "example": "Successfully deleted! #123"
                                                }
                                            },
                                            "type": "object"
                                        },
                                        "message": {
                                            "type": "string",
                                            "example": "Successfully deleted!"
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Unauthenticated.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "required": [
                                        "message"
                                    ],
                                    "properties": {
                                        "message": {
                                            "type": "string",
                                            "example": "Unauthenticated."
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "Requires contracts:delete. The contract or account may not allow this action.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "anyOf": [
                                        {
                                            "required": [
                                                "status",
                                                "message"
                                            ],
                                            "properties": {
                                                "status": {
                                                    "type": "string",
                                                    "enum": [
                                                        "error"
                                                    ]
                                                },
                                                "message": {
                                                    "type": "string",
                                                    "example": "You are not authorized for this operation (contracts:delete)",
                                                    "enum": [
                                                        "You are not authorized for this operation (contracts:delete)",
                                                        "The contract has been finalized and cannot be deleted!",
                                                        "You are not authorized to perform this action!"
                                                    ]
                                                }
                                            },
                                            "type": "object"
                                        },
                                        {
                                            "required": [
                                                "message"
                                            ],
                                            "properties": {
                                                "message": {
                                                    "type": "string",
                                                    "example": "Access denied from this IP address."
                                                }
                                            },
                                            "type": "object"
                                        },
                                        {
                                            "required": [
                                                "error"
                                            ],
                                            "properties": {
                                                "error": {
                                                    "description": "Localized access denial message.",
                                                    "type": "string"
                                                }
                                            },
                                            "type": "object"
                                        }
                                    ]
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "Contract not found or unavailable.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "required": [
                                        "status",
                                        "message"
                                    ],
                                    "properties": {
                                        "status": {
                                            "type": "string",
                                            "enum": [
                                                "error"
                                            ]
                                        },
                                        "message": {
                                            "type": "string",
                                            "example": "Contract not found or not authorized!",
                                            "enum": [
                                                "Contract not found or not authorized!"
                                            ]
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "Too many requests.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "required": [
                                        "status",
                                        "message"
                                    ],
                                    "properties": {
                                        "status": {
                                            "type": "string",
                                            "enum": [
                                                "error"
                                            ]
                                        },
                                        "message": {
                                            "description": "Localized rate limit message.",
                                            "type": "string"
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "sanctum": []
                    }
                ]
            }
        },
        "/api/agent/contracts/own-id/{own_id}": {
            "get": {
                "tags": [
                    "Contract"
                ],
                "summary": "Get contract by internal ID",
                "description": "Returns contract details using your internal ID.",
                "operationId": "showContractByOwnId",
                "parameters": [
                    {
                        "name": "own_id",
                        "in": "path",
                        "description": "Your internal contract ID.",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Get contract by internal ID.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "required": [
                                        "data"
                                    ],
                                    "properties": {
                                        "data": {
                                            "$ref": "#/components/schemas/ContractDetail"
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Unauthenticated.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "required": [
                                        "message"
                                    ],
                                    "properties": {
                                        "message": {
                                            "type": "string",
                                            "example": "Unauthenticated."
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "Requires contracts:read. The contract or account may not allow this action.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "anyOf": [
                                        {
                                            "required": [
                                                "status",
                                                "message"
                                            ],
                                            "properties": {
                                                "status": {
                                                    "type": "string",
                                                    "enum": [
                                                        "error"
                                                    ]
                                                },
                                                "message": {
                                                    "type": "string",
                                                    "example": "You are not authorized for this operation (contracts:read)",
                                                    "enum": [
                                                        "You are not authorized for this operation (contracts:read)"
                                                    ]
                                                }
                                            },
                                            "type": "object"
                                        },
                                        {
                                            "required": [
                                                "message"
                                            ],
                                            "properties": {
                                                "message": {
                                                    "type": "string",
                                                    "example": "Access denied from this IP address."
                                                }
                                            },
                                            "type": "object"
                                        },
                                        {
                                            "required": [
                                                "error"
                                            ],
                                            "properties": {
                                                "error": {
                                                    "description": "Localized access denial message.",
                                                    "type": "string"
                                                }
                                            },
                                            "type": "object"
                                        }
                                    ]
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "Contract not found or unavailable.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "required": [
                                        "status",
                                        "message"
                                    ],
                                    "properties": {
                                        "status": {
                                            "type": "string",
                                            "enum": [
                                                "error"
                                            ]
                                        },
                                        "message": {
                                            "type": "string",
                                            "example": "Contract not found or access denied",
                                            "enum": [
                                                "Contract not found or access denied"
                                            ]
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "Too many requests.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "required": [
                                        "status",
                                        "message"
                                    ],
                                    "properties": {
                                        "status": {
                                            "type": "string",
                                            "enum": [
                                                "error"
                                            ]
                                        },
                                        "message": {
                                            "description": "Localized rate limit message.",
                                            "type": "string"
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "sanctum": []
                    }
                ]
            }
        },
        "/api/agent/contracts/{id}/comment": {
            "post": {
                "tags": [
                    "Contract"
                ],
                "summary": "Add a contract comment",
                "description": "Adds a comment to a contract.",
                "operationId": "addContractComment",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "description": "Contract ID.",
                        "required": true,
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "required": [
                                    "comment"
                                ],
                                "properties": {
                                    "comment": {
                                        "type": "string",
                                        "minLength": 1
                                    }
                                },
                                "type": "object"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Add a contract comment.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "required": [
                                        "message",
                                        "contract"
                                    ],
                                    "properties": {
                                        "message": {
                                            "type": "string",
                                            "example": "Comment successfully added"
                                        },
                                        "contract": {
                                            "$ref": "#/components/schemas/ContractDetail"
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "400": {
                        "description": "Invalid request.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ContractValidationError"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Unauthenticated.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "required": [
                                        "message"
                                    ],
                                    "properties": {
                                        "message": {
                                            "type": "string",
                                            "example": "Unauthenticated."
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "Requires contracts:write. The contract or account may not allow this action.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "anyOf": [
                                        {
                                            "required": [
                                                "status",
                                                "message"
                                            ],
                                            "properties": {
                                                "status": {
                                                    "type": "string",
                                                    "enum": [
                                                        "error"
                                                    ]
                                                },
                                                "message": {
                                                    "type": "string",
                                                    "example": "You are not authorized for this operation (contracts:write)",
                                                    "enum": [
                                                        "You are not authorized for this operation (contracts:write)",
                                                        "You are not authorized for this operation"
                                                    ]
                                                }
                                            },
                                            "type": "object"
                                        },
                                        {
                                            "required": [
                                                "message"
                                            ],
                                            "properties": {
                                                "message": {
                                                    "type": "string",
                                                    "example": "Access denied from this IP address."
                                                }
                                            },
                                            "type": "object"
                                        },
                                        {
                                            "required": [
                                                "error"
                                            ],
                                            "properties": {
                                                "error": {
                                                    "description": "Localized access denial message.",
                                                    "type": "string"
                                                }
                                            },
                                            "type": "object"
                                        }
                                    ]
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "Contract not found or unavailable.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "required": [
                                        "status",
                                        "message"
                                    ],
                                    "properties": {
                                        "status": {
                                            "type": "string",
                                            "enum": [
                                                "error"
                                            ]
                                        },
                                        "message": {
                                            "type": "string",
                                            "example": "Contract not found",
                                            "enum": [
                                                "Contract not found"
                                            ]
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "Too many requests.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "required": [
                                        "status",
                                        "message"
                                    ],
                                    "properties": {
                                        "status": {
                                            "type": "string",
                                            "enum": [
                                                "error"
                                            ]
                                        },
                                        "message": {
                                            "description": "Localized rate limit message.",
                                            "type": "string"
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "sanctum": []
                    }
                ]
            }
        },
        "/api/agent/contracts/{id}/internal-status": {
            "post": {
                "tags": [
                    "Contract"
                ],
                "summary": "Set internal status",
                "description": "Sets a contract’s internal status label.",
                "operationId": "setInternalStatus",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "description": "Contract ID.",
                        "required": true,
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "required": [
                                    "internal_status"
                                ],
                                "properties": {
                                    "internal_status": {
                                        "description": "Internal status ID or name.",
                                        "anyOf": [
                                            {
                                                "type": "integer"
                                            },
                                            {
                                                "type": "string"
                                            }
                                        ]
                                    }
                                },
                                "type": "object"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Set internal status.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "required": [
                                        "message",
                                        "contract"
                                    ],
                                    "properties": {
                                        "message": {
                                            "type": "string",
                                            "example": "Internal status successfully set"
                                        },
                                        "contract": {
                                            "$ref": "#/components/schemas/ContractDetail"
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "400": {
                        "description": "Invalid request.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "anyOf": [
                                        {
                                            "$ref": "#/components/schemas/ContractValidationError"
                                        },
                                        {
                                            "required": [
                                                "status",
                                                "message"
                                            ],
                                            "properties": {
                                                "status": {
                                                    "type": "string",
                                                    "enum": [
                                                        "error"
                                                    ]
                                                },
                                                "message": {
                                                    "type": "string",
                                                    "example": "Invalid internal status",
                                                    "enum": [
                                                        "Invalid internal status"
                                                    ]
                                                }
                                            },
                                            "type": "object"
                                        }
                                    ]
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Unauthenticated.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "required": [
                                        "message"
                                    ],
                                    "properties": {
                                        "message": {
                                            "type": "string",
                                            "example": "Unauthenticated."
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "Requires contracts:write. The contract or account may not allow this action.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "anyOf": [
                                        {
                                            "required": [
                                                "status",
                                                "message"
                                            ],
                                            "properties": {
                                                "status": {
                                                    "type": "string",
                                                    "enum": [
                                                        "error"
                                                    ]
                                                },
                                                "message": {
                                                    "type": "string",
                                                    "example": "You are not authorized for this operation (contracts:write)",
                                                    "enum": [
                                                        "You are not authorized for this operation (contracts:write)",
                                                        "You are not authorized for this operation"
                                                    ]
                                                }
                                            },
                                            "type": "object"
                                        },
                                        {
                                            "required": [
                                                "message"
                                            ],
                                            "properties": {
                                                "message": {
                                                    "type": "string",
                                                    "example": "Access denied from this IP address."
                                                }
                                            },
                                            "type": "object"
                                        },
                                        {
                                            "required": [
                                                "error"
                                            ],
                                            "properties": {
                                                "error": {
                                                    "description": "Localized access denial message.",
                                                    "type": "string"
                                                }
                                            },
                                            "type": "object"
                                        }
                                    ]
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "Contract not found or unavailable.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "required": [
                                        "status",
                                        "message"
                                    ],
                                    "properties": {
                                        "status": {
                                            "type": "string",
                                            "enum": [
                                                "error"
                                            ]
                                        },
                                        "message": {
                                            "type": "string",
                                            "example": "Contract not found",
                                            "enum": [
                                                "Contract not found"
                                            ]
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "Too many requests.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "required": [
                                        "status",
                                        "message"
                                    ],
                                    "properties": {
                                        "status": {
                                            "type": "string",
                                            "enum": [
                                                "error"
                                            ]
                                        },
                                        "message": {
                                            "description": "Localized rate limit message.",
                                            "type": "string"
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "Could not save the changes.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "required": [
                                        "status",
                                        "message"
                                    ],
                                    "properties": {
                                        "status": {
                                            "type": "string",
                                            "enum": [
                                                "error"
                                            ]
                                        },
                                        "message": {
                                            "type": "string",
                                            "example": "Error on save",
                                            "enum": [
                                                "Error on save"
                                            ]
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "sanctum": []
                    }
                ]
            }
        },
        "/api/agent/contracts/{id}/sign": {
            "post": {
                "tags": [
                    "Contract"
                ],
                "summary": "Sign a contract",
                "description": "Signs a contract with your saved signature.",
                "operationId": "sign",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "description": "Contract ID.",
                        "required": true,
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Sign a contract.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "required": [
                                        "message",
                                        "contract"
                                    ],
                                    "properties": {
                                        "message": {
                                            "type": "string",
                                            "example": "Successfully signed!"
                                        },
                                        "contract": {
                                            "$ref": "#/components/schemas/ContractDetail"
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "400": {
                        "description": "Invalid request.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "required": [
                                        "status",
                                        "message"
                                    ],
                                    "properties": {
                                        "status": {
                                            "type": "string",
                                            "enum": [
                                                "error"
                                            ]
                                        },
                                        "message": {
                                            "type": "string",
                                            "example": "Fill all required fields!",
                                            "enum": [
                                                "Fill all required fields!",
                                                "This contract has been already signed!"
                                            ]
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Unauthenticated.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "required": [
                                        "message"
                                    ],
                                    "properties": {
                                        "message": {
                                            "type": "string",
                                            "example": "Unauthenticated."
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "Requires contracts:sign. The contract or account may not allow this action.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "anyOf": [
                                        {
                                            "required": [
                                                "status",
                                                "message"
                                            ],
                                            "properties": {
                                                "status": {
                                                    "type": "string",
                                                    "enum": [
                                                        "error"
                                                    ]
                                                },
                                                "message": {
                                                    "type": "string",
                                                    "example": "You are not authorized for this operation (contracts:sign)",
                                                    "enum": [
                                                        "You are not authorized for this operation (contracts:sign)",
                                                        "You are not authorized to perform this action!",
                                                        "To sign this contract you need an eSzemelyi profile",
                                                        "To sign this contract SMS confirm is needed",
                                                        "Email address is not valid or verified.",
                                                        "Only companies can sign this contract.",
                                                        "Only private individuals can sign this contract.",
                                                        "You do not have a signature set.",
                                                        "User is not a partner in this contract or permission denied.",
                                                        "Permission denied, user not verified, or email invalid."
                                                    ]
                                                }
                                            },
                                            "type": "object"
                                        },
                                        {
                                            "required": [
                                                "message"
                                            ],
                                            "properties": {
                                                "message": {
                                                    "type": "string",
                                                    "example": "Access denied from this IP address."
                                                }
                                            },
                                            "type": "object"
                                        },
                                        {
                                            "required": [
                                                "error"
                                            ],
                                            "properties": {
                                                "error": {
                                                    "description": "Localized access denial message.",
                                                    "type": "string"
                                                }
                                            },
                                            "type": "object"
                                        }
                                    ]
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "Contract not found or unavailable.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "required": [
                                        "status",
                                        "message"
                                    ],
                                    "properties": {
                                        "status": {
                                            "type": "string",
                                            "enum": [
                                                "error"
                                            ]
                                        },
                                        "message": {
                                            "type": "string",
                                            "example": "Contract not found!",
                                            "enum": [
                                                "Contract not found!"
                                            ]
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "Too many requests.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "required": [
                                        "status",
                                        "message"
                                    ],
                                    "properties": {
                                        "status": {
                                            "type": "string",
                                            "enum": [
                                                "error"
                                            ]
                                        },
                                        "message": {
                                            "description": "Localized rate limit message.",
                                            "type": "string"
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "sanctum": []
                    }
                ]
            }
        },
        "/api/agent/contracts/{id}/resend": {
            "post": {
                "tags": [
                    "Contract"
                ],
                "summary": "Resend contract invitations",
                "description": "Resends pending contract invitations.",
                "operationId": "resend",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "description": "Contract ID.",
                        "required": true,
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "requestBody": {
                    "required": false,
                    "content": {
                        "application/json": {
                            "schema": {
                                "properties": {
                                    "which_receiver": {
                                        "description": "Optional receiver number, starting at 1. If no receiver matches, resends all pending invitations.",
                                        "type": "integer",
                                        "nullable": true
                                    }
                                },
                                "type": "object"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Resend contract invitations.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "required": [
                                        "message",
                                        "contract"
                                    ],
                                    "properties": {
                                        "message": {
                                            "type": "string",
                                            "example": "Successfully resend!"
                                        },
                                        "contract": {
                                            "$ref": "#/components/schemas/ContractDetail"
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "400": {
                        "description": "Invalid request.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "anyOf": [
                                        {
                                            "$ref": "#/components/schemas/ContractValidationError"
                                        },
                                        {
                                            "required": [
                                                "status",
                                                "message"
                                            ],
                                            "properties": {
                                                "status": {
                                                    "type": "string",
                                                    "enum": [
                                                        "error"
                                                    ]
                                                },
                                                "message": {
                                                    "type": "string",
                                                    "example": "For this contract, all partners accepted or rejected the contract!",
                                                    "enum": [
                                                        "For this contract, all partners accepted or rejected the contract!"
                                                    ]
                                                }
                                            },
                                            "type": "object"
                                        }
                                    ]
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Unauthenticated.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "required": [
                                        "message"
                                    ],
                                    "properties": {
                                        "message": {
                                            "type": "string",
                                            "example": "Unauthenticated."
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "Requires contracts:write. The contract or account may not allow this action.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "anyOf": [
                                        {
                                            "required": [
                                                "status",
                                                "message"
                                            ],
                                            "properties": {
                                                "status": {
                                                    "type": "string",
                                                    "enum": [
                                                        "error"
                                                    ]
                                                },
                                                "message": {
                                                    "type": "string",
                                                    "example": "You are not authorized for this operation (contracts:write)",
                                                    "enum": [
                                                        "You are not authorized for this operation (contracts:write)",
                                                        "You are not authorized to perform this action!"
                                                    ]
                                                }
                                            },
                                            "type": "object"
                                        },
                                        {
                                            "required": [
                                                "message"
                                            ],
                                            "properties": {
                                                "message": {
                                                    "type": "string",
                                                    "example": "Access denied from this IP address."
                                                }
                                            },
                                            "type": "object"
                                        },
                                        {
                                            "required": [
                                                "error"
                                            ],
                                            "properties": {
                                                "error": {
                                                    "description": "Localized access denial message.",
                                                    "type": "string"
                                                }
                                            },
                                            "type": "object"
                                        }
                                    ]
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "Contract not found or unavailable.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "required": [
                                        "status",
                                        "message"
                                    ],
                                    "properties": {
                                        "status": {
                                            "type": "string",
                                            "enum": [
                                                "error"
                                            ]
                                        },
                                        "message": {
                                            "type": "string",
                                            "example": "Contract not found!",
                                            "enum": [
                                                "Contract not found!"
                                            ]
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "Too many requests.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "required": [
                                        "status",
                                        "message"
                                    ],
                                    "properties": {
                                        "status": {
                                            "type": "string",
                                            "enum": [
                                                "error"
                                            ]
                                        },
                                        "message": {
                                            "description": "Localized rate limit message.",
                                            "type": "string"
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "sanctum": []
                    }
                ]
            }
        },
        "/api/agent/contracts/{id}/attachment": {
            "post": {
                "tags": [
                    "Contract"
                ],
                "summary": "Add attachment to contract",
                "description": "Adds an invoice, hyperlink, or connected contract to the contract. Matches logic of attachment_add_en. Requires 'contracts:write' ability.",
                "operationId": "addAttachment",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "description": "Contract ID",
                        "required": true,
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "required": [
                                    "attachment_type"
                                ],
                                "properties": {
                                    "attachment_type": {
                                        "description": "Type of attachment",
                                        "type": "string",
                                        "enum": [
                                            "invoice",
                                            "link",
                                            "contract"
                                        ]
                                    },
                                    "attachment_invoice_number": {
                                        "description": "Required if type is invoice",
                                        "type": "string"
                                    },
                                    "attachment_contract_identifier": {
                                        "description": "Required if type is contract (the ID of the other contract)",
                                        "type": "integer"
                                    },
                                    "attachment_contract_visibility": {
                                        "description": "Visibility for connected contract",
                                        "type": "string",
                                        "enum": [
                                            "public",
                                            "private"
                                        ]
                                    },
                                    "link": {
                                        "description": "Required if type is link",
                                        "properties": {
                                            "type": {
                                                "description": "Type of link",
                                                "type": "string"
                                            },
                                            "title": {
                                                "description": "Title of link",
                                                "type": "string"
                                            },
                                            "hyperlink": {
                                                "description": "URL",
                                                "type": "string"
                                            },
                                            "visibility": {
                                                "type": "string",
                                                "enum": [
                                                    "public",
                                                    "private"
                                                ]
                                            },
                                            "description": {
                                                "type": "string"
                                            }
                                        },
                                        "type": "object"
                                    }
                                },
                                "type": "object"
                            },
                            "examples": {
                                "invoice": {
                                    "summary": "Add Invoice",
                                    "value": {
                                        "attachment_type": "invoice",
                                        "attachment_invoice_number": "ABC-2023-001"
                                    }
                                },
                                "link": {
                                    "summary": "Add Link",
                                    "value": {
                                        "attachment_type": "link",
                                        "link": {
                                            "type": "Google Doc",
                                            "title": "Spec",
                                            "hyperlink": "https://docs.google.com/...",
                                            "visibility": "public",
                                            "description": "Specification"
                                        }
                                    }
                                },
                                "contract": {
                                    "summary": "Add Connected Contract",
                                    "value": {
                                        "attachment_type": "contract",
                                        "attachment_contract_identifier": 12345,
                                        "attachment_contract_visibility": "private"
                                    }
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Attachment added successfully",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "required": [
                                        "message",
                                        "contract"
                                    ],
                                    "properties": {
                                        "message": {
                                            "type": "string"
                                        },
                                        "contract": {
                                            "$ref": "#/components/schemas/ContractDetail"
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "400": {
                        "description": "Bad Request",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "status": {
                                            "type": "string",
                                            "example": "error"
                                        },
                                        "message": {
                                            "type": "string",
                                            "example": "Validation Error"
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "Forbidden",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "status": {
                                            "type": "string",
                                            "example": "error"
                                        },
                                        "message": {
                                            "type": "string",
                                            "example": "You are not authorized for this operation (contracts:write)"
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "sanctum": [
                            "contracts:write"
                        ]
                    }
                ]
            },
            "delete": {
                "tags": [
                    "Contract"
                ],
                "summary": "Remove attachment from contract",
                "description": "Removes an invoice, hyperlink, or connected contract from the contract. Matches logic of attachment_remove_en. Requires 'contracts:write' ability.",
                "operationId": "removeAttachment",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "description": "Contract ID",
                        "required": true,
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "required": [
                                    "attachment_type",
                                    "attachment_identifier"
                                ],
                                "properties": {
                                    "attachment_type": {
                                        "description": "Type of attachment",
                                        "type": "string",
                                        "enum": [
                                            "invoice",
                                            "link",
                                            "contract"
                                        ]
                                    },
                                    "attachment_identifier": {
                                        "description": "ID of the attachment record to remove",
                                        "type": "integer"
                                    }
                                },
                                "type": "object"
                            },
                            "examples": {
                                "invoice": {
                                    "summary": "Remove Invoice Attachment",
                                    "value": {
                                        "attachment_type": "invoice",
                                        "attachment_identifier": 10
                                    }
                                },
                                "link": {
                                    "summary": "Remove Link Attachment",
                                    "value": {
                                        "attachment_type": "link",
                                        "attachment_identifier": 5
                                    }
                                },
                                "contract": {
                                    "summary": "Remove Connected Contract",
                                    "value": {
                                        "attachment_type": "contract",
                                        "attachment_identifier": 3
                                    }
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Attachment removed successfully",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "required": [
                                        "message",
                                        "contract"
                                    ],
                                    "properties": {
                                        "message": {
                                            "type": "string"
                                        },
                                        "contract": {
                                            "$ref": "#/components/schemas/ContractDetail"
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "400": {
                        "description": "Bad Request",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "status": {
                                            "type": "string",
                                            "example": "error"
                                        },
                                        "message": {
                                            "type": "string",
                                            "example": "Validation Error"
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "Forbidden",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "status": {
                                            "type": "string",
                                            "example": "error"
                                        },
                                        "message": {
                                            "type": "string",
                                            "example": "You are not authorized for this operation (contracts:write)"
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "sanctum": [
                            "contracts:write"
                        ]
                    }
                ]
            }
        },
        "/api/agent/contracts/{id}/signature": {
            "delete": {
                "tags": [
                    "Contract"
                ],
                "summary": "Remove signature from contract",
                "description": "Removes the authenticated user's signature from the contract, if not yet finalized. Requires 'contracts:write' ability.",
                "operationId": "removeSignature",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "description": "Contract ID",
                        "required": true,
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Signature removed successfully",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "required": [
                                        "message",
                                        "contract"
                                    ],
                                    "properties": {
                                        "message": {
                                            "type": "string"
                                        },
                                        "contract": {
                                            "$ref": "#/components/schemas/ContractDetail"
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "400": {
                        "description": "Bad Request",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "status": {
                                            "type": "string",
                                            "example": "error"
                                        },
                                        "message": {
                                            "type": "string",
                                            "example": "Contract is already finalized or other error"
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "Forbidden",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "status": {
                                            "type": "string",
                                            "example": "error"
                                        },
                                        "message": {
                                            "type": "string",
                                            "example": "You are not authorized for this operation (contracts:write)"
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "Not Found",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "status": {
                                            "type": "string",
                                            "example": "error"
                                        },
                                        "message": {
                                            "type": "string",
                                            "example": "Contract not found"
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "sanctum": [
                            "contracts:write"
                        ]
                    }
                ]
            }
        },
        "/api/agent/contracts/{id}/cancel-invitation": {
            "post": {
                "tags": [
                    "Contract"
                ],
                "summary": "Cancel invitation",
                "description": "Cancels an active invitation for the contract. Requires 'contracts:write' ability.",
                "operationId": "cancelInvitation",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "description": "Contract ID",
                        "required": true,
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "required": [
                                    "email"
                                ],
                                "properties": {
                                    "email": {
                                        "description": "Email address of the invitee to cancel",
                                        "type": "string"
                                    }
                                },
                                "type": "object"
                            },
                            "examples": {
                                "default": {
                                    "summary": "Cancel invite for email",
                                    "value": {
                                        "email": "partner@example.com"
                                    }
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Invitation cancelled successfully",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "required": [
                                        "message",
                                        "contract"
                                    ],
                                    "properties": {
                                        "message": {
                                            "type": "string"
                                        },
                                        "contract": {
                                            "$ref": "#/components/schemas/ContractDetail"
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "400": {
                        "description": "Bad Request",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "status": {
                                            "type": "string",
                                            "example": "error"
                                        },
                                        "message": {
                                            "type": "string",
                                            "example": "Validation Error or Invitation not found"
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "Forbidden",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "status": {
                                            "type": "string",
                                            "example": "error"
                                        },
                                        "message": {
                                            "type": "string",
                                            "example": "You are not authorized for this operation (contracts:write)"
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "Not Found",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "status": {
                                            "type": "string",
                                            "example": "error"
                                        },
                                        "message": {
                                            "type": "string",
                                            "example": "Contract not found"
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "sanctum": [
                            "contracts:write"
                        ]
                    }
                ]
            }
        },
        "/api/agent/contracts/{id}/invitations": {
            "post": {
                "tags": [
                    "Contract"
                ],
                "summary": "Send contract invitation",
                "description": "Invites a new partner to the contract via email at a specific position. Optionally, partner details can be pre-filled. Requires 'contracts:write' ability.",
                "operationId": "sendInvitation",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "description": "Contract ID",
                        "required": true,
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "required": [
                                    "email",
                                    "position"
                                ],
                                "properties": {
                                    "email": {
                                        "description": "Email address of the new partner",
                                        "type": "string"
                                    },
                                    "position": {
                                        "description": "Position of the partner (e.g. 2 for 2nd party, 3 for 3rd party)",
                                        "type": "integer"
                                    },
                                    "partner_details": {
                                        "description": "Optional partner details (see example)",
                                        "properties": {
                                            "partner_type": {
                                                "description": "1: Individual, 2: Business",
                                                "type": "integer"
                                            },
                                            "signatory_name": {
                                                "type": "string"
                                            },
                                            "phone_number": {
                                                "type": "string"
                                            },
                                            "address": {
                                                "type": "string"
                                            },
                                            "mothers_name": {
                                                "type": "string"
                                            },
                                            "birthday": {
                                                "description": "YYYY-MM-DD",
                                                "type": "string"
                                            },
                                            "place_of_birth": {
                                                "type": "string"
                                            },
                                            "company_name": {
                                                "type": "string"
                                            },
                                            "company_tax_number": {
                                                "type": "string"
                                            },
                                            "company_registered_office": {
                                                "type": "string"
                                            }
                                        },
                                        "type": "object"
                                    }
                                },
                                "type": "object"
                            },
                            "examples": {
                                "default": {
                                    "summary": "Invite 2nd party (Simple)",
                                    "value": {
                                        "email": "new.partner@example.com",
                                        "position": 2
                                    }
                                },
                                "individual_details": {
                                    "summary": "Invite Individual with Details",
                                    "value": {
                                        "email": "detailed.partner@example.com",
                                        "position": 2,
                                        "partner_details": {
                                            "partner_type": 1,
                                            "signatory_name": "John Doe",
                                            "phone_number": "+36301234567",
                                            "address": "1234 Budapest, Main st 1",
                                            "mothers_name": "Unkown Jane",
                                            "birthday": "1980-01-01",
                                            "place_of_birth": "Budapest"
                                        }
                                    }
                                },
                                "business_details": {
                                    "summary": "Invite Business with Details",
                                    "value": {
                                        "email": "business.partner@example.com",
                                        "position": 2,
                                        "partner_details": {
                                            "partner_type": 2,
                                            "company_name": "Example Ltd.",
                                            "company_tax_number": "12345678-1-42",
                                            "company_registered_office": "1234 Budapest, Business Road 10",
                                            "signatory_name": "Jane CEO"
                                        }
                                    }
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Invitation sent successfully",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "required": [
                                        "message",
                                        "contract"
                                    ],
                                    "properties": {
                                        "message": {
                                            "type": "string"
                                        },
                                        "contract": {
                                            "$ref": "#/components/schemas/ContractDetail"
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "400": {
                        "description": "Bad Request",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "status": {
                                            "type": "string",
                                            "example": "error"
                                        },
                                        "message": {
                                            "type": "string",
                                            "example": "Contract is full or invalid data"
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "Forbidden",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "status": {
                                            "type": "string",
                                            "example": "error"
                                        },
                                        "message": {
                                            "type": "string",
                                            "example": "You are not authorized for this operation (contracts:write)"
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "Not Found",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "status": {
                                            "type": "string",
                                            "example": "error"
                                        },
                                        "message": {
                                            "type": "string",
                                            "example": "Contract not found"
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "sanctum": [
                            "contracts:write"
                        ]
                    }
                ]
            }
        },
        "/api/agent/contracts/pdf": {
            "post": {
                "tags": [
                    "Contract"
                ],
                "summary": "Create new contract from PDF (remote URL)",
                "description": "Create a new contract by downloading a PDF from a remote URL. Supports unified partners array.",
                "operationId": "createContractPdf",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "required": [
                                    "title",
                                    "pdf_url",
                                    "partners",
                                    "is_one_sided",
                                    "language",
                                    "hide_service_provider_details",
                                    "need_validation"
                                ],
                                "properties": {
                                    "title": {
                                        "description": "Title (Subject) of the contract",
                                        "type": "string"
                                    },
                                    "client_title": {
                                        "description": "Override Client title (Sender)",
                                        "type": "string"
                                    },
                                    "trustee_title": {
                                        "description": "Override Trustee title (Receiver)",
                                        "type": "string"
                                    },
                                    "own_id": {
                                        "description": "Optional internal ID (must be unique per user)",
                                        "type": "string"
                                    },
                                    "allowed_user_type": {
                                        "description": "Restriction for signer type: 0=Any, 1=Company Only, 2=Private Individual Only",
                                        "type": "integer",
                                        "enum": [
                                            0,
                                            1,
                                            2
                                        ]
                                    },
                                    "has_expiration_date": {
                                        "description": "Whether the contract has an expiration date",
                                        "type": "boolean"
                                    },
                                    "expiration_date": {
                                        "description": "Expiration ID (YYYY-MM-DD), required if has_expiration_date is true",
                                        "type": "string",
                                        "format": "date"
                                    },
                                    "expiration_date_title": {
                                        "description": "Label for the expiration date",
                                        "type": "string"
                                    },
                                    "intro_disabled": {
                                        "description": "If true, the intro section is disabled",
                                        "type": "boolean"
                                    },
                                    "accompanying_message": {
                                        "description": "Custom email message to accompany the invitation",
                                        "type": "string"
                                    },
                                    "sign_now": {
                                        "description": "If true, attempts to sign the contract immediately",
                                        "type": "boolean"
                                    },
                                    "copy_to_email": {
                                        "description": "Optional comma-separated email addresses (max 5) to receive a copy of the contract",
                                        "type": "string"
                                    },
                                    "contract_public_url": {
                                        "type": "boolean",
                                        "example": false
                                    },
                                    "callback_url": {
                                        "description": "Optional callback URL for contract events",
                                        "type": "string"
                                    },
                                    "redirect_url": {
                                        "description": "Optional redirect URL for user after signing",
                                        "type": "string"
                                    },
                                    "pdf_url": {
                                        "description": "Remote URL of the PDF to download",
                                        "type": "string"
                                    },
                                    "pdf_base64": {
                                        "description": "Base64 encoded PDF content",
                                        "type": "string"
                                    },
                                    "is_one_sided": {
                                        "description": "If true, sets single_signature=1",
                                        "type": "boolean"
                                    },
                                    "language": {
                                        "description": "Language of the contract (default: hu)",
                                        "type": "string"
                                    },
                                    "hide_service_provider_details": {
                                        "description": "Hide service provider details section",
                                        "type": "boolean"
                                    },
                                    "need_validation": {
                                        "description": "Validation level: 0=Basic (Email), 1=Phone (+1 timestamp), 2=eID, 3=Video KYC (Didit)",
                                        "type": "integer"
                                    },
                                    "signer_count": {
                                        "description": "Number of signers (e.g. 2, 3...)",
                                        "type": "integer"
                                    },
                                    "partners": {
                                        "description": "List of partners (Pos 2+).",
                                        "type": "array",
                                        "items": {
                                            "properties": {
                                                "position": {
                                                    "type": "integer"
                                                },
                                                "email": {
                                                    "type": "string"
                                                },
                                                "title": {
                                                    "description": "Specific title for this partner (e.g. 'Witness 1')",
                                                    "type": "string"
                                                },
                                                "partner_details": {
                                                    "type": "object"
                                                }
                                            },
                                            "type": "object"
                                        }
                                    }
                                },
                                "type": "object"
                            },
                            "examples": {
                                "create_pdf_simple": {
                                    "summary": "Create from PDF - Simple Invite",
                                    "value": {
                                        "title": "Simple PDF Contract",
                                        "own_id": "MY-PDF-123",
                                        "client_title": "Sender (Client)",
                                        "trustee_title": "Receiver (Trustee)",
                                        "has_expiration_date": true,
                                        "expiration_date": "2025-12-31",
                                        "allowed_user_type": 1,
                                        "expiration_date_title": "Valid until",
                                        "intro_disabled": true,
                                        "accompanying_message": "Please sign this.",
                                        "sign_now": true,
                                        "callback_url": "https://site.com/callback",
                                        "redirect_url": "https://site.com/redirect",
                                        "copy_to_email": "copy@example.com",
                                        "contract_public_url": false,
                                        "pdf_url": "https://example.com/contract.pdf",
                                        "is_one_sided": 0,
                                        "language": "hu",
                                        "hide_service_provider_details": false,
                                        "need_validation": 0,
                                        "partners": [
                                            {
                                                "position": 2,
                                                "email": "partner@example.com",
                                                "title": "Partner (Witness 1)"
                                            }
                                        ]
                                    }
                                },
                                "create_pdf_simple_base64": {
                                    "summary": "Create from PDF (Base64) - Simple Invite",
                                    "value": {
                                        "title": "Simple PDF Contract Base64",
                                        "own_id": "MY-PDF-123-B64",
                                        "client_title": "Sender (Client)",
                                        "trustee_title": "Receiver (Trustee)",
                                        "has_expiration_date": true,
                                        "expiration_date": "2025-12-31",
                                        "allowed_user_type": 1,
                                        "expiration_date_title": "Valid until",
                                        "intro_disabled": true,
                                        "accompanying_message": "Please sign this.",
                                        "sign_now": true,
                                        "callback_url": "https://site.com/callback",
                                        "redirect_url": "https://site.com/redirect",
                                        "copy_to_email": "copy@example.com",
                                        "contract_public_url": false,
                                        "pdf_base64": "JVBERi0xLjQKJc...",
                                        "is_one_sided": 0,
                                        "language": "hu",
                                        "hide_service_provider_details": false,
                                        "need_validation": 0,
                                        "partners": [
                                            {
                                                "position": 2,
                                                "email": "partner@example.com",
                                                "title": "Partner (Witness 1)"
                                            }
                                        ]
                                    }
                                },
                                "create_pdf_multiparty": {
                                    "summary": "Create from PDF - Multiparty",
                                    "value": {
                                        "title": "Multiparty PDF Contract",
                                        "sign_now": true,
                                        "callback_url": "https://site.com/callback",
                                        "redirect_url": "https://site.com/redirect",
                                        "pdf_url": "https://example.com/multi.pdf",
                                        "is_one_sided": 0,
                                        "language": "hu",
                                        "hide_service_provider_details": false,
                                        "need_validation": 0,
                                        "allowed_user_type": 1,
                                        "signer_count": 4,
                                        "partners": [
                                            {
                                                "position": 2,
                                                "email": "pos2@example.com"
                                            },
                                            {
                                                "position": 3,
                                                "email": "pos3@example.com"
                                            },
                                            {
                                                "position": 4,
                                                "email": "pos4@example.com",
                                                "partner_details": {
                                                    "partner_type": 1,
                                                    "signatory_name": "Pos4 Name",
                                                    "phone_number": "+36301234567",
                                                    "address": "1234 City, Street 1",
                                                    "mothers_name": "Mother Name",
                                                    "birthday": "1980-01-01",
                                                    "place_of_birth": "City"
                                                }
                                            }
                                        ]
                                    }
                                },
                                "create_pdf_multiparty_base64": {
                                    "summary": "Create from PDF (Base64) - Multiparty",
                                    "value": {
                                        "title": "Multiparty PDF Contract Base64",
                                        "sign_now": true,
                                        "callback_url": "https://site.com/callback",
                                        "redirect_url": "https://site.com/redirect",
                                        "pdf_base64": "JVBERi0xLjQKJc...",
                                        "is_one_sided": 0,
                                        "language": "hu",
                                        "hide_service_provider_details": false,
                                        "need_validation": 0,
                                        "allowed_user_type": 1,
                                        "signer_count": 4,
                                        "partners": [
                                            {
                                                "position": 2,
                                                "email": "pos2@example.com"
                                            },
                                            {
                                                "position": 3,
                                                "email": "pos3@example.com"
                                            },
                                            {
                                                "position": 4,
                                                "email": "pos4@example.com",
                                                "partner_details": {
                                                    "partner_type": 1,
                                                    "signatory_name": "Pos4 Name",
                                                    "phone_number": "+36301234567",
                                                    "address": "1234 City, Street 1",
                                                    "mothers_name": "Mother Name",
                                                    "birthday": "1980-01-01",
                                                    "place_of_birth": "City"
                                                }
                                            }
                                        ]
                                    }
                                },
                                "create_pdf_unilateral": {
                                    "summary": "Create from PDF - Unilateral Declaration",
                                    "value": {
                                        "title": "Unilateral PDF Declaration",
                                        "own_id": "MY-UNI-001",
                                        "client_title": "Declarant",
                                        "has_expiration_date": false,
                                        "sign_now": true,
                                        "callback_url": "https://site.com/callback",
                                        "redirect_url": "https://site.com/redirect",
                                        "pdf_url": "https://example.com/declaration.pdf",
                                        "is_one_sided": 1,
                                        "language": "hu",
                                        "hide_service_provider_details": false,
                                        "need_validation": 0,
                                        "partners": []
                                    }
                                },
                                "create_pdf_unilateral_base64": {
                                    "summary": "Create from PDF (Base64) - Unilateral Declaration",
                                    "value": {
                                        "title": "Unilateral PDF Declaration Base64",
                                        "own_id": "MY-UNI-001-B64",
                                        "client_title": "Declarant",
                                        "has_expiration_date": false,
                                        "sign_now": true,
                                        "callback_url": "https://site.com/callback",
                                        "redirect_url": "https://site.com/redirect",
                                        "pdf_base64": "JVBERi0xLjQKJc...",
                                        "is_one_sided": 1,
                                        "language": "hu",
                                        "hide_service_provider_details": false,
                                        "need_validation": 0,
                                        "partners": []
                                    }
                                },
                                "create_pdf_mixed": {
                                    "summary": "Create from PDF - Mixed Partners",
                                    "value": {
                                        "title": "Mixed Partners PDF",
                                        "sign_now": true,
                                        "callback_url": "https://site.com/callback",
                                        "redirect_url": "https://site.com/redirect",
                                        "pdf_url": "https://example.com/mixed.pdf",
                                        "is_one_sided": 0,
                                        "language": "hu",
                                        "hide_service_provider_details": false,
                                        "need_validation": 0,
                                        "allowed_user_type": 1,
                                        "partners": [
                                            {
                                                "position": 2,
                                                "email": "ceo@example.com",
                                                "partner_details": {
                                                    "partner_type": 2,
                                                    "company_name": "Example Ltd.",
                                                    "company_tax_number": "12345678-1-42",
                                                    "company_registered_office": "1234 City, Street 1",
                                                    "signatory_name": "John CEO"
                                                }
                                            },
                                            {
                                                "position": 3,
                                                "email": "private@example.com",
                                                "partner_details": {
                                                    "partner_type": 1,
                                                    "signatory_name": "Jane Private",
                                                    "phone_number": "+36301234567",
                                                    "address": "5678 Town, Road 2",
                                                    "mothers_name": "Mother Name",
                                                    "birthday": "1980-01-01",
                                                    "place_of_birth": "City"
                                                }
                                            }
                                        ]
                                    }
                                },
                                "create_pdf_mixed_base64": {
                                    "summary": "Create from PDF (Base64) - Mixed Partners",
                                    "value": {
                                        "title": "Mixed Partners PDF Base64",
                                        "sign_now": true,
                                        "callback_url": "https://site.com/callback",
                                        "redirect_url": "https://site.com/redirect",
                                        "pdf_base64": "JVBERi0xLjQKJc...",
                                        "is_one_sided": 0,
                                        "language": "hu",
                                        "hide_service_provider_details": false,
                                        "need_validation": 0,
                                        "allowed_user_type": 1,
                                        "partners": [
                                            {
                                                "position": 2,
                                                "email": "ceo@example.com",
                                                "partner_details": {
                                                    "partner_type": 2,
                                                    "company_name": "Example Ltd.",
                                                    "company_tax_number": "12345678-1-42",
                                                    "company_registered_office": "1234 City, Street 1",
                                                    "signatory_name": "John CEO"
                                                }
                                            },
                                            {
                                                "position": 3,
                                                "email": "private@example.com",
                                                "partner_details": {
                                                    "partner_type": 1,
                                                    "signatory_name": "Jane Private",
                                                    "phone_number": "+36301234567",
                                                    "address": "5678 Town, Road 2",
                                                    "mothers_name": "Mother Name",
                                                    "birthday": "1980-01-01",
                                                    "place_of_birth": "City"
                                                }
                                            }
                                        ]
                                    }
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Contract created successfully",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "required": [
                                        "message",
                                        "contract"
                                    ],
                                    "properties": {
                                        "message": {
                                            "type": "string"
                                        },
                                        "contract": {
                                            "$ref": "#/components/schemas/ContractDetail"
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "400": {
                        "description": "Bad Request"
                    },
                    "403": {
                        "description": "Forbidden",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "status": {
                                            "type": "string",
                                            "example": "error"
                                        },
                                        "message": {
                                            "type": "string",
                                            "example": "You are not authorized for this operation (contracts:write)"
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "sanctum": []
                    }
                ]
            }
        },
        "/api/agent/contracts/html": {
            "post": {
                "tags": [
                    "Contract"
                ],
                "summary": "Create a new contract from HTML content",
                "description": "Creates a new contract based on provided HTML content. The HTML is converted to PDF.",
                "operationId": "storeHtml",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "required": [
                                    "title",
                                    "html_content",
                                    "partners",
                                    "is_one_sided",
                                    "language",
                                    "hide_service_provider_details",
                                    "need_validation"
                                ],
                                "properties": {
                                    "title": {
                                        "description": "Title (Subject) of the contract",
                                        "type": "string"
                                    },
                                    "client_title": {
                                        "description": "Override Client title (Sender)",
                                        "type": "string"
                                    },
                                    "trustee_title": {
                                        "description": "Override Trustee title (Receiver)",
                                        "type": "string"
                                    },
                                    "own_id": {
                                        "description": "Optional internal ID (must be unique per user)",
                                        "type": "string"
                                    },
                                    "allowed_user_type": {
                                        "description": "Restriction for signer type: 0=Any, 1=Company Only, 2=Private Individual Only",
                                        "type": "integer",
                                        "enum": [
                                            0,
                                            1,
                                            2
                                        ]
                                    },
                                    "has_expiration_date": {
                                        "description": "Whether the contract has an expiration date",
                                        "type": "boolean"
                                    },
                                    "expiration_date": {
                                        "description": "Expiration ID (YYYY-MM-DD), required if has_expiration_date is true",
                                        "type": "string",
                                        "format": "date"
                                    },
                                    "expiration_date_title": {
                                        "description": "Label for the expiration date",
                                        "type": "string"
                                    },
                                    "intro_disabled": {
                                        "description": "If true, the intro section is disabled",
                                        "type": "boolean"
                                    },
                                    "accompanying_message": {
                                        "description": "Custom email message to accompany the invitation",
                                        "type": "string"
                                    },
                                    "sign_now": {
                                        "description": "If true, attempts to sign the contract immediately with the current user's signature",
                                        "type": "boolean"
                                    },
                                    "callback_url": {
                                        "description": "Optional callback URL for contract events",
                                        "type": "string"
                                    },
                                    "redirect_url": {
                                        "description": "Optional redirect URL for user after signing",
                                        "type": "string"
                                    },
                                    "copy_to_email": {
                                        "description": "Optional comma-separated email addresses (max 5) to receive a copy of the contract",
                                        "type": "string"
                                    },
                                    "contract_public_url": {
                                        "type": "boolean",
                                        "example": false
                                    },
                                    "html_content": {
                                        "description": "HTML content of the contract",
                                        "type": "string"
                                    },
                                    "is_one_sided": {
                                        "description": "If 1, sets single_signature=1",
                                        "type": "integer"
                                    },
                                    "language": {
                                        "description": "Language of the contract (default: hu)",
                                        "type": "string"
                                    },
                                    "hide_service_provider_details": {
                                        "description": "Hide service provider details section",
                                        "type": "boolean"
                                    },
                                    "need_validation": {
                                        "description": "Validation level: 0=Basic (Email), 1=Phone (+1 timestamp), 2=eID, 3=Video KYC (Didit)",
                                        "type": "integer"
                                    },
                                    "signer_count": {
                                        "description": "Number of signers (e.g. 2, 3...)",
                                        "type": "integer"
                                    },
                                    "partners": {
                                        "description": "List of partners (Pos 2+).",
                                        "type": "array",
                                        "items": {
                                            "properties": {
                                                "position": {
                                                    "type": "integer"
                                                },
                                                "email": {
                                                    "type": "string"
                                                },
                                                "title": {
                                                    "description": "Specific title for this partner (e.g. 'Witness 1')",
                                                    "type": "string"
                                                },
                                                "partner_details": {
                                                    "type": "object"
                                                }
                                            },
                                            "type": "object"
                                        }
                                    }
                                },
                                "type": "object"
                            },
                            "examples": {
                                "create_html_simple": {
                                    "summary": "Create from HTML - Simple Invite",
                                    "value": {
                                        "title": "Simple HTML Contract",
                                        "own_id": "MY-HTML-123",
                                        "client_title": "Sender (Client)",
                                        "trustee_title": "Receiver (Trustee)",
                                        "has_expiration_date": true,
                                        "expiration_date": "2025-12-31",
                                        "allowed_user_type": 2,
                                        "expiration_date_title": "Valid until",
                                        "intro_disabled": true,
                                        "accompanying_message": "Please sign this.",
                                        "sign_now": true,
                                        "callback_url": "https://site.com/callback",
                                        "redirect_url": "https://site.com/redirect",
                                        "copy_to_email": "copy@example.com",
                                        "contract_public_url": false,
                                        "html_content": "<h1>Contract</h1><p>This is a contract.</p>",
                                        "is_one_sided": 0,
                                        "language": "hu",
                                        "hide_service_provider_details": false,
                                        "need_validation": 0,
                                        "partners": [
                                            {
                                                "position": 2,
                                                "email": "partner@example.com",
                                                "title": "Partner (Witness 1)"
                                            }
                                        ]
                                    }
                                },
                                "create_html_multiparty": {
                                    "summary": "Create from HTML - Multiparty",
                                    "value": {
                                        "title": "Multiparty HTML Contract",
                                        "sign_now": true,
                                        "callback_url": "https://site.com/callback",
                                        "redirect_url": "https://site.com/redirect",
                                        "html_content": "<h1>Multiparty Contract</h1><p>Parties agree...</p>",
                                        "is_one_sided": 0,
                                        "language": "hu",
                                        "hide_service_provider_details": false,
                                        "need_validation": 0,
                                        "allowed_user_type": 2,
                                        "signer_count": 4,
                                        "partners": [
                                            {
                                                "position": 2,
                                                "email": "pos2@example.com"
                                            },
                                            {
                                                "position": 3,
                                                "email": "pos3@example.com"
                                            },
                                            {
                                                "position": 4,
                                                "email": "pos4@example.com",
                                                "partner_details": {
                                                    "partner_type": 1,
                                                    "signatory_name": "Pos4 Name",
                                                    "phone_number": "+36301234567",
                                                    "address": "1234 City, Street 1",
                                                    "mothers_name": "Mother Name",
                                                    "birthday": "1980-01-01",
                                                    "place_of_birth": "City"
                                                }
                                            }
                                        ]
                                    }
                                },
                                "create_html_mixed": {
                                    "summary": "Create from HTML - Mixed Partners",
                                    "value": {
                                        "title": "Mixed Partners HTML Contract",
                                        "sign_now": true,
                                        "callback_url": "https://site.com/callback",
                                        "redirect_url": "https://site.com/redirect",
                                        "html_content": "<h1>Mixed Contract</h1><p>Parties agree...</p>",
                                        "is_one_sided": 0,
                                        "language": "hu",
                                        "hide_service_provider_details": false,
                                        "need_validation": 0,
                                        "allowed_user_type": 1,
                                        "partners": [
                                            {
                                                "position": 2,
                                                "email": "ceo@example.com",
                                                "partner_details": {
                                                    "partner_type": 2,
                                                    "company_name": "Example Ltd.",
                                                    "company_tax_number": "12345678-1-42",
                                                    "company_registered_office": "1234 City, Street 1",
                                                    "signatory_name": "John CEO"
                                                }
                                            },
                                            {
                                                "position": 3,
                                                "email": "private@example.com",
                                                "partner_details": {
                                                    "partner_type": 1,
                                                    "signatory_name": "Jane Private",
                                                    "phone_number": "+36301234567",
                                                    "address": "5678 Town, Road 2",
                                                    "mothers_name": "Mother Name",
                                                    "birthday": "1980-01-01",
                                                    "place_of_birth": "City"
                                                }
                                            }
                                        ]
                                    }
                                },
                                "create_html_unilateral": {
                                    "summary": "Create from HTML - Unilateral Declaration",
                                    "value": {
                                        "title": "Unilateral HTML Declaration",
                                        "own_id": "MY-UNI-HTML-001",
                                        "html_content": "<h1>Declaration</h1><p>I hereby declare...</p>",
                                        "sign_now": true,
                                        "client_title": "Declarant",
                                        "is_one_sided": 1,
                                        "signer_count": 1,
                                        "has_expiration_date": false,
                                        "callback_url": "https://site.com/callback",
                                        "redirect_url": "https://site.com/redirect",
                                        "copy_to_email": "copy@example.com",
                                        "language": "hu",
                                        "hide_service_provider_details": false,
                                        "need_validation": 0,
                                        "partners": []
                                    }
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Contract created successfully.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "required": [
                                        "message",
                                        "contract"
                                    ],
                                    "properties": {
                                        "message": {
                                            "type": "string"
                                        },
                                        "contract": {
                                            "$ref": "#/components/schemas/ContractDetail"
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "400": {
                        "description": "Bad Request"
                    },
                    "403": {
                        "description": "Forbidden",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "status": {
                                            "type": "string",
                                            "example": "error"
                                        },
                                        "message": {
                                            "type": "string",
                                            "example": "You are not authorized for this operation (contracts:write)"
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "sanctum": []
                    }
                ]
            }
        },
        "/api/agent/contracts/{id}/download": {
            "get": {
                "tags": [
                    "Contract"
                ],
                "summary": "Download contract PDF",
                "description": "Downloads the generated PDF for a finalized contract. Requires 'contracts:read' ability.",
                "operationId": "downloadContract",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "description": "Contract ID",
                        "required": true,
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Successful download",
                        "content": {
                            "application/pdf": {
                                "schema": {
                                    "type": "string",
                                    "format": "binary"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "Contract not found"
                    },
                    "403": {
                        "description": "Forbidden",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "status": {
                                            "type": "string",
                                            "example": "error"
                                        },
                                        "message": {
                                            "type": "string",
                                            "example": "Unauthorized or contract not finalized OR You are not authorized for this operation (contracts:read)"
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "sanctum": [
                            "contracts:read"
                        ]
                    }
                ]
            }
        },
        "/api/agent/contracts/shared-link": {
            "post": {
                "tags": [
                    "Contract"
                ],
                "summary": "Create a shared link",
                "description": "Generates a shared link for a contract. Requires 'contracts:write' ability.",
                "operationId": "createSharedLink",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "required": [
                                    "contract_id",
                                    "email_address",
                                    "lifetime"
                                ],
                                "properties": {
                                    "contract_id": {
                                        "description": "Contract ID",
                                        "type": "integer"
                                    },
                                    "email_address": {
                                        "description": "Recipient Email",
                                        "type": "string",
                                        "format": "email"
                                    },
                                    "lifetime": {
                                        "description": "Lifetime in minutes (>= 0)",
                                        "type": "integer"
                                    }
                                },
                                "type": "object"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Shared link creation result.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "required": [
                                        "data",
                                        "message"
                                    ],
                                    "properties": {
                                        "data": {
                                            "required": [
                                                "success"
                                            ],
                                            "properties": {
                                                "success": {
                                                    "description": "Whether the shared link was created.",
                                                    "type": "boolean"
                                                }
                                            },
                                            "type": "object"
                                        },
                                        "message": {
                                            "type": "string"
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "Forbidden"
                    }
                },
                "security": [
                    {
                        "sanctum": [
                            "contracts:write"
                        ]
                    }
                ]
            }
        },
        "/api/agent/contracts/{id}/shared-links": {
            "get": {
                "tags": [
                    "Contract"
                ],
                "summary": "List shared links",
                "description": "Lists active shared links for a contract. Requires 'contracts:read' ability.",
                "operationId": "listSharedLinks",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Shared links retrieved.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "required": [
                                        "data",
                                        "message"
                                    ],
                                    "properties": {
                                        "data": {
                                            "type": "array",
                                            "items": {
                                                "required": [
                                                    "id",
                                                    "email_address",
                                                    "created_at",
                                                    "available_at",
                                                    "delete"
                                                ],
                                                "properties": {
                                                    "id": {
                                                        "type": "integer"
                                                    },
                                                    "email_address": {
                                                        "type": "string"
                                                    },
                                                    "created_at": {
                                                        "type": "string",
                                                        "nullable": true
                                                    },
                                                    "available_at": {
                                                        "type": "string",
                                                        "nullable": true
                                                    },
                                                    "delete": {
                                                        "description": "Shared link ID used for deletion.",
                                                        "type": "integer"
                                                    }
                                                },
                                                "type": "object"
                                            }
                                        },
                                        "message": {
                                            "type": "string"
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "sanctum": [
                            "contracts:read"
                        ]
                    }
                ]
            }
        },
        "/api/agent/contracts/shared-link/{link_id}": {
            "delete": {
                "tags": [
                    "Contract"
                ],
                "summary": "Delete a shared link",
                "description": "Deletes a specific shared link. Requires 'contracts:write' ability.",
                "operationId": "deleteSharedLink",
                "parameters": [
                    {
                        "name": "link_id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "contract_id",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Shared link deleted.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "required": [
                                        "data",
                                        "message"
                                    ],
                                    "properties": {
                                        "data": {
                                            "required": [
                                                "success"
                                            ],
                                            "properties": {
                                                "success": {
                                                    "type": "boolean",
                                                    "enum": [
                                                        true
                                                    ]
                                                }
                                            },
                                            "type": "object"
                                        },
                                        "message": {
                                            "type": "string"
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "Link not found"
                    }
                },
                "security": [
                    {
                        "sanctum": [
                            "contracts:write"
                        ]
                    }
                ]
            }
        },
        "/api/agent/contracts/{id}/ai-call": {
            "post": {
                "tags": [
                    "Contract"
                ],
                "summary": "Trigger an AI phone call to the partner",
                "description": "Initiates an AI-powered outbound call to the contract's pending partner.\nConditions:\n- The caller must be the contract owner.\n- The contract must have a pending (unsigned) invitation (status=0).\n- The partner must have a valid phone number (min. 7 digits) – checked in user profile, direct DB columns, and meta_fields JSON.\n- At most one call per contract per calendar day.\n- 4 credits (timestamps) are deducted on success.\n- Requires 'contracts:write' ability.",
                "operationId": "aiCall",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "description": "Contract ID",
                        "required": true,
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "requestBody": {
                    "required": false,
                    "content": {
                        "application/json": {
                            "schema": {
                                "properties": {
                                    "ai_instructions": {
                                        "description": "Optional custom instructions for the AI assistant. If provided, this value is saved to the contract and used in the call (overrides previously stored instructions). E.g.: 'The partner already signed verbally, just needs to confirm digitally.'",
                                        "type": "string",
                                        "example": "A partner verbálisan már beleegyezett, csak formailag kell aláírnia.",
                                        "nullable": true
                                    }
                                },
                                "type": "object"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "AI call started",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "required": [
                                        "data",
                                        "message"
                                    ],
                                    "properties": {
                                        "data": {
                                            "required": [
                                                "phone",
                                                "credits_remaining"
                                            ],
                                            "properties": {
                                                "phone": {
                                                    "type": "string"
                                                },
                                                "credits_remaining": {
                                                    "type": "integer"
                                                }
                                            },
                                            "type": "object"
                                        },
                                        "message": {
                                            "type": "string"
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "402": {
                        "description": "Insufficient credits",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "status": {
                                            "type": "string",
                                            "example": "error"
                                        },
                                        "message": {
                                            "type": "string",
                                            "example": "Insufficient timestamps (minimum 4 required)."
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "Forbidden / wrong status",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "status": {
                                            "type": "string",
                                            "example": "error"
                                        },
                                        "message": {
                                            "type": "string",
                                            "example": "AI calls can only be triggered on pending contracts."
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "Contract / invite not found",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "status": {
                                            "type": "string",
                                            "example": "error"
                                        },
                                        "message": {
                                            "type": "string",
                                            "example": "Contract not found or access denied"
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "No phone / no invite",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "status": {
                                            "type": "string",
                                            "example": "error"
                                        },
                                        "message": {
                                            "type": "string",
                                            "example": "The partner has no phone number on record."
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "Daily limit reached",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "status": {
                                            "type": "string",
                                            "example": "error"
                                        },
                                        "message": {
                                            "type": "string",
                                            "example": "An AI call was already triggered today for this contract. Try again tomorrow."
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "AI temporarily disabled",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "status": {
                                            "type": "string",
                                            "example": "error"
                                        },
                                        "message": {
                                            "type": "string",
                                            "example": "AI phone calls are currently unavailable."
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "sanctum": [
                            "contracts:write"
                        ]
                    }
                ]
            }
        },
        "/api/agent/contract-status": {
            "get": {
                "tags": [
                    "Contract Status"
                ],
                "summary": "List contract statuses",
                "description": "Lists your custom contract statuses. Requires statuses:read.",
                "operationId": "contractStatusList",
                "responses": {
                    "200": {
                        "description": "Successful operation.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "required": [
                                        "data"
                                    ],
                                    "properties": {
                                        "data": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/AgentContractStatusRecord"
                                            }
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Unauthenticated.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "required": [
                                        "message"
                                    ],
                                    "properties": {
                                        "message": {
                                            "type": "string",
                                            "example": "Unauthenticated."
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "Access denied.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "anyOf": [
                                        {
                                            "required": [
                                                "status",
                                                "message"
                                            ],
                                            "properties": {
                                                "status": {
                                                    "type": "string",
                                                    "enum": [
                                                        "error"
                                                    ]
                                                },
                                                "message": {
                                                    "type": "string",
                                                    "example": "You are not authorized for this operation (statuses:read)"
                                                }
                                            },
                                            "type": "object"
                                        },
                                        {
                                            "required": [
                                                "status",
                                                "message"
                                            ],
                                            "properties": {
                                                "status": {
                                                    "type": "string",
                                                    "enum": [
                                                        "error"
                                                    ]
                                                },
                                                "message": {
                                                    "required": [
                                                        "message"
                                                    ],
                                                    "properties": {
                                                        "message": {
                                                            "type": "string",
                                                            "example": "No rights to custom status"
                                                        }
                                                    },
                                                    "type": "object"
                                                }
                                            },
                                            "type": "object"
                                        },
                                        {
                                            "required": [
                                                "message"
                                            ],
                                            "properties": {
                                                "message": {
                                                    "type": "string",
                                                    "example": "Access denied from this IP address."
                                                }
                                            },
                                            "type": "object"
                                        }
                                    ]
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "Too many requests.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/AgentContractStatusError"
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "Unable to check access.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/AgentContractStatusError"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "sanctum": []
                    }
                ]
            },
            "post": {
                "tags": [
                    "Contract Status"
                ],
                "summary": "Create contract status",
                "description": "Creates a custom contract status. Requires statuses:write.",
                "operationId": "contractStatusStore",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "required": [
                                    "name",
                                    "color"
                                ],
                                "properties": {
                                    "name": {
                                        "description": "Required status name, unique within the current account.",
                                        "type": "string"
                                    },
                                    "color": {
                                        "description": "Status color.",
                                        "type": "string",
                                        "example": "#3498db"
                                    },
                                    "email_to": {
                                        "description": "Notification email. Omitted values clear it.",
                                        "type": "string",
                                        "format": "email",
                                        "nullable": true
                                    },
                                    "email_subject": {
                                        "description": "Email subject. Omitted values clear it.",
                                        "type": "string",
                                        "nullable": true
                                    },
                                    "email_body": {
                                        "description": "Email body. Omitted values clear it.",
                                        "type": "string",
                                        "nullable": true
                                    },
                                    "is_default": {
                                        "description": "Makes this the default status.",
                                        "type": "boolean"
                                    },
                                    "permissions": {
                                        "description": "Permission IDs to assign.",
                                        "type": "array",
                                        "items": {
                                            "type": "integer"
                                        }
                                    }
                                },
                                "type": "object"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Successful operation.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "required": [
                                        "data"
                                    ],
                                    "properties": {
                                        "data": {
                                            "$ref": "#/components/schemas/AgentContractStatusRecord"
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "400": {
                        "description": "Invalid status details.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/AgentContractStatusValidationError"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Unauthenticated.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "required": [
                                        "message"
                                    ],
                                    "properties": {
                                        "message": {
                                            "type": "string",
                                            "example": "Unauthenticated."
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "Access denied.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "anyOf": [
                                        {
                                            "required": [
                                                "status",
                                                "message"
                                            ],
                                            "properties": {
                                                "status": {
                                                    "type": "string",
                                                    "enum": [
                                                        "error"
                                                    ]
                                                },
                                                "message": {
                                                    "type": "string",
                                                    "example": "You are not authorized for this operation (statuses:write)"
                                                }
                                            },
                                            "type": "object"
                                        },
                                        {
                                            "required": [
                                                "status",
                                                "message"
                                            ],
                                            "properties": {
                                                "status": {
                                                    "type": "string",
                                                    "enum": [
                                                        "error"
                                                    ]
                                                },
                                                "message": {
                                                    "required": [
                                                        "message"
                                                    ],
                                                    "properties": {
                                                        "message": {
                                                            "type": "string",
                                                            "example": "No rights to custom status"
                                                        }
                                                    },
                                                    "type": "object"
                                                }
                                            },
                                            "type": "object"
                                        },
                                        {
                                            "required": [
                                                "message"
                                            ],
                                            "properties": {
                                                "message": {
                                                    "type": "string",
                                                    "example": "Access denied from this IP address."
                                                }
                                            },
                                            "type": "object"
                                        }
                                    ]
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "Too many requests.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/AgentContractStatusError"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "sanctum": []
                    }
                ]
            }
        },
        "/api/agent/contract-status/{id}": {
            "put": {
                "tags": [
                    "Contract Status"
                ],
                "summary": "Update contract status",
                "description": "Updates a custom contract status. Requires statuses:write.",
                "operationId": "contractStatusUpdate",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "description": "Status ID.",
                        "required": true,
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "required": [
                                    "name",
                                    "color"
                                ],
                                "properties": {
                                    "name": {
                                        "description": "Required status name, unique within the current account excluding this status.",
                                        "type": "string"
                                    },
                                    "color": {
                                        "description": "Status color.",
                                        "type": "string",
                                        "example": "#3498db"
                                    },
                                    "email_to": {
                                        "description": "Notification email. Omitted values clear it.",
                                        "type": "string",
                                        "format": "email",
                                        "nullable": true
                                    },
                                    "email_subject": {
                                        "description": "Email subject. Omitted values clear it.",
                                        "type": "string",
                                        "nullable": true
                                    },
                                    "email_body": {
                                        "description": "Email body. Omitted values clear it.",
                                        "type": "string",
                                        "nullable": true
                                    },
                                    "is_default": {
                                        "description": "Makes this the default status.",
                                        "type": "boolean"
                                    },
                                    "permissions": {
                                        "description": "Permission IDs to assign. Omitted or empty removes assignments.",
                                        "type": "array",
                                        "items": {
                                            "type": "integer"
                                        }
                                    }
                                },
                                "type": "object"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Successful operation.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "required": [
                                        "data"
                                    ],
                                    "properties": {
                                        "data": {
                                            "$ref": "#/components/schemas/AgentContractStatusRecord"
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "400": {
                        "description": "Invalid status details.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/AgentContractStatusValidationError"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Unauthenticated.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "required": [
                                        "message"
                                    ],
                                    "properties": {
                                        "message": {
                                            "type": "string",
                                            "example": "Unauthenticated."
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "Access denied.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "anyOf": [
                                        {
                                            "required": [
                                                "status",
                                                "message"
                                            ],
                                            "properties": {
                                                "status": {
                                                    "type": "string",
                                                    "enum": [
                                                        "error"
                                                    ]
                                                },
                                                "message": {
                                                    "type": "string",
                                                    "example": "You are not authorized for this operation (statuses:write)"
                                                }
                                            },
                                            "type": "object"
                                        },
                                        {
                                            "required": [
                                                "status",
                                                "message"
                                            ],
                                            "properties": {
                                                "status": {
                                                    "type": "string",
                                                    "enum": [
                                                        "error"
                                                    ]
                                                },
                                                "message": {
                                                    "required": [
                                                        "message"
                                                    ],
                                                    "properties": {
                                                        "message": {
                                                            "type": "string",
                                                            "example": "No rights to custom status"
                                                        }
                                                    },
                                                    "type": "object"
                                                }
                                            },
                                            "type": "object"
                                        },
                                        {
                                            "required": [
                                                "message"
                                            ],
                                            "properties": {
                                                "message": {
                                                    "type": "string",
                                                    "example": "Access denied from this IP address."
                                                }
                                            },
                                            "type": "object"
                                        }
                                    ]
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "Status not found.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/AgentContractStatusNestedError"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "Too many requests.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/AgentContractStatusError"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "sanctum": []
                    }
                ]
            },
            "delete": {
                "tags": [
                    "Contract Status"
                ],
                "summary": "Delete contract status",
                "description": "Deletes a custom contract status. Requires statuses:write.",
                "operationId": "contractStatusDestroy",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "description": "Status ID.",
                        "required": true,
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Successful operation.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "required": [
                                        "data"
                                    ],
                                    "properties": {
                                        "data": {
                                            "required": [
                                                "message"
                                            ],
                                            "properties": {
                                                "message": {
                                                    "type": "string",
                                                    "example": "Deleted successfully"
                                                }
                                            },
                                            "type": "object"
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Unauthenticated.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "required": [
                                        "message"
                                    ],
                                    "properties": {
                                        "message": {
                                            "type": "string",
                                            "example": "Unauthenticated."
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "Access denied.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "anyOf": [
                                        {
                                            "required": [
                                                "status",
                                                "message"
                                            ],
                                            "properties": {
                                                "status": {
                                                    "type": "string",
                                                    "enum": [
                                                        "error"
                                                    ]
                                                },
                                                "message": {
                                                    "type": "string",
                                                    "example": "You are not authorized for this operation (statuses:write)"
                                                }
                                            },
                                            "type": "object"
                                        },
                                        {
                                            "required": [
                                                "status",
                                                "message"
                                            ],
                                            "properties": {
                                                "status": {
                                                    "type": "string",
                                                    "enum": [
                                                        "error"
                                                    ]
                                                },
                                                "message": {
                                                    "required": [
                                                        "message"
                                                    ],
                                                    "properties": {
                                                        "message": {
                                                            "type": "string",
                                                            "example": "No rights to custom status"
                                                        }
                                                    },
                                                    "type": "object"
                                                }
                                            },
                                            "type": "object"
                                        },
                                        {
                                            "required": [
                                                "message"
                                            ],
                                            "properties": {
                                                "message": {
                                                    "type": "string",
                                                    "example": "Access denied from this IP address."
                                                }
                                            },
                                            "type": "object"
                                        }
                                    ]
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "Status not found.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/AgentContractStatusNestedError"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "Status cannot be deleted because it is used by a manual transition.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/AgentContractStatusNestedError"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "Too many requests.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/AgentContractStatusError"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "sanctum": []
                    }
                ]
            }
        },
        "/api/agent/coworkers": {
            "get": {
                "tags": [
                    "Coworker"
                ],
                "summary": "List coworkers",
                "description": "Lists coworkers in the current account, excluding the account owner. Requires coworkers:read.",
                "operationId": "getCoworkers",
                "responses": {
                    "200": {
                        "description": "Coworker list, or an empty array.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "required": [
                                        "data"
                                    ],
                                    "properties": {
                                        "data": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/AgentCoworkerRecord"
                                            }
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Unauthenticated.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "required": [
                                        "message"
                                    ],
                                    "properties": {
                                        "message": {
                                            "type": "string",
                                            "example": "Unauthenticated."
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "Access denied.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "anyOf": [
                                        {
                                            "required": [
                                                "status",
                                                "message"
                                            ],
                                            "properties": {
                                                "status": {
                                                    "type": "string",
                                                    "enum": [
                                                        "error"
                                                    ]
                                                },
                                                "message": {
                                                    "type": "string",
                                                    "example": "You are not authorized for this operation (coworkers:read)"
                                                }
                                            },
                                            "type": "object"
                                        },
                                        {
                                            "required": [
                                                "message"
                                            ],
                                            "properties": {
                                                "message": {
                                                    "type": "string",
                                                    "example": "Access denied from this IP address."
                                                }
                                            },
                                            "type": "object"
                                        },
                                        {
                                            "required": [
                                                "error"
                                            ],
                                            "properties": {
                                                "error": {
                                                    "description": "Localized firewall block message.",
                                                    "type": "string"
                                                }
                                            },
                                            "type": "object"
                                        }
                                    ]
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "Too many requests.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "required": [
                                        "status",
                                        "message"
                                    ],
                                    "properties": {
                                        "status": {
                                            "type": "string",
                                            "enum": [
                                                "error"
                                            ]
                                        },
                                        "message": {
                                            "type": "string"
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "sanctum": []
                    }
                ]
            },
            "post": {
                "tags": [
                    "Coworker"
                ],
                "summary": "Add or update a coworker",
                "description": "Adds a coworker by email or updates their account access settings. Requires coworkers:write.",
                "operationId": "storeCoworker",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "required": [
                                    "email",
                                    "name",
                                    "position"
                                ],
                                "properties": {
                                    "email": {
                                        "type": "string",
                                        "format": "email",
                                        "example": "coworker@example.com"
                                    },
                                    "name": {
                                        "type": "string",
                                        "example": "John Doe"
                                    },
                                    "position": {
                                        "type": "string",
                                        "example": "Developer"
                                    },
                                    "create_templates": {
                                        "description": "0 or 1; omitted values reset to 0. When set to 1, the coworker can create contract templates.",
                                        "type": "integer",
                                        "example": 1,
                                        "default": 0
                                    },
                                    "make_contract": {
                                        "description": "0 or 1; omitted values reset to 0. When set to 1, the coworker can create contracts.",
                                        "type": "integer",
                                        "example": 1,
                                        "default": 0
                                    },
                                    "only_draft_contract": {
                                        "description": "When set to 1, the coworker can only create draft contracts. Omitted values reset to 0.",
                                        "type": "integer",
                                        "example": 1,
                                        "default": 0
                                    },
                                    "download_orders_invoices": {
                                        "description": "0 or 1; omitted values reset to 0. When set to 1, the coworker can download invoices.",
                                        "type": "integer",
                                        "example": 1,
                                        "default": 0
                                    },
                                    "excel_export": {
                                        "description": "0 or 1; omitted values reset to 0. When set to 1, the coworker can export data.",
                                        "type": "integer",
                                        "example": 1,
                                        "default": 0
                                    },
                                    "integration_access": {
                                        "description": "0 or 1; omitted values reset to 0. When set to 1, the coworker can access the XML API documentation.",
                                        "type": "integer",
                                        "example": 1,
                                        "default": 0
                                    },
                                    "contract_branding": {
                                        "description": "0 or 1; omitted values reset to 0. When set to 1, the coworker can edit the branding settings.",
                                        "type": "integer",
                                        "example": 1,
                                        "default": 0
                                    },
                                    "create_contracts": {
                                        "description": "1 allows access beyond own contracts; 0 restricts access to own contracts. Defaults to 0, including on update.",
                                        "type": "integer",
                                        "example": 1,
                                        "default": 0
                                    },
                                    "sign_contracts": {
                                        "description": "0 or 1; omitted values reset to 0. When set to 1, the coworker can act on behalf of the main account and sign documents.",
                                        "type": "integer",
                                        "example": 1,
                                        "default": 0
                                    },
                                    "permission": {
                                        "description": "0 or 1; omitted values reset to 0. When set to 1, the coworker is restricted according to their assigned permissions.",
                                        "type": "integer",
                                        "example": 1,
                                        "default": 0
                                    },
                                    "edit_permission": {
                                        "description": "0 or 1; omitted values reset to 0. When set to 1, the coworker can edit the permissions assigned to other coworkers.",
                                        "type": "integer",
                                        "example": 1,
                                        "default": 0
                                    },
                                    "manage_internal_statuses": {
                                        "description": "0 or 1; omitted values reset to 0. When set to 1, the coworker can manage internal statuses.",
                                        "type": "integer",
                                        "example": 1,
                                        "default": 0
                                    },
                                    "delete_contracts": {
                                        "description": "Allows contract deletion for existing users only.",
                                        "type": "integer",
                                        "example": 1,
                                        "default": 0
                                    },
                                    "manage_co_accounts": {
                                        "description": "0 or 1; omitted values reset to 0. When set to 1, the coworker can manage other coworkers.",
                                        "type": "integer",
                                        "example": 1,
                                        "default": 0
                                    },
                                    "use_position_instead_of_delegate": {
                                        "description": "0 or 1; omitted values reset to 0. When set to 1, the position title replaces the default delegate text on contracts handled by this coworker.",
                                        "type": "integer",
                                        "example": 1,
                                        "default": 0
                                    },
                                    "permissions": {
                                        "description": "Comma-separated permission titles. Omitting this field or leaving it empty clears the assignments; unknown titles are ignored. These permissions restrict the coworker when permission is set to 1.",
                                        "type": "string",
                                        "example": "Sales,Finance",
                                        "default": ""
                                    }
                                },
                                "type": "object"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Coworker added or updated.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "required": [
                                        "data",
                                        "message"
                                    ],
                                    "properties": {
                                        "data": {
                                            "type": "string",
                                            "nullable": true,
                                            "enum": [
                                                null
                                            ]
                                        },
                                        "message": {
                                            "type": "string",
                                            "example": "Coworker successfully added"
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "400": {
                        "description": "Invalid request or coworkers are not allowed on this account.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "anyOf": [
                                        {
                                            "$ref": "#/components/schemas/AgentCoworkerValidationError"
                                        },
                                        {
                                            "required": [
                                                "status",
                                                "message"
                                            ],
                                            "properties": {
                                                "status": {
                                                    "type": "string",
                                                    "enum": [
                                                        "error"
                                                    ]
                                                },
                                                "message": {
                                                    "type": "string",
                                                    "example": "Max coworker limit reached"
                                                }
                                            },
                                            "type": "object"
                                        }
                                    ]
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Unauthenticated.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "required": [
                                        "message"
                                    ],
                                    "properties": {
                                        "message": {
                                            "type": "string",
                                            "example": "Unauthenticated."
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "Access denied.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "anyOf": [
                                        {
                                            "required": [
                                                "status",
                                                "message"
                                            ],
                                            "properties": {
                                                "status": {
                                                    "type": "string",
                                                    "enum": [
                                                        "error"
                                                    ]
                                                },
                                                "message": {
                                                    "type": "string",
                                                    "example": "You are not authorized for this operation (coworkers:write)"
                                                }
                                            },
                                            "type": "object"
                                        },
                                        {
                                            "required": [
                                                "message"
                                            ],
                                            "properties": {
                                                "message": {
                                                    "type": "string",
                                                    "example": "Access denied from this IP address."
                                                }
                                            },
                                            "type": "object"
                                        },
                                        {
                                            "required": [
                                                "error"
                                            ],
                                            "properties": {
                                                "error": {
                                                    "description": "Localized firewall block message.",
                                                    "type": "string"
                                                }
                                            },
                                            "type": "object"
                                        }
                                    ]
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "Too many requests.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "required": [
                                        "status",
                                        "message"
                                    ],
                                    "properties": {
                                        "status": {
                                            "type": "string",
                                            "enum": [
                                                "error"
                                            ]
                                        },
                                        "message": {
                                            "type": "string"
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "Coworker could not be saved.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "required": [
                                        "status",
                                        "message"
                                    ],
                                    "properties": {
                                        "status": {
                                            "type": "string",
                                            "enum": [
                                                "error"
                                            ]
                                        },
                                        "message": {
                                            "type": "string",
                                            "example": "Error on save"
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "sanctum": []
                    }
                ]
            },
            "delete": {
                "tags": [
                    "Coworker"
                ],
                "summary": "Remove a coworker",
                "description": "Removes a coworker from the current account by email. Requires coworkers:write.",
                "operationId": "deleteCoworker",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "required": [
                                    "email"
                                ],
                                "properties": {
                                    "email": {
                                        "type": "string",
                                        "format": "email",
                                        "example": "coworker@example.com"
                                    }
                                },
                                "type": "object"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Coworker removed.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "required": [
                                        "data",
                                        "message"
                                    ],
                                    "properties": {
                                        "data": {
                                            "type": "string",
                                            "nullable": true,
                                            "enum": [
                                                null
                                            ]
                                        },
                                        "message": {
                                            "type": "string",
                                            "example": "Coworker successfully removed"
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "400": {
                        "description": "Validation failed, user not found, or user not in the current account.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "anyOf": [
                                        {
                                            "$ref": "#/components/schemas/AgentCoworkerValidationError"
                                        },
                                        {
                                            "required": [
                                                "status",
                                                "message"
                                            ],
                                            "properties": {
                                                "status": {
                                                    "type": "string",
                                                    "enum": [
                                                        "error"
                                                    ]
                                                },
                                                "message": {
                                                    "type": "string",
                                                    "example": "Coworker not found"
                                                }
                                            },
                                            "type": "object"
                                        },
                                        {
                                            "required": [
                                                "status",
                                                "message"
                                            ],
                                            "properties": {
                                                "status": {
                                                    "type": "string",
                                                    "enum": [
                                                        "error"
                                                    ]
                                                },
                                                "message": {
                                                    "type": "string",
                                                    "example": "Coworker not found in your group"
                                                }
                                            },
                                            "type": "object"
                                        }
                                    ]
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Unauthenticated.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "required": [
                                        "message"
                                    ],
                                    "properties": {
                                        "message": {
                                            "type": "string",
                                            "example": "Unauthenticated."
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "Access denied.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "anyOf": [
                                        {
                                            "required": [
                                                "status",
                                                "message"
                                            ],
                                            "properties": {
                                                "status": {
                                                    "type": "string",
                                                    "enum": [
                                                        "error"
                                                    ]
                                                },
                                                "message": {
                                                    "type": "string",
                                                    "example": "You are not authorized for this operation (coworkers:write)"
                                                }
                                            },
                                            "type": "object"
                                        },
                                        {
                                            "required": [
                                                "message"
                                            ],
                                            "properties": {
                                                "message": {
                                                    "type": "string",
                                                    "example": "Access denied from this IP address."
                                                }
                                            },
                                            "type": "object"
                                        },
                                        {
                                            "required": [
                                                "error"
                                            ],
                                            "properties": {
                                                "error": {
                                                    "description": "Localized firewall block message.",
                                                    "type": "string"
                                                }
                                            },
                                            "type": "object"
                                        }
                                    ]
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "Too many requests.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "required": [
                                        "status",
                                        "message"
                                    ],
                                    "properties": {
                                        "status": {
                                            "type": "string",
                                            "enum": [
                                                "error"
                                            ]
                                        },
                                        "message": {
                                            "type": "string"
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "Coworker could not be removed.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "required": [
                                        "status",
                                        "message"
                                    ],
                                    "properties": {
                                        "status": {
                                            "type": "string",
                                            "enum": [
                                                "error"
                                            ]
                                        },
                                        "message": {
                                            "type": "string",
                                            "example": "Error on save"
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "sanctum": []
                    }
                ]
            }
        },
        "/api/agent/partners": {
            "get": {
                "tags": [
                    "Partners"
                ],
                "summary": "List partners",
                "description": "Lists your contract partners. Requires partners:read.",
                "operationId": "partners",
                "parameters": [
                    {
                        "name": "term",
                        "in": "query",
                        "description": "Search by name, email or company name.",
                        "required": false,
                        "schema": {
                            "type": "string",
                            "nullable": true
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Partner list, or an empty array when no partners match.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "required": [
                                        "data"
                                    ],
                                    "properties": {
                                        "data": {
                                            "type": "array",
                                            "items": {
                                                "required": [
                                                    "id",
                                                    "name",
                                                    "email",
                                                    "phone",
                                                    "company_name",
                                                    "company_residence",
                                                    "company_tax_number",
                                                    "address",
                                                    "mothers_name",
                                                    "personal_id_number",
                                                    "birthday",
                                                    "place_of_birth"
                                                ],
                                                "properties": {
                                                    "id": {
                                                        "type": "integer",
                                                        "example": 101
                                                    },
                                                    "name": {
                                                        "type": "string",
                                                        "example": "Kovács Béla",
                                                        "nullable": true
                                                    },
                                                    "email": {
                                                        "type": "string",
                                                        "format": "email",
                                                        "example": "bela.kovacs@example.com"
                                                    },
                                                    "phone": {
                                                        "type": "string",
                                                        "example": "+36301234567",
                                                        "nullable": true
                                                    },
                                                    "company_name": {
                                                        "type": "string",
                                                        "example": "Kovács Kft.",
                                                        "nullable": true
                                                    },
                                                    "company_residence": {
                                                        "type": "string",
                                                        "example": "1051 Budapest, Fő utca 1.",
                                                        "nullable": true
                                                    },
                                                    "company_tax_number": {
                                                        "type": "string",
                                                        "example": "12345678-1-41",
                                                        "nullable": true
                                                    },
                                                    "address": {
                                                        "type": "string",
                                                        "example": "1111 Budapest, Mellék utca 2.",
                                                        "nullable": true
                                                    },
                                                    "mothers_name": {
                                                        "type": "string",
                                                        "example": "Nagy Anna",
                                                        "nullable": true
                                                    },
                                                    "personal_id_number": {
                                                        "type": "string",
                                                        "example": "123456AB",
                                                        "nullable": true
                                                    },
                                                    "birthday": {
                                                        "type": "string",
                                                        "format": "date",
                                                        "example": "1980-01-01",
                                                        "nullable": true
                                                    },
                                                    "place_of_birth": {
                                                        "type": "string",
                                                        "example": "Debrecen",
                                                        "nullable": true
                                                    }
                                                },
                                                "type": "object"
                                            }
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "400": {
                        "description": "Invalid search term.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "required": [
                                        "status",
                                        "message"
                                    ],
                                    "properties": {
                                        "status": {
                                            "type": "string",
                                            "enum": [
                                                "error"
                                            ]
                                        },
                                        "message": {
                                            "required": [
                                                "term"
                                            ],
                                            "properties": {
                                                "term": {
                                                    "type": "array",
                                                    "items": {
                                                        "type": "string"
                                                    },
                                                    "example": [
                                                        "The term must be a string."
                                                    ]
                                                }
                                            },
                                            "type": "object"
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Unauthenticated.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "required": [
                                        "message"
                                    ],
                                    "properties": {
                                        "message": {
                                            "type": "string",
                                            "example": "Unauthenticated."
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "Access denied.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "anyOf": [
                                        {
                                            "required": [
                                                "status",
                                                "message"
                                            ],
                                            "properties": {
                                                "status": {
                                                    "type": "string",
                                                    "enum": [
                                                        "error"
                                                    ]
                                                },
                                                "message": {
                                                    "type": "string",
                                                    "example": "You are not authorized for this operation (partners:read)"
                                                }
                                            },
                                            "type": "object"
                                        },
                                        {
                                            "required": [
                                                "message"
                                            ],
                                            "properties": {
                                                "message": {
                                                    "type": "string",
                                                    "example": "Access denied from this IP address."
                                                }
                                            },
                                            "type": "object"
                                        },
                                        {
                                            "required": [
                                                "error"
                                            ],
                                            "properties": {
                                                "error": {
                                                    "description": "Localized firewall block message.",
                                                    "type": "string"
                                                }
                                            },
                                            "type": "object"
                                        }
                                    ]
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "Too many requests.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "required": [
                                        "status",
                                        "message"
                                    ],
                                    "properties": {
                                        "status": {
                                            "type": "string",
                                            "enum": [
                                                "error"
                                            ]
                                        },
                                        "message": {
                                            "type": "string"
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "sanctum": []
                    }
                ]
            }
        },
        "/api/agent/templates": {
            "get": {
                "tags": [
                    "Templates"
                ],
                "summary": "List templates",
                "description": "Lists available contract templates. Requires templates:read.",
                "operationId": "templates",
                "responses": {
                    "200": {
                        "description": "Successful operation.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "required": [
                                        "data"
                                    ],
                                    "properties": {
                                        "data": {
                                            "required": [
                                                "templates"
                                            ],
                                            "properties": {
                                                "templates": {
                                                    "type": "array",
                                                    "items": {
                                                        "required": [
                                                            "id",
                                                            "name",
                                                            "language"
                                                        ],
                                                        "properties": {
                                                            "id": {
                                                                "type": "string",
                                                                "example": "123"
                                                            },
                                                            "name": {
                                                                "type": "string",
                                                                "nullable": true
                                                            },
                                                            "language": {
                                                                "type": "string",
                                                                "example": "hu",
                                                                "nullable": true
                                                            }
                                                        },
                                                        "type": "object"
                                                    }
                                                }
                                            },
                                            "type": "object"
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Unauthenticated. Use Accept: application/json for JSON errors.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "required": [
                                        "message"
                                    ],
                                    "properties": {
                                        "message": {
                                            "type": "string",
                                            "example": "Unauthenticated."
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "Access denied.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "anyOf": [
                                        {
                                            "required": [
                                                "status",
                                                "message"
                                            ],
                                            "properties": {
                                                "status": {
                                                    "type": "string",
                                                    "enum": [
                                                        "error"
                                                    ]
                                                },
                                                "message": {
                                                    "type": "string",
                                                    "example": "You are not authorized for this operation (templates:read)"
                                                }
                                            },
                                            "type": "object"
                                        },
                                        {
                                            "required": [
                                                "message"
                                            ],
                                            "properties": {
                                                "message": {
                                                    "type": "string",
                                                    "example": "Access denied from this IP address."
                                                }
                                            },
                                            "type": "object"
                                        },
                                        {
                                            "required": [
                                                "error"
                                            ],
                                            "properties": {
                                                "error": {
                                                    "type": "string"
                                                }
                                            },
                                            "type": "object"
                                        }
                                    ]
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "Too many requests.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "required": [
                                        "status",
                                        "message"
                                    ],
                                    "properties": {
                                        "status": {
                                            "type": "string",
                                            "enum": [
                                                "error"
                                            ]
                                        },
                                        "message": {
                                            "type": "string"
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "sanctum": []
                    }
                ]
            },
            "post": {
                "tags": [
                    "Templates"
                ],
                "summary": "Create a template",
                "description": "Creates a contract template. Requires templates:write.",
                "operationId": "createTemplate",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "required": [
                                    "title"
                                ],
                                "properties": {
                                    "title": {
                                        "type": "string",
                                        "example": "Contract Template"
                                    },
                                    "client_title": {
                                        "type": "string",
                                        "example": "Client",
                                        "nullable": true
                                    },
                                    "trustee_title": {
                                        "type": "string",
                                        "example": "Service Provider",
                                        "nullable": true
                                    },
                                    "template_content": {
                                        "type": "string",
                                        "example": "HTML content here...",
                                        "nullable": true
                                    },
                                    "template_intro": {
                                        "type": "string",
                                        "example": "Introduction text...",
                                        "nullable": true
                                    },
                                    "lang": {
                                        "type": "string",
                                        "example": "hu",
                                        "nullable": true,
                                        "maxLength": 2,
                                        "minLength": 2
                                    },
                                    "signer_count": {
                                        "type": "integer",
                                        "example": 2,
                                        "nullable": true,
                                        "minimum": 1
                                    },
                                    "single_signature": {
                                        "type": "boolean",
                                        "example": false,
                                        "nullable": true
                                    },
                                    "allowed_user": {
                                        "type": "integer",
                                        "example": 0,
                                        "nullable": true
                                    },
                                    "partner_3_title": {
                                        "type": "string",
                                        "example": "Guarantor"
                                    },
                                    "partner_4_title": {
                                        "type": "string",
                                        "example": "Witness"
                                    }
                                },
                                "type": "object"
                            },
                            "examples": {
                                "1_Unilateral": {
                                    "summary": "Unified Declaration (Unilateral - 1 Party)",
                                    "value": {
                                        "title": "Strict Confidentiality Declaration 2026",
                                        "single_signature": true,
                                        "signer_count": 1,
                                        "client_title": "Declarant",
                                        "template_intro": "Undersigned, as Declarant, I hereby declare...",
                                        "template_content": "<div class='declaration'><h1>Confidentiality Declaration</h1>...</div>",
                                        "lang": "en"
                                    }
                                },
                                "2_Bilateral": {
                                    "summary": "Bilateral Contract (2 Parties)",
                                    "value": {
                                        "title": "General Service Agreement",
                                        "single_signature": false,
                                        "signer_count": 2,
                                        "client_title": "Client",
                                        "trustee_title": "Service Provider",
                                        "template_intro": "Concluded between the Client and the Service Provider...",
                                        "template_content": "<h2>Service Agreement</h2>...",
                                        "lang": "en"
                                    }
                                },
                                "3_Trilateral": {
                                    "summary": "Trilateral Contract (3 Parties)",
                                    "value": {
                                        "title": "Sales Contract with Guarantor",
                                        "single_signature": false,
                                        "signer_count": 3,
                                        "client_title": "Seller",
                                        "trustee_title": "Buyer",
                                        "partner_3_title": "Guarantor",
                                        "template_intro": "Between the undersigned parties as Seller, Buyer and Guarantor...",
                                        "template_content": "<h3>Sales with Guarantee</h3>...",
                                        "lang": "en"
                                    }
                                },
                                "4_Quadrilateral": {
                                    "summary": "Quadrilateral Contract (4 Parties)",
                                    "value": {
                                        "title": "Complex Construction Agreement",
                                        "single_signature": false,
                                        "signer_count": 4,
                                        "client_title": "Employer",
                                        "trustee_title": "Main Contractor",
                                        "partner_3_title": "Subcontractor",
                                        "partner_4_title": "Technical Supervisor",
                                        "template_intro": "This agreement regulates the conditions of construction...",
                                        "template_content": "<p>Participants in the project:</p>...",
                                        "lang": "en"
                                    }
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Successful operation.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "required": [
                                        "data",
                                        "message"
                                    ],
                                    "properties": {
                                        "data": {
                                            "required": [
                                                "template_id"
                                            ],
                                            "properties": {
                                                "template_id": {
                                                    "type": "string",
                                                    "example": "123"
                                                }
                                            },
                                            "type": "object"
                                        },
                                        "message": {
                                            "type": "string",
                                            "example": "Successfully created!"
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "400": {
                        "description": "Invalid request or operation not allowed.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "anyOf": [
                                        {
                                            "$ref": "#/components/schemas/AgentTemplateValidationError"
                                        },
                                        {
                                            "$ref": "#/components/schemas/AgentTemplateError"
                                        }
                                    ]
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Unauthenticated. Use Accept: application/json for JSON errors.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "required": [
                                        "message"
                                    ],
                                    "properties": {
                                        "message": {
                                            "type": "string",
                                            "example": "Unauthenticated."
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "Access denied.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "anyOf": [
                                        {
                                            "required": [
                                                "status",
                                                "message"
                                            ],
                                            "properties": {
                                                "status": {
                                                    "type": "string",
                                                    "enum": [
                                                        "error"
                                                    ]
                                                },
                                                "message": {
                                                    "type": "string",
                                                    "example": "You are not authorized for this operation (templates:write)"
                                                }
                                            },
                                            "type": "object"
                                        },
                                        {
                                            "required": [
                                                "message"
                                            ],
                                            "properties": {
                                                "message": {
                                                    "type": "string",
                                                    "example": "Access denied from this IP address."
                                                }
                                            },
                                            "type": "object"
                                        },
                                        {
                                            "required": [
                                                "error"
                                            ],
                                            "properties": {
                                                "error": {
                                                    "type": "string"
                                                }
                                            },
                                            "type": "object"
                                        }
                                    ]
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "Too many requests.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "required": [
                                        "status",
                                        "message"
                                    ],
                                    "properties": {
                                        "status": {
                                            "type": "string",
                                            "enum": [
                                                "error"
                                            ]
                                        },
                                        "message": {
                                            "type": "string"
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "Operation failed.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/AgentTemplateError"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "sanctum": []
                    }
                ]
            }
        },
        "/api/agent/templates/{id}": {
            "get": {
                "tags": [
                    "Templates"
                ],
                "summary": "Get template details",
                "description": "Returns the contract details and variables for a template. Requires templates:read.",
                "operationId": "template",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "description": "Template ID or html, html-single, html-more, pdf, pdf-single, pdf-more, custom-contract-type.",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Successful operation.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "required": [
                                        "data"
                                    ],
                                    "properties": {
                                        "data": {
                                            "required": [
                                                "head_for_contract",
                                                "contract_variables"
                                            ],
                                            "properties": {
                                                "head_for_contract": {
                                                    "description": "Contract details and recipient email fields.",
                                                    "required": [
                                                        "type_of_contract",
                                                        "subject_of_contract",
                                                        "accompanying_message",
                                                        "receiver_email",
                                                        "own_id"
                                                    ],
                                                    "properties": {
                                                        "type_of_contract": {
                                                            "type": "string",
                                                            "example": "123"
                                                        },
                                                        "subject_of_contract": {
                                                            "type": "string",
                                                            "example": "Enter Subject Here"
                                                        },
                                                        "accompanying_message": {
                                                            "type": "string",
                                                            "example": ""
                                                        },
                                                        "receiver_email": {
                                                            "type": "string",
                                                            "example": "email@example.com"
                                                        },
                                                        "own_id": {
                                                            "type": "string",
                                                            "example": ""
                                                        }
                                                    },
                                                    "type": "object",
                                                    "additionalProperties": {
                                                        "type": "string"
                                                    }
                                                },
                                                "contract_variables": {
                                                    "type": "array",
                                                    "items": {
                                                        "required": [
                                                            "name",
                                                            "description",
                                                            "value"
                                                        ],
                                                        "properties": {
                                                            "name": {
                                                                "type": "string"
                                                            },
                                                            "description": {
                                                                "type": "string"
                                                            },
                                                            "value": {
                                                                "type": "string",
                                                                "example": ""
                                                            }
                                                        },
                                                        "type": "object"
                                                    }
                                                }
                                            },
                                            "type": "object"
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Unauthenticated. Use Accept: application/json for JSON errors.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "required": [
                                        "message"
                                    ],
                                    "properties": {
                                        "message": {
                                            "type": "string",
                                            "example": "Unauthenticated."
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "Access denied.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "anyOf": [
                                        {
                                            "required": [
                                                "status",
                                                "message"
                                            ],
                                            "properties": {
                                                "status": {
                                                    "type": "string",
                                                    "enum": [
                                                        "error"
                                                    ]
                                                },
                                                "message": {
                                                    "type": "string",
                                                    "example": "You are not authorized for this operation (templates:read)"
                                                }
                                            },
                                            "type": "object"
                                        },
                                        {
                                            "required": [
                                                "message"
                                            ],
                                            "properties": {
                                                "message": {
                                                    "type": "string",
                                                    "example": "Access denied from this IP address."
                                                }
                                            },
                                            "type": "object"
                                        },
                                        {
                                            "required": [
                                                "error"
                                            ],
                                            "properties": {
                                                "error": {
                                                    "type": "string"
                                                }
                                            },
                                            "type": "object"
                                        }
                                    ]
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "Template or field not found.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/AgentTemplateRawError"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "Too many requests.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "required": [
                                        "status",
                                        "message"
                                    ],
                                    "properties": {
                                        "status": {
                                            "type": "string",
                                            "enum": [
                                                "error"
                                            ]
                                        },
                                        "message": {
                                            "type": "string"
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "sanctum": []
                    }
                ]
            },
            "put": {
                "tags": [
                    "Templates"
                ],
                "summary": "Update a template",
                "description": "Updates a contract template. Requires templates:write.",
                "operationId": "updateTemplate",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "required": [
                                    "title"
                                ],
                                "properties": {
                                    "title": {
                                        "type": "string",
                                        "example": "My Updated Contract Template"
                                    },
                                    "client_title": {
                                        "type": "string",
                                        "example": "Client",
                                        "nullable": true
                                    },
                                    "trustee_title": {
                                        "type": "string",
                                        "example": "Service Provider",
                                        "nullable": true
                                    },
                                    "template_content": {
                                        "type": "string",
                                        "example": "Updated HTML content...",
                                        "nullable": true
                                    },
                                    "template_intro": {
                                        "type": "string",
                                        "example": "Updated Introduction text...",
                                        "nullable": true
                                    },
                                    "lang": {
                                        "type": "string",
                                        "example": "hu",
                                        "nullable": true,
                                        "maxLength": 2,
                                        "minLength": 2
                                    },
                                    "signer_count": {
                                        "type": "integer",
                                        "example": 2,
                                        "nullable": true,
                                        "minimum": 1
                                    },
                                    "single_signature": {
                                        "type": "boolean",
                                        "example": false,
                                        "nullable": true
                                    },
                                    "allowed_user": {
                                        "type": "integer",
                                        "example": 0,
                                        "nullable": true
                                    },
                                    "partner_3_title": {
                                        "type": "string",
                                        "example": "Guarantor"
                                    },
                                    "partner_4_title": {
                                        "type": "string",
                                        "example": "Witness"
                                    }
                                },
                                "type": "object"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Successful operation.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "required": [
                                        "data"
                                    ],
                                    "properties": {
                                        "data": {
                                            "required": [
                                                "message"
                                            ],
                                            "properties": {
                                                "message": {
                                                    "type": "string",
                                                    "example": "Successfully updated!"
                                                }
                                            },
                                            "type": "object"
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "400": {
                        "description": "Invalid request or operation not allowed.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "anyOf": [
                                        {
                                            "$ref": "#/components/schemas/AgentTemplateValidationError"
                                        },
                                        {
                                            "$ref": "#/components/schemas/AgentTemplateError"
                                        },
                                        {
                                            "$ref": "#/components/schemas/AgentTemplateRawError"
                                        }
                                    ]
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Unauthenticated. Use Accept: application/json for JSON errors.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "required": [
                                        "message"
                                    ],
                                    "properties": {
                                        "message": {
                                            "type": "string",
                                            "example": "Unauthenticated."
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "Access denied.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "anyOf": [
                                        {
                                            "required": [
                                                "status",
                                                "message"
                                            ],
                                            "properties": {
                                                "status": {
                                                    "type": "string",
                                                    "enum": [
                                                        "error"
                                                    ]
                                                },
                                                "message": {
                                                    "type": "string",
                                                    "example": "You are not authorized for this operation (templates:write)"
                                                }
                                            },
                                            "type": "object"
                                        },
                                        {
                                            "required": [
                                                "message"
                                            ],
                                            "properties": {
                                                "message": {
                                                    "type": "string",
                                                    "example": "Access denied from this IP address."
                                                }
                                            },
                                            "type": "object"
                                        },
                                        {
                                            "required": [
                                                "error"
                                            ],
                                            "properties": {
                                                "error": {
                                                    "type": "string"
                                                }
                                            },
                                            "type": "object"
                                        }
                                    ]
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "Template or field not found.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/AgentTemplateRawError"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "Too many requests.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "required": [
                                        "status",
                                        "message"
                                    ],
                                    "properties": {
                                        "status": {
                                            "type": "string",
                                            "enum": [
                                                "error"
                                            ]
                                        },
                                        "message": {
                                            "type": "string"
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "Operation failed.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/AgentTemplateError"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "sanctum": []
                    }
                ]
            },
            "delete": {
                "tags": [
                    "Templates"
                ],
                "summary": "Delete a template",
                "description": "Deletes a template that is not used by any contract. Requires templates:write.",
                "operationId": "deleteTemplate",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "required": []
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Successful operation.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "required": [
                                        "data",
                                        "message"
                                    ],
                                    "properties": {
                                        "data": {
                                            "type": "string",
                                            "nullable": true,
                                            "enum": [
                                                null
                                            ]
                                        },
                                        "message": {
                                            "type": "string",
                                            "example": "Successfully deleted!"
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "400": {
                        "description": "Invalid request or operation not allowed.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/AgentTemplateRawError"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Unauthenticated. Use Accept: application/json for JSON errors.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "required": [
                                        "message"
                                    ],
                                    "properties": {
                                        "message": {
                                            "type": "string",
                                            "example": "Unauthenticated."
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "Access denied.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "anyOf": [
                                        {
                                            "required": [
                                                "status",
                                                "message"
                                            ],
                                            "properties": {
                                                "status": {
                                                    "type": "string",
                                                    "enum": [
                                                        "error"
                                                    ]
                                                },
                                                "message": {
                                                    "type": "string",
                                                    "example": "You are not authorized for this operation (templates:write)"
                                                }
                                            },
                                            "type": "object"
                                        },
                                        {
                                            "required": [
                                                "message"
                                            ],
                                            "properties": {
                                                "message": {
                                                    "type": "string",
                                                    "example": "Access denied from this IP address."
                                                }
                                            },
                                            "type": "object"
                                        },
                                        {
                                            "required": [
                                                "error"
                                            ],
                                            "properties": {
                                                "error": {
                                                    "type": "string"
                                                }
                                            },
                                            "type": "object"
                                        }
                                    ]
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "Template or field not found.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/AgentTemplateRawError"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "Too many requests.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "required": [
                                        "status",
                                        "message"
                                    ],
                                    "properties": {
                                        "status": {
                                            "type": "string",
                                            "enum": [
                                                "error"
                                            ]
                                        },
                                        "message": {
                                            "type": "string"
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "Operation failed.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/AgentTemplateError"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "sanctum": []
                    }
                ]
            }
        },
        "/api/agent/templates/{id}/archive": {
            "post": {
                "tags": [
                    "Templates"
                ],
                "summary": "Archive or restore a template",
                "description": "Archives a template or restores it from the archive. Requires templates:write.",
                "operationId": "archiveTemplate",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "required": [
                                    "is_archive"
                                ],
                                "properties": {
                                    "is_archive": {
                                        "description": "True to archive, False to restore",
                                        "type": "boolean",
                                        "example": true
                                    }
                                },
                                "type": "object"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Successful operation.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "required": [
                                        "data",
                                        "message"
                                    ],
                                    "properties": {
                                        "data": {
                                            "type": "string",
                                            "nullable": true,
                                            "enum": [
                                                null
                                            ]
                                        },
                                        "message": {
                                            "type": "string",
                                            "example": "Successfully updated!"
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "400": {
                        "description": "Invalid request or operation not allowed.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "anyOf": [
                                        {
                                            "$ref": "#/components/schemas/AgentTemplateValidationError"
                                        },
                                        {
                                            "$ref": "#/components/schemas/AgentTemplateRawError"
                                        }
                                    ]
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Unauthenticated. Use Accept: application/json for JSON errors.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "required": [
                                        "message"
                                    ],
                                    "properties": {
                                        "message": {
                                            "type": "string",
                                            "example": "Unauthenticated."
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "Access denied.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "anyOf": [
                                        {
                                            "required": [
                                                "status",
                                                "message"
                                            ],
                                            "properties": {
                                                "status": {
                                                    "type": "string",
                                                    "enum": [
                                                        "error"
                                                    ]
                                                },
                                                "message": {
                                                    "type": "string",
                                                    "example": "You are not authorized for this operation (templates:write)"
                                                }
                                            },
                                            "type": "object"
                                        },
                                        {
                                            "required": [
                                                "message"
                                            ],
                                            "properties": {
                                                "message": {
                                                    "type": "string",
                                                    "example": "Access denied from this IP address."
                                                }
                                            },
                                            "type": "object"
                                        },
                                        {
                                            "required": [
                                                "error"
                                            ],
                                            "properties": {
                                                "error": {
                                                    "type": "string"
                                                }
                                            },
                                            "type": "object"
                                        }
                                    ]
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "Template or field not found.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/AgentTemplateRawError"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "Too many requests.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "required": [
                                        "status",
                                        "message"
                                    ],
                                    "properties": {
                                        "status": {
                                            "type": "string",
                                            "enum": [
                                                "error"
                                            ]
                                        },
                                        "message": {
                                            "type": "string"
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "Operation failed.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/AgentTemplateError"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "sanctum": []
                    }
                ]
            }
        },
        "/api/agent/templates/{id}/fields": {
            "get": {
                "tags": [
                    "Templates"
                ],
                "summary": "List template fields",
                "description": "Lists the fields in a template. Requires templates:read.",
                "operationId": "indexFields",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Successful operation.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "required": [
                                        "data"
                                    ],
                                    "properties": {
                                        "data": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/AgentTemplateListedField"
                                            }
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Unauthenticated. Use Accept: application/json for JSON errors.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "required": [
                                        "message"
                                    ],
                                    "properties": {
                                        "message": {
                                            "type": "string",
                                            "example": "Unauthenticated."
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "Access denied.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "anyOf": [
                                        {
                                            "required": [
                                                "status",
                                                "message"
                                            ],
                                            "properties": {
                                                "status": {
                                                    "type": "string",
                                                    "enum": [
                                                        "error"
                                                    ]
                                                },
                                                "message": {
                                                    "type": "string",
                                                    "example": "You are not authorized for this operation (templates:read)"
                                                }
                                            },
                                            "type": "object"
                                        },
                                        {
                                            "required": [
                                                "message"
                                            ],
                                            "properties": {
                                                "message": {
                                                    "type": "string",
                                                    "example": "Access denied from this IP address."
                                                }
                                            },
                                            "type": "object"
                                        },
                                        {
                                            "required": [
                                                "error"
                                            ],
                                            "properties": {
                                                "error": {
                                                    "type": "string"
                                                }
                                            },
                                            "type": "object"
                                        }
                                    ]
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "Too many requests.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "required": [
                                        "status",
                                        "message"
                                    ],
                                    "properties": {
                                        "status": {
                                            "type": "string",
                                            "enum": [
                                                "error"
                                            ]
                                        },
                                        "message": {
                                            "type": "string"
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "sanctum": []
                    }
                ]
            },
            "post": {
                "tags": [
                    "Templates"
                ],
                "summary": "Add a template field",
                "description": "Adds a field to a template. Requires templates:write.",
                "operationId": "storeField",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "required": [
                                    "field_title",
                                    "field_type"
                                ],
                                "properties": {
                                    "field_title": {
                                        "description": "Label of the field",
                                        "type": "string"
                                    },
                                    "field_type": {
                                        "description": "Field type name or numeric code.",
                                        "oneOf": [
                                            {
                                                "type": "string",
                                                "example": "text"
                                            },
                                            {
                                                "type": "integer",
                                                "example": 1
                                            }
                                        ]
                                    },
                                    "options": {
                                        "description": "Required for select and recipient_select. Choices as text lines or an array.",
                                        "oneOf": [
                                            {
                                                "type": "string"
                                            },
                                            {
                                                "type": "array",
                                                "items": {
                                                    "type": "string"
                                                }
                                            }
                                        ]
                                    }
                                },
                                "type": "object"
                            },
                            "examples": {
                                "text": {
                                    "summary": "Single-line text field",
                                    "value": {
                                        "field_title": "Full Name",
                                        "field_type": "text"
                                    }
                                },
                                "textarea": {
                                    "summary": "Multi-line text box",
                                    "value": {
                                        "field_title": "Comments",
                                        "field_type": "textarea"
                                    }
                                },
                                "attachment": {
                                    "summary": "Attachment (png, jpg, jpeg)",
                                    "value": {
                                        "field_title": "ID Card Scan",
                                        "field_type": "attachment"
                                    }
                                },
                                "recipient_input": {
                                    "summary": "Filled by receiving party",
                                    "value": {
                                        "field_title": "Recipient Name",
                                        "field_type": "recipient_input"
                                    }
                                },
                                "recipient_attachment": {
                                    "summary": "Attachment filled by receiving party",
                                    "value": {
                                        "field_title": "Signed Doc",
                                        "field_type": "recipient_attachment"
                                    }
                                },
                                "heading": {
                                    "summary": "Heading",
                                    "value": {
                                        "field_title": "Personal Details",
                                        "field_type": "heading"
                                    }
                                },
                                "separator": {
                                    "summary": "Separator line",
                                    "value": {
                                        "field_title": "Separator",
                                        "field_type": "separator"
                                    }
                                },
                                "checkbox": {
                                    "summary": "Checkbox field",
                                    "value": {
                                        "field_title": "I agree",
                                        "field_type": "checkbox"
                                    }
                                },
                                "select": {
                                    "summary": "Dropdown list",
                                    "value": {
                                        "field_title": "Choose Color",
                                        "field_type": "select",
                                        "options": "Red\\nGreen\\nBlue"
                                    }
                                },
                                "recipient_select": {
                                    "summary": "Dropdown list filled by receiving party",
                                    "value": {
                                        "field_title": "Payment Method",
                                        "field_type": "recipient_select",
                                        "options": "Card\\nCash"
                                    }
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Successful operation.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "required": [
                                        "data"
                                    ],
                                    "properties": {
                                        "data": {
                                            "required": [
                                                "field"
                                            ],
                                            "properties": {
                                                "field": {
                                                    "$ref": "#/components/schemas/AgentTemplateSavedField"
                                                }
                                            },
                                            "type": "object"
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Unauthenticated. Use Accept: application/json for JSON errors.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "required": [
                                        "message"
                                    ],
                                    "properties": {
                                        "message": {
                                            "type": "string",
                                            "example": "Unauthenticated."
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "Access denied.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "anyOf": [
                                        {
                                            "required": [
                                                "status",
                                                "message"
                                            ],
                                            "properties": {
                                                "status": {
                                                    "type": "string",
                                                    "enum": [
                                                        "error"
                                                    ]
                                                },
                                                "message": {
                                                    "type": "string",
                                                    "example": "You are not authorized for this operation (templates:write)"
                                                }
                                            },
                                            "type": "object"
                                        },
                                        {
                                            "required": [
                                                "message"
                                            ],
                                            "properties": {
                                                "message": {
                                                    "type": "string",
                                                    "example": "Access denied from this IP address."
                                                }
                                            },
                                            "type": "object"
                                        },
                                        {
                                            "required": [
                                                "error"
                                            ],
                                            "properties": {
                                                "error": {
                                                    "type": "string"
                                                }
                                            },
                                            "type": "object"
                                        }
                                    ]
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "Invalid field details.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/AgentTemplateFieldValidationError"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "Too many requests.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "required": [
                                        "status",
                                        "message"
                                    ],
                                    "properties": {
                                        "status": {
                                            "type": "string",
                                            "enum": [
                                                "error"
                                            ]
                                        },
                                        "message": {
                                            "type": "string"
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "Operation failed.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/AgentTemplateError"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "sanctum": []
                    }
                ]
            }
        },
        "/api/agent/templates/{id}/fields/{field_id}": {
            "put": {
                "tags": [
                    "Templates"
                ],
                "summary": "Update a template field",
                "description": "Updates a field in a template. Requires templates:write.",
                "operationId": "updateField",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "field_id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "required": [
                                    "field_title",
                                    "field_type"
                                ],
                                "properties": {
                                    "field_title": {
                                        "description": "Label of the field",
                                        "type": "string"
                                    },
                                    "field_type": {
                                        "description": "Field type name or numeric code.",
                                        "oneOf": [
                                            {
                                                "type": "string",
                                                "example": "text"
                                            },
                                            {
                                                "type": "integer",
                                                "example": 1
                                            }
                                        ]
                                    },
                                    "options": {
                                        "description": "Required for select and recipient_select. Choices as text lines or an array.",
                                        "oneOf": [
                                            {
                                                "type": "string"
                                            },
                                            {
                                                "type": "array",
                                                "items": {
                                                    "type": "string"
                                                }
                                            }
                                        ]
                                    }
                                },
                                "type": "object"
                            },
                            "examples": {
                                "text": {
                                    "summary": "Single-line text field",
                                    "value": {
                                        "field_title": "Full Name",
                                        "field_type": "text"
                                    }
                                },
                                "textarea": {
                                    "summary": "Multi-line text box",
                                    "value": {
                                        "field_title": "Comments",
                                        "field_type": "textarea"
                                    }
                                },
                                "attachment": {
                                    "summary": "Attachment (png, jpg, jpeg)",
                                    "value": {
                                        "field_title": "ID Card Scan",
                                        "field_type": "attachment"
                                    }
                                },
                                "recipient_input": {
                                    "summary": "Filled by receiving party",
                                    "value": {
                                        "field_title": "Recipient Name",
                                        "field_type": "recipient_input"
                                    }
                                },
                                "recipient_attachment": {
                                    "summary": "Attachment filled by receiving party",
                                    "value": {
                                        "field_title": "Signed Doc",
                                        "field_type": "recipient_attachment"
                                    }
                                },
                                "heading": {
                                    "summary": "Heading",
                                    "value": {
                                        "field_title": "Personal Details",
                                        "field_type": "heading"
                                    }
                                },
                                "separator": {
                                    "summary": "Separator line",
                                    "value": {
                                        "field_title": "Separator",
                                        "field_type": "separator"
                                    }
                                },
                                "checkbox": {
                                    "summary": "Checkbox field",
                                    "value": {
                                        "field_title": "I agree",
                                        "field_type": "checkbox"
                                    }
                                },
                                "select": {
                                    "summary": "Dropdown list",
                                    "value": {
                                        "field_title": "Choose Color",
                                        "field_type": "select",
                                        "options": "Red\\nGreen\\nBlue"
                                    }
                                },
                                "recipient_select": {
                                    "summary": "Dropdown list filled by receiving party",
                                    "value": {
                                        "field_title": "Payment Method",
                                        "field_type": "recipient_select",
                                        "options": "Card\\nCash"
                                    }
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Successful operation.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "required": [
                                        "data"
                                    ],
                                    "properties": {
                                        "data": {
                                            "required": [
                                                "field"
                                            ],
                                            "properties": {
                                                "field": {
                                                    "$ref": "#/components/schemas/AgentTemplateSavedField"
                                                }
                                            },
                                            "type": "object"
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "400": {
                        "description": "Invalid request or operation not allowed.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/AgentTemplateError"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Unauthenticated. Use Accept: application/json for JSON errors.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "required": [
                                        "message"
                                    ],
                                    "properties": {
                                        "message": {
                                            "type": "string",
                                            "example": "Unauthenticated."
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "Access denied.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "anyOf": [
                                        {
                                            "required": [
                                                "status",
                                                "message"
                                            ],
                                            "properties": {
                                                "status": {
                                                    "type": "string",
                                                    "enum": [
                                                        "error"
                                                    ]
                                                },
                                                "message": {
                                                    "type": "string",
                                                    "example": "You are not authorized for this operation (templates:write)"
                                                }
                                            },
                                            "type": "object"
                                        },
                                        {
                                            "required": [
                                                "message"
                                            ],
                                            "properties": {
                                                "message": {
                                                    "type": "string",
                                                    "example": "Access denied from this IP address."
                                                }
                                            },
                                            "type": "object"
                                        },
                                        {
                                            "required": [
                                                "error"
                                            ],
                                            "properties": {
                                                "error": {
                                                    "type": "string"
                                                }
                                            },
                                            "type": "object"
                                        }
                                    ]
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "Template or field not found.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/AgentTemplateError"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "Invalid field details.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/AgentTemplateFieldValidationError"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "Too many requests.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "required": [
                                        "status",
                                        "message"
                                    ],
                                    "properties": {
                                        "status": {
                                            "type": "string",
                                            "enum": [
                                                "error"
                                            ]
                                        },
                                        "message": {
                                            "type": "string"
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "Operation failed.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/AgentTemplateError"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "sanctum": []
                    }
                ]
            },
            "delete": {
                "tags": [
                    "Templates"
                ],
                "summary": "Delete a template field",
                "description": "Deletes a field from a template. Requires templates:write.",
                "operationId": "destroyField",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "field_id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Successful operation.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "required": [
                                        "data",
                                        "message"
                                    ],
                                    "properties": {
                                        "data": {
                                            "type": "string",
                                            "nullable": true,
                                            "enum": [
                                                null
                                            ]
                                        },
                                        "message": {
                                            "type": "string",
                                            "example": "Price field successfully deleted!"
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "400": {
                        "description": "Invalid request or operation not allowed.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/AgentTemplateError"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Unauthenticated. Use Accept: application/json for JSON errors.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "required": [
                                        "message"
                                    ],
                                    "properties": {
                                        "message": {
                                            "type": "string",
                                            "example": "Unauthenticated."
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "Access denied.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "anyOf": [
                                        {
                                            "required": [
                                                "status",
                                                "message"
                                            ],
                                            "properties": {
                                                "status": {
                                                    "type": "string",
                                                    "enum": [
                                                        "error"
                                                    ]
                                                },
                                                "message": {
                                                    "type": "string",
                                                    "example": "You are not authorized for this operation (templates:write)"
                                                }
                                            },
                                            "type": "object"
                                        },
                                        {
                                            "required": [
                                                "message"
                                            ],
                                            "properties": {
                                                "message": {
                                                    "type": "string",
                                                    "example": "Access denied from this IP address."
                                                }
                                            },
                                            "type": "object"
                                        },
                                        {
                                            "required": [
                                                "error"
                                            ],
                                            "properties": {
                                                "error": {
                                                    "type": "string"
                                                }
                                            },
                                            "type": "object"
                                        }
                                    ]
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "Template or field not found.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/AgentTemplateError"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "Too many requests.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "required": [
                                        "status",
                                        "message"
                                    ],
                                    "properties": {
                                        "status": {
                                            "type": "string",
                                            "enum": [
                                                "error"
                                            ]
                                        },
                                        "message": {
                                            "type": "string"
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "Operation failed.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/AgentTemplateError"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "sanctum": []
                    }
                ]
            }
        },
        "/api/agent/templates/{id}/reorder-fields": {
            "post": {
                "tags": [
                    "Templates"
                ],
                "summary": "Reorder template fields",
                "description": "Changes the order of fields in a template. Requires templates:write.",
                "operationId": "reorderFields",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "required": [
                                    "id"
                                ],
                                "properties": {
                                    "id": {
                                        "description": "Array of field IDs in order",
                                        "type": "array",
                                        "items": {
                                            "type": "integer"
                                        }
                                    }
                                },
                                "type": "object"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Successful operation.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "required": [
                                        "data",
                                        "message"
                                    ],
                                    "properties": {
                                        "data": {
                                            "type": "string",
                                            "nullable": true,
                                            "enum": [
                                                null
                                            ]
                                        },
                                        "message": {
                                            "type": "string"
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "400": {
                        "description": "Invalid request or operation not allowed.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/AgentTemplateError"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Unauthenticated. Use Accept: application/json for JSON errors.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "required": [
                                        "message"
                                    ],
                                    "properties": {
                                        "message": {
                                            "type": "string",
                                            "example": "Unauthenticated."
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "Access denied.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "anyOf": [
                                        {
                                            "required": [
                                                "status",
                                                "message"
                                            ],
                                            "properties": {
                                                "status": {
                                                    "type": "string",
                                                    "enum": [
                                                        "error"
                                                    ]
                                                },
                                                "message": {
                                                    "type": "string",
                                                    "example": "You are not authorized for this operation (templates:write)"
                                                }
                                            },
                                            "type": "object"
                                        },
                                        {
                                            "required": [
                                                "message"
                                            ],
                                            "properties": {
                                                "message": {
                                                    "type": "string",
                                                    "example": "Access denied from this IP address."
                                                }
                                            },
                                            "type": "object"
                                        },
                                        {
                                            "required": [
                                                "error"
                                            ],
                                            "properties": {
                                                "error": {
                                                    "type": "string"
                                                }
                                            },
                                            "type": "object"
                                        }
                                    ]
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "Too many requests.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "required": [
                                        "status",
                                        "message"
                                    ],
                                    "properties": {
                                        "status": {
                                            "type": "string",
                                            "enum": [
                                                "error"
                                            ]
                                        },
                                        "message": {
                                            "type": "string"
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "sanctum": []
                    }
                ]
            }
        },
        "/api/agent/3rd-party/registration": {
            "post": {
                "tags": [
                    "ThirdParty"
                ],
                "summary": "Register a partner",
                "description": "Creates a partner account and returns its login link.",
                "operationId": "thirdPartyRegister",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "required": [
                                    "partner_data"
                                ],
                                "properties": {
                                    "registration_header": {
                                        "properties": {
                                            "coupon_code": {
                                                "type": "string",
                                                "nullable": true
                                            },
                                            "clone_account": {
                                                "description": "Copy templates and branding from an existing account.",
                                                "type": "string",
                                                "nullable": true,
                                                "enum": [
                                                    "yes",
                                                    "no"
                                                ]
                                            },
                                            "cloned_account_user_id": {
                                                "description": "Source account ID. Required when clone_account is yes.",
                                                "example": 123,
                                                "oneOf": [
                                                    {
                                                        "type": "integer"
                                                    },
                                                    {
                                                        "type": "string"
                                                    }
                                                ]
                                            },
                                            "cloned_account_secret_key": {
                                                "description": "Source account secret key. Required when clone_account is yes.",
                                                "type": "string"
                                            }
                                        },
                                        "type": "object"
                                    },
                                    "partner_data": {
                                        "required": [
                                            "partner_type",
                                            "email",
                                            "signatory_name"
                                        ],
                                        "properties": {
                                            "partner_type": {
                                                "description": "1: Individual; 2: Company.",
                                                "oneOf": [
                                                    {
                                                        "type": "integer",
                                                        "enum": [
                                                            1,
                                                            2
                                                        ]
                                                    },
                                                    {
                                                        "type": "string",
                                                        "enum": [
                                                            "1",
                                                            "2"
                                                        ]
                                                    }
                                                ]
                                            },
                                            "email": {
                                                "description": "Email address for the new account.",
                                                "type": "string",
                                                "format": "email"
                                            },
                                            "signatory_name": {
                                                "type": "string"
                                            },
                                            "phone_number": {
                                                "description": "Required for individuals.",
                                                "type": "string"
                                            },
                                            "address": {
                                                "description": "Required for individuals.",
                                                "type": "string"
                                            },
                                            "mothers_name": {
                                                "description": "Required for individuals.",
                                                "type": "string"
                                            },
                                            "birthday": {
                                                "description": "Required for individuals.",
                                                "type": "string"
                                            },
                                            "place_of_birth": {
                                                "description": "Required for individuals.",
                                                "type": "string"
                                            },
                                            "company_name": {
                                                "description": "Required for companies.",
                                                "type": "string"
                                            },
                                            "company_tax_number": {
                                                "description": "Required for companies.",
                                                "type": "string"
                                            },
                                            "company_registered_office": {
                                                "description": "Required for companies.",
                                                "type": "string"
                                            },
                                            "language": {
                                                "type": "string",
                                                "nullable": true,
                                                "default": "hu",
                                                "maxLength": 2
                                            }
                                        },
                                        "type": "object",
                                        "oneOf": [
                                            {
                                                "required": [
                                                    "phone_number",
                                                    "address",
                                                    "mothers_name",
                                                    "birthday",
                                                    "place_of_birth"
                                                ],
                                                "properties": {
                                                    "partner_type": {
                                                        "enum": [
                                                            1,
                                                            "1"
                                                        ]
                                                    }
                                                },
                                                "type": "object"
                                            },
                                            {
                                                "required": [
                                                    "company_name",
                                                    "company_tax_number",
                                                    "company_registered_office"
                                                ],
                                                "properties": {
                                                    "partner_type": {
                                                        "enum": [
                                                            2,
                                                            "2"
                                                        ]
                                                    }
                                                },
                                                "type": "object"
                                            }
                                        ]
                                    }
                                },
                                "type": "object"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Partner registered.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "required": [
                                        "user_id",
                                        "otp_link",
                                        "subscription_expiry_date",
                                        "timestamps"
                                    ],
                                    "properties": {
                                        "user_id": {
                                            "type": "integer",
                                            "example": 123
                                        },
                                        "otp_link": {
                                            "type": "string",
                                            "format": "uri",
                                            "example": "https://example.com/otp/token/123"
                                        },
                                        "subscription_expiry_date": {
                                            "description": "Subscription expiry date.",
                                            "type": "string",
                                            "example": null,
                                            "nullable": true
                                        },
                                        "timestamps": {
                                            "description": "Available timestamp credits.",
                                            "type": "string",
                                            "example": "0"
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "400": {
                        "description": "Invalid registration details, coupon, or account cloning credentials.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "required": [
                                        "status",
                                        "message"
                                    ],
                                    "properties": {
                                        "status": {
                                            "type": "string",
                                            "enum": [
                                                "error"
                                            ]
                                        },
                                        "message": {
                                            "description": "Validation message, the-user-already-exists, incomplete-registration-fields, non-existent-coupon, or incorrect-clode-account-userid-or-secretkey.",
                                            "type": "string",
                                            "example": "the-user-already-exists"
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Unauthenticated.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "required": [
                                        "message"
                                    ],
                                    "properties": {
                                        "message": {
                                            "type": "string",
                                            "example": "Unauthenticated."
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "Requires active membership, third-party access, and the 3rd-party:registration ability. Access may also be blocked by IP restrictions.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "anyOf": [
                                        {
                                            "required": [
                                                "status",
                                                "message"
                                            ],
                                            "properties": {
                                                "status": {
                                                    "type": "string",
                                                    "enum": [
                                                        "error"
                                                    ]
                                                },
                                                "message": {
                                                    "type": "string",
                                                    "example": "Nincs API jogosultsága! (Missing 3rd-party:registration)",
                                                    "enum": [
                                                        "Nincs aktív tagság! - Nem tud beküldeni API-t, mert nem aktív az előfizetése.",
                                                        "Nem engedélyezett művelet! (Missing _3rt_api)",
                                                        "Nincs API jogosultsága! (Missing 3rd-party:registration)"
                                                    ]
                                                }
                                            },
                                            "type": "object"
                                        },
                                        {
                                            "required": [
                                                "message"
                                            ],
                                            "properties": {
                                                "message": {
                                                    "type": "string",
                                                    "example": "Access denied from this IP address."
                                                }
                                            },
                                            "type": "object"
                                        },
                                        {
                                            "required": [
                                                "error"
                                            ],
                                            "properties": {
                                                "error": {
                                                    "description": "Localized access denial message.",
                                                    "type": "string"
                                                }
                                            },
                                            "type": "object"
                                        }
                                    ]
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "Too many requests.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "required": [
                                        "status",
                                        "message"
                                    ],
                                    "properties": {
                                        "status": {
                                            "type": "string",
                                            "enum": [
                                                "error"
                                            ]
                                        },
                                        "message": {
                                            "description": "Localized rate limit message.",
                                            "type": "string"
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "sanctum": []
                    }
                ]
            }
        },
        "/api/agent/3rd-party/otp": {
            "post": {
                "tags": [
                    "ThirdParty"
                ],
                "summary": "Create a login link",
                "description": "Creates a login link for a user.",
                "operationId": "thirdPartyOtp",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "required": [
                                    "otp_account_user_id"
                                ],
                                "properties": {
                                    "otp_account_user_id": {
                                        "description": "User to generate a login link for.",
                                        "example": 123,
                                        "oneOf": [
                                            {
                                                "type": "integer"
                                            },
                                            {
                                                "type": "string"
                                            }
                                        ]
                                    },
                                    "otp_link_key": {
                                        "description": "Optional verification key.",
                                        "type": "string",
                                        "nullable": true
                                    },
                                    "contract_identifier": {
                                        "description": "Optional contract to open after login.",
                                        "type": "string",
                                        "nullable": true
                                    }
                                },
                                "type": "object"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Login link created.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "required": [
                                        "user_id",
                                        "otp_link",
                                        "subscription_expiry_date",
                                        "timestamps"
                                    ],
                                    "properties": {
                                        "user_id": {
                                            "type": "integer",
                                            "example": 123
                                        },
                                        "otp_link": {
                                            "type": "string",
                                            "format": "uri",
                                            "example": "https://example.com/otp/token/123"
                                        },
                                        "subscription_expiry_date": {
                                            "description": "Subscription expiry date.",
                                            "type": "string",
                                            "example": null,
                                            "nullable": true
                                        },
                                        "timestamps": {
                                            "description": "Available timestamp credits.",
                                            "type": "integer",
                                            "example": 0
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "400": {
                        "description": "Missing or unknown user ID, or invalid verification key.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "required": [
                                        "status",
                                        "message"
                                    ],
                                    "properties": {
                                        "status": {
                                            "type": "string",
                                            "enum": [
                                                "error"
                                            ]
                                        },
                                        "message": {
                                            "type": "string",
                                            "example": "incorrect-otp-account-userid"
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Unauthenticated.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "required": [
                                        "message"
                                    ],
                                    "properties": {
                                        "message": {
                                            "type": "string",
                                            "example": "Unauthenticated."
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "Requires active membership, third-party access, and the 3rd-party:otp ability. Access may also be blocked by IP restrictions.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "anyOf": [
                                        {
                                            "required": [
                                                "status",
                                                "message"
                                            ],
                                            "properties": {
                                                "status": {
                                                    "type": "string",
                                                    "enum": [
                                                        "error"
                                                    ]
                                                },
                                                "message": {
                                                    "type": "string",
                                                    "example": "Nincs API jogosultsága! (Missing 3rd-party:otp)",
                                                    "enum": [
                                                        "Nincs aktív tagság! - Nem tud beküldeni API-t, mert nem aktív az előfizetése.",
                                                        "Nem engedélyezett művelet!",
                                                        "Nincs API jogosultsága! (Missing 3rd-party:otp)"
                                                    ]
                                                }
                                            },
                                            "type": "object"
                                        },
                                        {
                                            "required": [
                                                "message"
                                            ],
                                            "properties": {
                                                "message": {
                                                    "type": "string",
                                                    "example": "Access denied from this IP address."
                                                }
                                            },
                                            "type": "object"
                                        },
                                        {
                                            "required": [
                                                "error"
                                            ],
                                            "properties": {
                                                "error": {
                                                    "description": "Localized access denial message.",
                                                    "type": "string"
                                                }
                                            },
                                            "type": "object"
                                        }
                                    ]
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "Too many requests.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "required": [
                                        "status",
                                        "message"
                                    ],
                                    "properties": {
                                        "status": {
                                            "type": "string",
                                            "enum": [
                                                "error"
                                            ]
                                        },
                                        "message": {
                                            "description": "Localized rate limit message.",
                                            "type": "string"
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "sanctum": []
                    }
                ]
            }
        },
        "/api/agent/user-info": {
            "get": {
                "tags": [
                    "Users"
                ],
                "summary": "Get user information",
                "description": "Returns your profile, membership, credits, and branding settings.",
                "operationId": "userInfo",
                "responses": {
                    "200": {
                        "description": "User information returned.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "required": [
                                        "data"
                                    ],
                                    "properties": {
                                        "data": {
                                            "$ref": "#/components/schemas/UserInfo"
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Unauthenticated.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "required": [
                                        "message"
                                    ],
                                    "properties": {
                                        "message": {
                                            "type": "string",
                                            "example": "Unauthenticated."
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "Requires user:read. Access may also be blocked by IP restrictions.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "anyOf": [
                                        {
                                            "required": [
                                                "status",
                                                "message"
                                            ],
                                            "properties": {
                                                "status": {
                                                    "type": "string",
                                                    "enum": [
                                                        "error"
                                                    ]
                                                },
                                                "message": {
                                                    "type": "string",
                                                    "example": "You are not authorized for this operation (user:read)"
                                                }
                                            },
                                            "type": "object"
                                        },
                                        {
                                            "required": [
                                                "message"
                                            ],
                                            "properties": {
                                                "message": {
                                                    "type": "string",
                                                    "example": "Access denied from this IP address."
                                                }
                                            },
                                            "type": "object"
                                        },
                                        {
                                            "required": [
                                                "error"
                                            ],
                                            "properties": {
                                                "error": {
                                                    "description": "Localized access denial message.",
                                                    "type": "string"
                                                }
                                            },
                                            "type": "object"
                                        }
                                    ]
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "Too many requests.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "required": [
                                        "status",
                                        "message"
                                    ],
                                    "properties": {
                                        "status": {
                                            "type": "string",
                                            "enum": [
                                                "error"
                                            ]
                                        },
                                        "message": {
                                            "description": "Localized rate limit message.",
                                            "type": "string"
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "sanctum": []
                    }
                ]
            }
        },
        "/api/agent/user/branding": {
            "post": {
                "tags": [
                    "Users"
                ],
                "summary": "Update account branding",
                "description": "Updates your account’s contract and email branding.",
                "operationId": "updateBranding",
                "requestBody": {
                    "required": false,
                    "content": {
                        "multipart/form-data": {
                            "schema": {
                                "properties": {
                                    "contract_header_logo": {
                                        "description": "Header logo: PNG, BMP, or JPEG, up to 200 KB.",
                                        "type": "string",
                                        "format": "binary",
                                        "nullable": true
                                    },
                                    "contract_email_header_image": {
                                        "description": "Email header image: PNG, BMP, or JPEG, up to 200 KB.",
                                        "type": "string",
                                        "format": "binary",
                                        "nullable": true
                                    },
                                    "contract_background_image": {
                                        "description": "Contract background image: PNG, BMP, or JPEG, up to 300 KB.",
                                        "type": "string",
                                        "format": "binary",
                                        "nullable": true
                                    },
                                    "contract_header_logo_enabled": {
                                        "type": "boolean"
                                    },
                                    "contract_style_enabled": {
                                        "type": "boolean"
                                    },
                                    "contract_email_heading_enabled": {
                                        "type": "boolean"
                                    },
                                    "contract_email_edit_enabled": {
                                        "type": "boolean"
                                    },
                                    "contract_header_color": {
                                        "type": "string",
                                        "pattern": "^#(?:[0-9a-fA-F]{3}){1,2}$",
                                        "example": "#ffffff",
                                        "nullable": true
                                    },
                                    "contract_email_background_color": {
                                        "type": "string",
                                        "pattern": "^#(?:[0-9a-fA-F]{3}){1,2}$",
                                        "example": "#ffffff",
                                        "nullable": true
                                    },
                                    "contract_background_color": {
                                        "type": "string",
                                        "pattern": "^#(?:[0-9a-fA-F]{3}){1,2}$",
                                        "example": "#ffffff",
                                        "nullable": true
                                    },
                                    "contract_background_position": {
                                        "type": "integer",
                                        "nullable": true,
                                        "enum": [
                                            0,
                                            1,
                                            2,
                                            3,
                                            4,
                                            null
                                        ]
                                    },
                                    "email_text": {
                                        "type": "string",
                                        "nullable": true,
                                        "maxLength": 5000
                                    },
                                    "contract_header_logo_url": {
                                        "description": "Header logo URL. An uploaded logo takes priority.",
                                        "type": "string",
                                        "format": "uri",
                                        "nullable": true,
                                        "maxLength": 1000
                                    }
                                },
                                "type": "object"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Branding updated.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "required": [
                                        "data",
                                        "message"
                                    ],
                                    "properties": {
                                        "data": {
                                            "type": "string",
                                            "nullable": true,
                                            "enum": [
                                                null
                                            ]
                                        },
                                        "message": {
                                            "type": "string",
                                            "example": "Branding updated successfully"
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "400": {
                        "description": "Invalid branding settings or image upload.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "required": [
                                        "status",
                                        "message"
                                    ],
                                    "properties": {
                                        "status": {
                                            "type": "string",
                                            "enum": [
                                                "error"
                                            ]
                                        },
                                        "message": {
                                            "type": "string",
                                            "example": "The email text must not be greater than 5000 characters."
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Unauthenticated.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "required": [
                                        "message"
                                    ],
                                    "properties": {
                                        "message": {
                                            "type": "string",
                                            "example": "Unauthenticated."
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "Requires user:write and permission to edit branding. Access may also be blocked by IP restrictions.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "anyOf": [
                                        {
                                            "required": [
                                                "status",
                                                "message"
                                            ],
                                            "properties": {
                                                "status": {
                                                    "type": "string",
                                                    "enum": [
                                                        "error"
                                                    ]
                                                },
                                                "message": {
                                                    "type": "string",
                                                    "example": "You are not authorized for this operation (user:write)"
                                                }
                                            },
                                            "type": "object"
                                        },
                                        {
                                            "required": [
                                                "status",
                                                "message"
                                            ],
                                            "properties": {
                                                "status": {
                                                    "type": "string",
                                                    "enum": [
                                                        "error"
                                                    ]
                                                },
                                                "message": {
                                                    "type": "string",
                                                    "example": "You do not have permission to modify branding settings."
                                                }
                                            },
                                            "type": "object"
                                        },
                                        {
                                            "required": [
                                                "message"
                                            ],
                                            "properties": {
                                                "message": {
                                                    "type": "string",
                                                    "example": "Access denied from this IP address."
                                                }
                                            },
                                            "type": "object"
                                        },
                                        {
                                            "required": [
                                                "error"
                                            ],
                                            "properties": {
                                                "error": {
                                                    "description": "Localized access denial message.",
                                                    "type": "string"
                                                }
                                            },
                                            "type": "object"
                                        }
                                    ]
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "Too many requests.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "required": [
                                        "status",
                                        "message"
                                    ],
                                    "properties": {
                                        "status": {
                                            "type": "string",
                                            "enum": [
                                                "error"
                                            ]
                                        },
                                        "message": {
                                            "description": "Localized rate limit message.",
                                            "type": "string"
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "Could not save branding settings.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "required": [
                                        "status",
                                        "message"
                                    ],
                                    "properties": {
                                        "status": {
                                            "type": "string",
                                            "enum": [
                                                "error"
                                            ]
                                        },
                                        "message": {
                                            "type": "string",
                                            "example": "Error on save"
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "sanctum": []
                    }
                ]
            }
        },
        "/api/agent/webhooks": {
            "get": {
                "tags": [
                    "Webhooks"
                ],
                "summary": "List webhook subscriptions",
                "description": "Lists your active webhook subscriptions.",
                "operationId": "listWebhooks",
                "responses": {
                    "200": {
                        "description": "Active webhook subscriptions, or an empty list.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "required": [
                                        "data"
                                    ],
                                    "properties": {
                                        "data": {
                                            "type": "array",
                                            "items": {
                                                "required": [
                                                    "id",
                                                    "url",
                                                    "events",
                                                    "created_at"
                                                ],
                                                "properties": {
                                                    "id": {
                                                        "type": "integer",
                                                        "example": 42
                                                    },
                                                    "url": {
                                                        "type": "string",
                                                        "format": "uri",
                                                        "example": "https://example.com/webhook"
                                                    },
                                                    "events": {
                                                        "description": "Subscribed events. An asterisk means all events; an empty array means none.",
                                                        "type": "array",
                                                        "items": {
                                                            "type": "string",
                                                            "enum": [
                                                                "contract_signed",
                                                                "contract_viewed",
                                                                "contract_created",
                                                                "email_delivered",
                                                                "email_opened",
                                                                "email_not_delivered",
                                                                "invitation_accepted",
                                                                "invitation_declined",
                                                                "approval_approved",
                                                                "approval_declined",
                                                                "approval_revoked",
                                                                "*"
                                                            ]
                                                        },
                                                        "nullable": true
                                                    },
                                                    "created_at": {
                                                        "type": "string",
                                                        "format": "date-time",
                                                        "example": "2026-09-14T10:00:00.000000Z",
                                                        "nullable": true
                                                    }
                                                },
                                                "type": "object"
                                            }
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Unauthenticated.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "required": [
                                        "message"
                                    ],
                                    "properties": {
                                        "message": {
                                            "type": "string",
                                            "example": "Unauthenticated."
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "Access blocked by IP restrictions.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "anyOf": [
                                        {
                                            "required": [
                                                "message"
                                            ],
                                            "properties": {
                                                "message": {
                                                    "type": "string",
                                                    "example": "Access denied from this IP address."
                                                }
                                            },
                                            "type": "object"
                                        },
                                        {
                                            "required": [
                                                "error"
                                            ],
                                            "properties": {
                                                "error": {
                                                    "description": "Localized access denial message.",
                                                    "type": "string"
                                                }
                                            },
                                            "type": "object"
                                        }
                                    ]
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "Too many requests.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "required": [
                                        "status",
                                        "message"
                                    ],
                                    "properties": {
                                        "status": {
                                            "type": "string",
                                            "enum": [
                                                "error"
                                            ]
                                        },
                                        "message": {
                                            "description": "Localized rate limit message.",
                                            "type": "string"
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "sanctum": []
                    }
                ]
            },
            "post": {
                "tags": [
                    "Webhooks"
                ],
                "summary": "Register or update a webhook",
                "description": "Registers a webhook or updates its subscribed events.",
                "operationId": "registerWebhook",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "required": [
                                    "url"
                                ],
                                "properties": {
                                    "url": {
                                        "description": "Webhook URL to receive events.",
                                        "type": "string",
                                        "format": "uri",
                                        "maxLength": 500
                                    },
                                    "events": {
                                        "description": "Omit or send null for all events. Send an empty array for no events.",
                                        "type": "array",
                                        "items": {
                                            "type": "string",
                                            "enum": [
                                                "contract_signed",
                                                "contract_viewed",
                                                "contract_created",
                                                "email_delivered",
                                                "email_opened",
                                                "email_not_delivered",
                                                "invitation_accepted",
                                                "invitation_declined",
                                                "approval_approved",
                                                "approval_declined",
                                                "approval_revoked"
                                            ]
                                        },
                                        "nullable": true
                                    }
                                },
                                "type": "object"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Webhook registered or updated.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "anyOf": [
                                        {
                                            "required": [
                                                "data",
                                                "message"
                                            ],
                                            "properties": {
                                                "data": {
                                                    "required": [
                                                        "id",
                                                        "url",
                                                        "events"
                                                    ],
                                                    "properties": {
                                                        "id": {
                                                            "type": "integer",
                                                            "example": 42
                                                        },
                                                        "url": {
                                                            "type": "string",
                                                            "format": "uri",
                                                            "example": "https://example.com/webhook"
                                                        },
                                                        "events": {
                                                            "description": "Subscribed events. An asterisk means all events; an empty array means none.",
                                                            "type": "array",
                                                            "items": {
                                                                "type": "string",
                                                                "enum": [
                                                                    "contract_signed",
                                                                    "contract_viewed",
                                                                    "contract_created",
                                                                    "email_delivered",
                                                                    "email_opened",
                                                                    "email_not_delivered",
                                                                    "invitation_accepted",
                                                                    "invitation_declined",
                                                                    "approval_approved",
                                                                    "approval_declined",
                                                                    "approval_revoked",
                                                                    "*"
                                                                ]
                                                            }
                                                        }
                                                    },
                                                    "type": "object"
                                                },
                                                "message": {
                                                    "type": "string",
                                                    "enum": [
                                                        "Webhook registered successfully"
                                                    ]
                                                }
                                            },
                                            "type": "object"
                                        },
                                        {
                                            "required": [
                                                "data",
                                                "message"
                                            ],
                                            "properties": {
                                                "data": {
                                                    "required": [
                                                        "id",
                                                        "url",
                                                        "events",
                                                        "user_id",
                                                        "is_active",
                                                        "failure_count",
                                                        "last_triggered_at",
                                                        "created_at",
                                                        "updated_at"
                                                    ],
                                                    "properties": {
                                                        "id": {
                                                            "type": "integer",
                                                            "example": 42
                                                        },
                                                        "url": {
                                                            "type": "string",
                                                            "format": "uri",
                                                            "example": "https://example.com/webhook"
                                                        },
                                                        "events": {
                                                            "description": "Subscribed events. An asterisk means all events; an empty array means none.",
                                                            "type": "array",
                                                            "items": {
                                                                "type": "string",
                                                                "enum": [
                                                                    "contract_signed",
                                                                    "contract_viewed",
                                                                    "contract_created",
                                                                    "email_delivered",
                                                                    "email_opened",
                                                                    "email_not_delivered",
                                                                    "invitation_accepted",
                                                                    "invitation_declined",
                                                                    "approval_approved",
                                                                    "approval_declined",
                                                                    "approval_revoked",
                                                                    "*"
                                                                ]
                                                            }
                                                        },
                                                        "user_id": {
                                                            "type": "integer",
                                                            "example": 123
                                                        },
                                                        "is_active": {
                                                            "type": "boolean",
                                                            "enum": [
                                                                true
                                                            ]
                                                        },
                                                        "failure_count": {
                                                            "type": "integer",
                                                            "example": 0
                                                        },
                                                        "last_triggered_at": {
                                                            "type": "string",
                                                            "example": "2026-09-14 10:00:00",
                                                            "nullable": true
                                                        },
                                                        "created_at": {
                                                            "type": "string",
                                                            "format": "date-time",
                                                            "example": "2026-09-14T10:00:00.000000Z",
                                                            "nullable": true
                                                        },
                                                        "updated_at": {
                                                            "type": "string",
                                                            "format": "date-time",
                                                            "example": "2026-09-14T10:00:00.000000Z",
                                                            "nullable": true
                                                        }
                                                    },
                                                    "type": "object"
                                                },
                                                "message": {
                                                    "type": "string",
                                                    "enum": [
                                                        "Webhook updated successfully"
                                                    ]
                                                }
                                            },
                                            "type": "object"
                                        }
                                    ]
                                }
                            }
                        }
                    },
                    "400": {
                        "description": "Invalid webhook details or the limit of 10 active subscriptions reached.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "anyOf": [
                                        {
                                            "required": [
                                                "status",
                                                "message"
                                            ],
                                            "properties": {
                                                "status": {
                                                    "type": "string",
                                                    "enum": [
                                                        "error"
                                                    ]
                                                },
                                                "message": {
                                                    "description": "Validation errors keyed by field, such as url or events.0.",
                                                    "type": "object",
                                                    "additionalProperties": {
                                                        "type": "array",
                                                        "items": {
                                                            "type": "string"
                                                        }
                                                    }
                                                }
                                            },
                                            "type": "object"
                                        },
                                        {
                                            "required": [
                                                "status",
                                                "message"
                                            ],
                                            "properties": {
                                                "status": {
                                                    "type": "string",
                                                    "enum": [
                                                        "error"
                                                    ]
                                                },
                                                "message": {
                                                    "type": "string",
                                                    "example": "Maximum 10 webhook subscriptions allowed per user."
                                                }
                                            },
                                            "type": "object"
                                        }
                                    ]
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Unauthenticated.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "required": [
                                        "message"
                                    ],
                                    "properties": {
                                        "message": {
                                            "type": "string",
                                            "example": "Unauthenticated."
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "Access blocked by IP restrictions.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "anyOf": [
                                        {
                                            "required": [
                                                "message"
                                            ],
                                            "properties": {
                                                "message": {
                                                    "type": "string",
                                                    "example": "Access denied from this IP address."
                                                }
                                            },
                                            "type": "object"
                                        },
                                        {
                                            "required": [
                                                "error"
                                            ],
                                            "properties": {
                                                "error": {
                                                    "description": "Localized access denial message.",
                                                    "type": "string"
                                                }
                                            },
                                            "type": "object"
                                        }
                                    ]
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "Too many requests.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "required": [
                                        "status",
                                        "message"
                                    ],
                                    "properties": {
                                        "status": {
                                            "type": "string",
                                            "enum": [
                                                "error"
                                            ]
                                        },
                                        "message": {
                                            "description": "Localized rate limit message.",
                                            "type": "string"
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "sanctum": []
                    }
                ]
            }
        },
        "/api/agent/webhooks/{id}": {
            "delete": {
                "tags": [
                    "Webhooks"
                ],
                "summary": "Deactivate a webhook",
                "description": "Stops event notifications for a webhook subscription.",
                "operationId": "deleteWebhook",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "description": "Webhook subscription ID.",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 0
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Webhook deactivated.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "required": [
                                        "data",
                                        "message"
                                    ],
                                    "properties": {
                                        "data": {
                                            "type": "string",
                                            "nullable": true,
                                            "enum": [
                                                null
                                            ]
                                        },
                                        "message": {
                                            "type": "string",
                                            "enum": [
                                                "Webhook deleted successfully"
                                            ]
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Unauthenticated.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "required": [
                                        "message"
                                    ],
                                    "properties": {
                                        "message": {
                                            "type": "string",
                                            "example": "Unauthenticated."
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "Access blocked by IP restrictions.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "anyOf": [
                                        {
                                            "required": [
                                                "message"
                                            ],
                                            "properties": {
                                                "message": {
                                                    "type": "string",
                                                    "example": "Access denied from this IP address."
                                                }
                                            },
                                            "type": "object"
                                        },
                                        {
                                            "required": [
                                                "error"
                                            ],
                                            "properties": {
                                                "error": {
                                                    "description": "Localized access denial message.",
                                                    "type": "string"
                                                }
                                            },
                                            "type": "object"
                                        }
                                    ]
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "Webhook not found in your account.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "required": [
                                        "status",
                                        "message"
                                    ],
                                    "properties": {
                                        "status": {
                                            "type": "string",
                                            "enum": [
                                                "error"
                                            ]
                                        },
                                        "message": {
                                            "type": "string",
                                            "example": "Webhook not found"
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "Too many requests.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "required": [
                                        "status",
                                        "message"
                                    ],
                                    "properties": {
                                        "status": {
                                            "type": "string",
                                            "enum": [
                                                "error"
                                            ]
                                        },
                                        "message": {
                                            "description": "Localized rate limit message.",
                                            "type": "string"
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "sanctum": []
                    }
                ]
            }
        }
    },
    "components": {
        "schemas": {
            "AgentContractStatusRecord": {
                "description": "Custom contract status details.",
                "required": [
                    "id",
                    "user_id",
                    "name",
                    "color",
                    "email_to",
                    "email_subject",
                    "email_body",
                    "created_at",
                    "updated_at"
                ],
                "properties": {
                    "id": {
                        "type": "integer",
                        "example": 12
                    },
                    "user_id": {
                        "type": "integer",
                        "nullable": true
                    },
                    "name": {
                        "type": "string",
                        "example": "Under review",
                        "nullable": true
                    },
                    "color": {
                        "type": "string",
                        "example": "#3498db",
                        "nullable": true
                    },
                    "email_to": {
                        "description": "Notification recipient email or partner position.",
                        "type": "string",
                        "nullable": true
                    },
                    "email_subject": {
                        "type": "string",
                        "nullable": true
                    },
                    "email_body": {
                        "type": "string",
                        "nullable": true
                    },
                    "is_default": {
                        "type": "boolean",
                        "nullable": true
                    },
                    "order": {
                        "description": "Display order.",
                        "type": "integer"
                    },
                    "block_contract_owner_signature": {
                        "type": "integer",
                        "enum": [
                            0,
                            1
                        ]
                    },
                    "block_sending": {
                        "type": "integer",
                        "enum": [
                            0,
                            1
                        ]
                    },
                    "is_kanban_column": {
                        "type": "integer",
                        "enum": [
                            0,
                            1
                        ]
                    },
                    "restrict_manual_transitions": {
                        "type": "boolean"
                    },
                    "allowed_manual_transition_status_ids": {
                        "type": "array",
                        "items": {
                            "type": "integer"
                        },
                        "nullable": true
                    },
                    "created_at": {
                        "type": "string",
                        "format": "date-time"
                    },
                    "updated_at": {
                        "type": "string",
                        "format": "date-time"
                    }
                },
                "type": "object"
            },
            "AgentContractStatusError": {
                "required": [
                    "status",
                    "message"
                ],
                "properties": {
                    "status": {
                        "type": "string",
                        "enum": [
                            "error"
                        ]
                    },
                    "message": {
                        "type": "string"
                    }
                },
                "type": "object"
            },
            "AgentContractStatusNestedError": {
                "required": [
                    "status",
                    "message"
                ],
                "properties": {
                    "status": {
                        "type": "string",
                        "enum": [
                            "error"
                        ]
                    },
                    "message": {
                        "required": [
                            "message"
                        ],
                        "properties": {
                            "message": {
                                "type": "string"
                            }
                        },
                        "type": "object"
                    }
                },
                "type": "object"
            },
            "AgentContractStatusValidationError": {
                "required": [
                    "status",
                    "message"
                ],
                "properties": {
                    "status": {
                        "type": "string",
                        "enum": [
                            "error"
                        ]
                    },
                    "message": {
                        "description": "Validation messages for each field.",
                        "type": "object",
                        "additionalProperties": {
                            "type": "array",
                            "items": {
                                "type": "string"
                            }
                        }
                    }
                },
                "type": "object"
            },
            "AgentCoworkerRecord": {
                "required": [
                    "id",
                    "email",
                    "name",
                    "position",
                    "create_templates",
                    "make_contract",
                    "only_draft_contract",
                    "download_orders_invoices",
                    "excel_export",
                    "integration_access",
                    "contract_branding",
                    "create_contracts",
                    "sign_contracts",
                    "permission",
                    "edit_permission",
                    "manage_internal_statuses",
                    "delete_contracts",
                    "manage_co_accounts",
                    "use_position_instead_of_delegate",
                    "permissions"
                ],
                "properties": {
                    "id": {
                        "type": "integer"
                    },
                    "email": {
                        "type": "string",
                        "format": "email"
                    },
                    "name": {
                        "type": "string",
                        "nullable": true
                    },
                    "position": {
                        "type": "string",
                        "nullable": true
                    },
                    "create_templates": {
                        "type": "integer",
                        "nullable": true
                    },
                    "make_contract": {
                        "type": "integer",
                        "nullable": true
                    },
                    "only_draft_contract": {
                        "type": "boolean",
                        "nullable": true
                    },
                    "download_orders_invoices": {
                        "type": "integer",
                        "nullable": true
                    },
                    "excel_export": {
                        "type": "integer",
                        "nullable": true
                    },
                    "integration_access": {
                        "type": "integer",
                        "nullable": true
                    },
                    "contract_branding": {
                        "type": "integer",
                        "nullable": true
                    },
                    "create_contracts": {
                        "description": "1 allows access beyond own contracts; 0 restricts access to own contracts.",
                        "type": "integer",
                        "enum": [
                            0,
                            1
                        ]
                    },
                    "sign_contracts": {
                        "type": "integer",
                        "nullable": true
                    },
                    "permission": {
                        "type": "integer",
                        "nullable": true
                    },
                    "edit_permission": {
                        "type": "integer",
                        "nullable": true
                    },
                    "manage_internal_statuses": {
                        "type": "integer",
                        "nullable": true
                    },
                    "delete_contracts": {
                        "type": "integer",
                        "nullable": true
                    },
                    "manage_co_accounts": {
                        "type": "integer",
                        "nullable": true
                    },
                    "use_position_instead_of_delegate": {
                        "type": "integer",
                        "nullable": true
                    },
                    "permissions": {
                        "description": "Assigned permission titles.",
                        "type": "array",
                        "items": {
                            "type": "string"
                        }
                    }
                },
                "type": "object"
            },
            "AgentCoworkerValidationError": {
                "required": [
                    "status",
                    "message"
                ],
                "properties": {
                    "status": {
                        "type": "string",
                        "enum": [
                            "error"
                        ]
                    },
                    "message": {
                        "type": "object",
                        "example": {
                            "email": [
                                "The email field is required."
                            ]
                        },
                        "additionalProperties": {
                            "type": "array",
                            "items": {
                                "type": "string"
                            }
                        }
                    }
                },
                "type": "object"
            },
            "ContractDetail": {
                "description": "Contract details.",
                "required": [
                    "identifier",
                    "contract_title",
                    "template_id",
                    "template_name",
                    "own_id",
                    "contract_status",
                    "inside_status",
                    "language",
                    "contract_signed",
                    "status",
                    "is_archived",
                    "download_link",
                    "number_of_participants",
                    "contract_content_raw",
                    "contract_content",
                    "reference_number",
                    "created_at",
                    "last_modification",
                    "declines",
                    "internal_approvals",
                    "parameters",
                    "partners",
                    "email_log",
                    "event_log",
                    "attachments",
                    "share_with_external",
                    "comments",
                    "invites",
                    "contract_public_url"
                ],
                "properties": {
                    "identifier": {
                        "type": "integer"
                    },
                    "contract_title": {
                        "type": "string",
                        "nullable": true
                    },
                    "template_id": {
                        "type": "string"
                    },
                    "template_name": {
                        "type": "string",
                        "nullable": true
                    },
                    "own_id": {
                        "type": "string",
                        "nullable": true
                    },
                    "contract_status": {
                        "description": "Contract status code.",
                        "type": "string",
                        "enum": [
                            "draft",
                            "contracts_awaiting_signature",
                            "contracts_awaiting_for_confirmation",
                            "signed_contracts",
                            "archived_contract",
                            "declined"
                        ]
                    },
                    "inside_status": {
                        "description": "Internal status label, or an empty string.",
                        "type": "string"
                    },
                    "language": {
                        "type": "string",
                        "nullable": true
                    },
                    "contract_signed": {
                        "description": "Signing date and time, or an empty string.",
                        "type": "string"
                    },
                    "status": {
                        "description": "Human-readable contract status.",
                        "type": "string"
                    },
                    "is_archived": {
                        "type": "boolean"
                    },
                    "download_link": {
                        "description": "Download link for a finalized contract; otherwise null. May be empty if unavailable.",
                        "type": "string",
                        "nullable": true
                    },
                    "number_of_participants": {
                        "type": "integer"
                    },
                    "contract_content_raw": {
                        "type": "string",
                        "nullable": true
                    },
                    "contract_content": {
                        "type": "string",
                        "nullable": true
                    },
                    "reference_number": {
                        "type": "string",
                        "nullable": true
                    },
                    "created_at": {
                        "type": "string"
                    },
                    "last_modification": {
                        "type": "string"
                    },
                    "declines": {
                        "type": "array",
                        "items": {
                            "$ref": "#/components/schemas/ContractDecline"
                        }
                    },
                    "internal_approvals": {
                        "type": "array",
                        "items": {
                            "$ref": "#/components/schemas/ContractInternalApproval"
                        }
                    },
                    "parameters": {
                        "type": "array",
                        "items": {
                            "$ref": "#/components/schemas/ContractParameter"
                        }
                    },
                    "partners": {
                        "type": "array",
                        "items": {
                            "$ref": "#/components/schemas/ContractPartner"
                        }
                    },
                    "email_log": {
                        "type": "array",
                        "items": {
                            "$ref": "#/components/schemas/ContractEmailLog"
                        }
                    },
                    "event_log": {
                        "type": "array",
                        "items": {
                            "$ref": "#/components/schemas/ContractEventLog"
                        }
                    },
                    "attachments": {
                        "type": "array",
                        "items": {
                            "$ref": "#/components/schemas/ContractAttachment"
                        }
                    },
                    "share_with_external": {
                        "type": "array",
                        "items": {
                            "$ref": "#/components/schemas/ContractShare"
                        }
                    },
                    "comments": {
                        "type": "array",
                        "items": {
                            "$ref": "#/components/schemas/ContractComment"
                        }
                    },
                    "invites": {
                        "description": "Invitation links when public invitations are enabled; otherwise an empty array.",
                        "type": "array",
                        "items": {
                            "$ref": "#/components/schemas/ContractInvite"
                        }
                    },
                    "contract_public_url": {
                        "description": "Whether public invitations are enabled.",
                        "type": "boolean"
                    }
                },
                "type": "object"
            },
            "ContractParameter": {
                "required": [
                    "name",
                    "data"
                ],
                "properties": {
                    "name": {
                        "type": "string",
                        "nullable": true
                    },
                    "data": {
                        "type": "string",
                        "nullable": true
                    }
                },
                "type": "object"
            },
            "ContractPartner": {
                "required": [
                    "name",
                    "client_title",
                    "personal_id_number",
                    "address",
                    "phone",
                    "company_name",
                    "company_residence",
                    "mothers_name",
                    "company_tax_number",
                    "email",
                    "birthday",
                    "place_of_birth",
                    "signing_representative"
                ],
                "properties": {
                    "name": {
                        "type": "string",
                        "nullable": true
                    },
                    "client_title": {
                        "type": "string",
                        "nullable": true
                    },
                    "personal_id_number": {
                        "type": "string",
                        "nullable": true
                    },
                    "address": {
                        "type": "string",
                        "nullable": true
                    },
                    "phone": {
                        "type": "string",
                        "nullable": true
                    },
                    "company_name": {
                        "type": "string",
                        "nullable": true
                    },
                    "company_residence": {
                        "type": "string",
                        "nullable": true
                    },
                    "mothers_name": {
                        "type": "string",
                        "nullable": true
                    },
                    "company_tax_number": {
                        "type": "string",
                        "nullable": true
                    },
                    "email": {
                        "type": "string",
                        "nullable": true
                    },
                    "birthday": {
                        "type": "string",
                        "nullable": true
                    },
                    "place_of_birth": {
                        "type": "string",
                        "nullable": true
                    },
                    "signing_representative": {
                        "description": "Representative who signed, or an empty array.",
                        "anyOf": [
                            {
                                "required": [
                                    "email",
                                    "name",
                                    "user_id"
                                ],
                                "properties": {
                                    "email": {
                                        "type": "string"
                                    },
                                    "name": {
                                        "type": "string"
                                    },
                                    "user_id": {
                                        "type": "integer"
                                    }
                                },
                                "type": "object"
                            },
                            {
                                "type": "array",
                                "items": {
                                    "type": "object"
                                },
                                "maxItems": 0
                            }
                        ]
                    }
                },
                "type": "object"
            },
            "ContractEmailLog": {
                "required": [
                    "time",
                    "who",
                    "subject",
                    "status",
                    "opened",
                    "clicked"
                ],
                "properties": {
                    "time": {
                        "type": "string"
                    },
                    "who": {
                        "type": "string",
                        "nullable": true
                    },
                    "subject": {
                        "type": "string",
                        "nullable": true
                    },
                    "status": {
                        "type": "string",
                        "nullable": true
                    },
                    "opened": {
                        "description": "Event date and time, or null.",
                        "type": "string",
                        "nullable": true
                    },
                    "clicked": {
                        "description": "Event date and time, or null.",
                        "type": "string",
                        "nullable": true
                    }
                },
                "type": "object"
            },
            "ContractEventLog": {
                "required": [
                    "time",
                    "type",
                    "event",
                    "ip",
                    "hash"
                ],
                "properties": {
                    "time": {
                        "type": "string"
                    },
                    "type": {
                        "type": "string",
                        "nullable": true
                    },
                    "event": {
                        "type": "string",
                        "nullable": true
                    },
                    "ip": {
                        "type": "string",
                        "nullable": true
                    },
                    "hash": {
                        "type": "string",
                        "nullable": true
                    }
                },
                "type": "object"
            },
            "ContractAttachment": {
                "anyOf": [
                    {
                        "required": [
                            "type",
                            "attachment_id",
                            "title",
                            "invoice_type",
                            "invoice_fulfillment_date",
                            "invoice_due_date",
                            "invoice_total",
                            "invoice_currency",
                            "access"
                        ],
                        "properties": {
                            "type": {
                                "type": "string",
                                "enum": [
                                    "invoice"
                                ]
                            },
                            "attachment_id": {
                                "type": "integer"
                            },
                            "title": {
                                "type": "string"
                            },
                            "invoice_type": {
                                "type": "string"
                            },
                            "invoice_fulfillment_date": {
                                "type": "string"
                            },
                            "invoice_due_date": {
                                "type": "string"
                            },
                            "invoice_total": {
                                "anyOf": [
                                    {
                                        "type": "string"
                                    },
                                    {
                                        "type": "number"
                                    }
                                ]
                            },
                            "invoice_currency": {
                                "type": "string"
                            },
                            "access": {
                                "type": "string",
                                "enum": [
                                    "public"
                                ]
                            }
                        },
                        "type": "object"
                    },
                    {
                        "required": [
                            "type",
                            "attachment_id",
                            "title",
                            "attachment_contract_id",
                            "contract_type",
                            "created_at",
                            "access"
                        ],
                        "properties": {
                            "type": {
                                "type": "string",
                                "enum": [
                                    "contract"
                                ]
                            },
                            "attachment_id": {
                                "type": "integer"
                            },
                            "title": {
                                "type": "string",
                                "nullable": true
                            },
                            "attachment_contract_id": {
                                "type": "integer"
                            },
                            "contract_type": {
                                "type": "string",
                                "nullable": true
                            },
                            "created_at": {
                                "type": "string"
                            },
                            "access": {
                                "type": "string",
                                "enum": [
                                    "public",
                                    "private"
                                ]
                            }
                        },
                        "type": "object"
                    },
                    {
                        "required": [
                            "type",
                            "attachment_id",
                            "title",
                            "hyperlink_type",
                            "description",
                            "link",
                            "visibility"
                        ],
                        "properties": {
                            "type": {
                                "type": "string",
                                "enum": [
                                    "hyperlink"
                                ]
                            },
                            "attachment_id": {
                                "type": "integer"
                            },
                            "title": {
                                "type": "string",
                                "nullable": true
                            },
                            "hyperlink_type": {
                                "type": "string",
                                "nullable": true
                            },
                            "description": {
                                "type": "string",
                                "nullable": true
                            },
                            "link": {
                                "type": "string",
                                "nullable": true
                            },
                            "visibility": {
                                "type": "string",
                                "enum": [
                                    "public",
                                    "private"
                                ]
                            }
                        },
                        "type": "object"
                    },
                    {
                        "required": [
                            "type",
                            "attachment_id",
                            "title",
                            "status",
                            "status_label",
                            "canonical_id",
                            "jurisdiction",
                            "access"
                        ],
                        "properties": {
                            "type": {
                                "type": "string",
                                "enum": [
                                    "law"
                                ]
                            },
                            "attachment_id": {
                                "type": "integer"
                            },
                            "title": {
                                "type": "string",
                                "nullable": true
                            },
                            "status": {
                                "type": "string",
                                "nullable": true
                            },
                            "status_label": {
                                "type": "string"
                            },
                            "canonical_id": {
                                "type": "string"
                            },
                            "jurisdiction": {
                                "type": "string"
                            },
                            "access": {
                                "type": "string",
                                "enum": [
                                    "public"
                                ]
                            }
                        },
                        "type": "object"
                    }
                ]
            },
            "ContractShare": {
                "required": [
                    "email",
                    "expiration"
                ],
                "properties": {
                    "email": {
                        "type": "string"
                    },
                    "expiration": {
                        "type": "string",
                        "nullable": true
                    }
                },
                "type": "object"
            },
            "ContractInvite": {
                "required": [
                    "email",
                    "link"
                ],
                "properties": {
                    "email": {
                        "type": "string",
                        "nullable": true
                    },
                    "link": {
                        "type": "string",
                        "format": "uri"
                    }
                },
                "type": "object"
            },
            "ContractListItem": {
                "required": [
                    "identifier",
                    "contract_title",
                    "template_id",
                    "template_name",
                    "own_id",
                    "contract_status",
                    "inside_status",
                    "language",
                    "contract_signed",
                    "status",
                    "is_archived",
                    "download_link",
                    "number_of_participants",
                    "contract_created",
                    "laws"
                ],
                "properties": {
                    "identifier": {
                        "type": "integer"
                    },
                    "contract_title": {
                        "type": "string",
                        "nullable": true
                    },
                    "template_id": {
                        "type": "string"
                    },
                    "template_name": {
                        "type": "string",
                        "nullable": true
                    },
                    "own_id": {
                        "type": "string",
                        "nullable": true
                    },
                    "contract_status": {
                        "description": "Contract status code.",
                        "type": "string",
                        "enum": [
                            "draft",
                            "contracts_awaiting_signature",
                            "contracts_awaiting_for_confirmation",
                            "signed_contracts",
                            "archived_contract",
                            "declined"
                        ]
                    },
                    "inside_status": {
                        "description": "Internal status label, or an empty string.",
                        "type": "string"
                    },
                    "language": {
                        "type": "string",
                        "nullable": true
                    },
                    "contract_signed": {
                        "description": "Signing date and time, or an empty string.",
                        "type": "string"
                    },
                    "status": {
                        "description": "Human-readable contract status.",
                        "type": "string"
                    },
                    "is_archived": {
                        "type": "boolean"
                    },
                    "download_link": {
                        "description": "Download link for a finalized contract; otherwise null. May be empty if unavailable.",
                        "type": "string",
                        "nullable": true
                    },
                    "number_of_participants": {
                        "type": "integer"
                    },
                    "contract_created": {
                        "type": "string"
                    },
                    "laws": {
                        "type": "array",
                        "items": {
                            "$ref": "#/components/schemas/ContractLaw"
                        }
                    }
                },
                "type": "object"
            },
            "ContractDecline": {
                "required": [
                    "email",
                    "declining_representative",
                    "reason",
                    "date"
                ],
                "properties": {
                    "email": {
                        "type": "string",
                        "nullable": true
                    },
                    "declining_representative": {
                        "description": "Representative who declined, or an empty array.",
                        "anyOf": [
                            {
                                "required": [
                                    "email",
                                    "name",
                                    "user_id"
                                ],
                                "properties": {
                                    "email": {
                                        "type": "string"
                                    },
                                    "name": {
                                        "type": "string"
                                    },
                                    "user_id": {
                                        "type": "integer",
                                        "nullable": true
                                    }
                                },
                                "type": "object"
                            },
                            {
                                "type": "array",
                                "items": {
                                    "type": "object"
                                },
                                "maxItems": 0
                            }
                        ]
                    },
                    "reason": {
                        "type": "string"
                    },
                    "date": {
                        "type": "string"
                    }
                },
                "type": "object"
            },
            "ContractInternalApproval": {
                "required": [
                    "id",
                    "name",
                    "status",
                    "is_approved",
                    "is_declined",
                    "approved_by",
                    "approved_at",
                    "declined_by",
                    "declined_at",
                    "decline_reason",
                    "note"
                ],
                "properties": {
                    "id": {
                        "type": "integer"
                    },
                    "name": {
                        "type": "string",
                        "nullable": true
                    },
                    "status": {
                        "type": "string",
                        "enum": [
                            "pending",
                            "approved",
                            "declined"
                        ]
                    },
                    "is_approved": {
                        "type": "boolean"
                    },
                    "is_declined": {
                        "type": "boolean"
                    },
                    "approved_by": {
                        "type": "string",
                        "nullable": true
                    },
                    "approved_at": {
                        "type": "string",
                        "nullable": true
                    },
                    "declined_by": {
                        "type": "string",
                        "nullable": true
                    },
                    "declined_at": {
                        "type": "string",
                        "nullable": true
                    },
                    "decline_reason": {
                        "type": "string",
                        "nullable": true
                    },
                    "note": {
                        "type": "string",
                        "nullable": true
                    }
                },
                "type": "object"
            },
            "TemplateDetail": {
                "title": "Template Detail",
                "required": [
                    "head_for_contract",
                    "contract_variables"
                ],
                "properties": {
                    "head_for_contract": {
                        "description": "Contract details and recipient email fields.",
                        "required": [
                            "type_of_contract",
                            "subject_of_contract",
                            "accompanying_message",
                            "receiver_email",
                            "own_id"
                        ],
                        "properties": {
                            "type_of_contract": {
                                "type": "string"
                            },
                            "subject_of_contract": {
                                "type": "string"
                            },
                            "accompanying_message": {
                                "type": "string"
                            },
                            "receiver_email": {
                                "type": "string"
                            },
                            "own_id": {
                                "type": "string"
                            }
                        },
                        "type": "object",
                        "additionalProperties": {
                            "type": "string"
                        }
                    },
                    "contract_variables": {
                        "type": "array",
                        "items": {
                            "$ref": "#/components/schemas/TemplateVariable"
                        }
                    }
                },
                "type": "object"
            },
            "TemplateVariable": {
                "title": "Template Variable",
                "required": [
                    "name",
                    "description",
                    "value"
                ],
                "properties": {
                    "name": {
                        "type": "string"
                    },
                    "description": {
                        "type": "string"
                    },
                    "value": {
                        "type": "string"
                    }
                },
                "type": "object"
            },
            "ContractLaw": {
                "required": [
                    "id",
                    "law_name",
                    "status",
                    "status_label",
                    "canonical_id",
                    "jurisdiction"
                ],
                "properties": {
                    "id": {
                        "type": "integer"
                    },
                    "law_name": {
                        "type": "string",
                        "nullable": true
                    },
                    "status": {
                        "type": "string",
                        "nullable": true
                    },
                    "status_label": {
                        "type": "string"
                    },
                    "canonical_id": {
                        "type": "string"
                    },
                    "jurisdiction": {
                        "type": "string"
                    }
                },
                "type": "object"
            },
            "ContractComment": {
                "required": [
                    "id",
                    "author",
                    "content",
                    "is_internal",
                    "created_at"
                ],
                "properties": {
                    "id": {
                        "type": "integer"
                    },
                    "author": {
                        "type": "string",
                        "nullable": true
                    },
                    "content": {
                        "type": "string",
                        "nullable": true
                    },
                    "is_internal": {
                        "type": "boolean"
                    },
                    "created_at": {
                        "type": "string"
                    }
                },
                "type": "object"
            },
            "ContractValidationError": {
                "required": [
                    "status",
                    "message"
                ],
                "properties": {
                    "status": {
                        "type": "string",
                        "enum": [
                            "error"
                        ]
                    },
                    "message": {
                        "description": "Validation errors keyed by field.",
                        "type": "object",
                        "additionalProperties": {
                            "type": "array",
                            "items": {
                                "type": "string"
                            }
                        }
                    }
                },
                "type": "object"
            },
            "ContractPage": {
                "required": [
                    "current_page",
                    "data",
                    "first_page_url",
                    "from",
                    "last_page",
                    "last_page_url",
                    "links",
                    "next_page_url",
                    "path",
                    "per_page",
                    "prev_page_url",
                    "to",
                    "total"
                ],
                "properties": {
                    "current_page": {
                        "type": "integer"
                    },
                    "data": {
                        "type": "array",
                        "items": {
                            "$ref": "#/components/schemas/ContractListItem"
                        }
                    },
                    "first_page_url": {
                        "type": "string"
                    },
                    "from": {
                        "type": "integer",
                        "nullable": true
                    },
                    "last_page": {
                        "type": "integer"
                    },
                    "last_page_url": {
                        "type": "string"
                    },
                    "links": {
                        "type": "array",
                        "items": {
                            "required": [
                                "url",
                                "label",
                                "active"
                            ],
                            "properties": {
                                "url": {
                                    "type": "string",
                                    "nullable": true
                                },
                                "label": {
                                    "type": "string"
                                },
                                "page": {
                                    "type": "integer",
                                    "nullable": true
                                },
                                "active": {
                                    "type": "boolean"
                                }
                            },
                            "type": "object"
                        }
                    },
                    "next_page_url": {
                        "type": "string",
                        "nullable": true
                    },
                    "path": {
                        "type": "string"
                    },
                    "per_page": {
                        "type": "integer",
                        "enum": [
                            20
                        ]
                    },
                    "prev_page_url": {
                        "type": "string",
                        "nullable": true
                    },
                    "to": {
                        "type": "integer",
                        "nullable": true
                    },
                    "total": {
                        "type": "integer"
                    }
                },
                "type": "object"
            },
            "AgentTemplateError": {
                "required": [
                    "status",
                    "message"
                ],
                "properties": {
                    "status": {
                        "type": "string",
                        "enum": [
                            "error"
                        ]
                    },
                    "message": {
                        "type": "string"
                    }
                },
                "type": "object"
            },
            "AgentTemplateRawError": {
                "required": [
                    "error"
                ],
                "properties": {
                    "error": {
                        "type": "string"
                    }
                },
                "type": "object"
            },
            "AgentTemplateValidationError": {
                "required": [
                    "status",
                    "message"
                ],
                "properties": {
                    "status": {
                        "type": "string",
                        "enum": [
                            "error"
                        ]
                    },
                    "message": {
                        "type": "object",
                        "additionalProperties": {
                            "type": "array",
                            "items": {
                                "type": "string"
                            }
                        }
                    }
                },
                "type": "object"
            },
            "AgentTemplateFieldValidationError": {
                "required": [
                    "status",
                    "message"
                ],
                "properties": {
                    "status": {
                        "type": "string",
                        "enum": [
                            "error"
                        ]
                    },
                    "message": {
                        "type": "string"
                    },
                    "errors": {
                        "type": "object",
                        "additionalProperties": {
                            "type": "array",
                            "items": {
                                "type": "string"
                            }
                        }
                    }
                },
                "type": "object"
            },
            "AgentTemplateListedField": {
                "required": [
                    "id",
                    "title",
                    "name",
                    "field_type",
                    "contract_type_id",
                    "reorder",
                    "options",
                    "created_at",
                    "updated_at",
                    "field_type_name"
                ],
                "properties": {
                    "id": {
                        "type": "integer"
                    },
                    "title": {
                        "type": "string"
                    },
                    "name": {
                        "type": "string"
                    },
                    "field_type": {
                        "description": "Field type code.",
                        "type": "string",
                        "example": "1"
                    },
                    "contract_type_id": {
                        "type": "integer"
                    },
                    "reorder": {
                        "type": "integer",
                        "nullable": true
                    },
                    "options": {
                        "description": "Available choices as a JSON string.",
                        "type": "string",
                        "example": "[\"Red\",\"Blue\"]",
                        "nullable": true
                    },
                    "created_at": {
                        "type": "string",
                        "format": "date-time"
                    },
                    "updated_at": {
                        "type": "string",
                        "format": "date-time"
                    },
                    "field_type_name": {
                        "type": "string",
                        "example": "text"
                    }
                },
                "type": "object"
            },
            "AgentTemplateSavedField": {
                "required": [
                    "id",
                    "title",
                    "name",
                    "field_type",
                    "contract_type_id",
                    "reorder",
                    "created_at",
                    "updated_at"
                ],
                "properties": {
                    "id": {
                        "type": "integer"
                    },
                    "title": {
                        "type": "string"
                    },
                    "name": {
                        "type": "string"
                    },
                    "field_type": {
                        "description": "Field type name.",
                        "type": "string",
                        "example": "text"
                    },
                    "contract_type_id": {
                        "oneOf": [
                            {
                                "type": "integer"
                            },
                            {
                                "type": "string"
                            }
                        ]
                    },
                    "reorder": {
                        "type": "integer",
                        "nullable": true
                    },
                    "options": {
                        "description": "Available choices as a JSON string.",
                        "type": "string",
                        "example": "[\"Red\",\"Blue\"]",
                        "nullable": true
                    },
                    "created_at": {
                        "type": "string",
                        "format": "date-time"
                    },
                    "updated_at": {
                        "type": "string",
                        "format": "date-time"
                    }
                },
                "type": "object"
            },
            "BrandingSettings": {
                "title": "Branding Settings",
                "required": [
                    "contract_header_logo_enabled",
                    "contract_style_enabled",
                    "contract_email_heading_enabled",
                    "contract_email_edit_enabled",
                    "email_text",
                    "for_preview"
                ],
                "properties": {
                    "contract_header_logo_enabled": {
                        "type": "boolean"
                    },
                    "contract_style_enabled": {
                        "type": "boolean"
                    },
                    "contract_email_heading_enabled": {
                        "type": "boolean"
                    },
                    "contract_email_edit_enabled": {
                        "type": "boolean"
                    },
                    "email_text": {
                        "type": "string",
                        "nullable": true
                    },
                    "for_preview": {
                        "type": "boolean",
                        "enum": [
                            false
                        ]
                    },
                    "contract_header_logo": {
                        "description": "Included when contract_header_logo_enabled is enabled.",
                        "type": "string",
                        "nullable": true
                    },
                    "contract_header_color": {
                        "description": "Included when contract_header_logo_enabled is enabled.",
                        "type": "string",
                        "nullable": true
                    },
                    "contract_background_image": {
                        "description": "Included when contract_style_enabled is enabled.",
                        "type": "string",
                        "nullable": true
                    },
                    "contract_background_position": {
                        "description": "Included when contract_style_enabled is enabled.",
                        "type": "integer",
                        "nullable": true
                    },
                    "contract_background_color": {
                        "description": "Included when contract_style_enabled is enabled.",
                        "type": "string",
                        "nullable": true
                    },
                    "contract_email_background_color": {
                        "description": "Included when contract_email_heading_enabled is enabled.",
                        "type": "string",
                        "nullable": true
                    },
                    "contract_email_header_image": {
                        "description": "Included when contract_email_heading_enabled is enabled.",
                        "type": "string",
                        "nullable": true
                    }
                },
                "type": "object"
            },
            "UserInfo": {
                "title": "User Information",
                "required": [
                    "id",
                    "name",
                    "email",
                    "membership",
                    "credit",
                    "membership_ends_at",
                    "branding"
                ],
                "properties": {
                    "id": {
                        "type": "integer",
                        "example": 42
                    },
                    "name": {
                        "type": "string",
                        "example": "Kovács János",
                        "nullable": true
                    },
                    "email": {
                        "type": "string",
                        "format": "email",
                        "example": "janos.kovacs@example.com"
                    },
                    "membership": {
                        "type": "string",
                        "example": "Premium Package"
                    },
                    "credit": {
                        "type": "integer",
                        "example": 150
                    },
                    "membership_ends_at": {
                        "type": "string",
                        "example": "2026-12-31 23:59:59",
                        "nullable": true
                    },
                    "branding": {
                        "$ref": "#/components/schemas/BrandingSettings"
                    }
                },
                "type": "object"
            }
        },
        "securitySchemes": {
            "sanctum": {
                "type": "http",
                "scheme": "bearer"
            }
        }
    },
    "tags": [
        {
            "name": "Ai",
            "description": "Ai"
        },
        {
            "name": "Contract",
            "description": "Contract"
        },
        {
            "name": "Contract Status",
            "description": "Contract Status"
        },
        {
            "name": "Coworker",
            "description": "Coworker"
        },
        {
            "name": "Partners",
            "description": "Partners"
        },
        {
            "name": "Templates",
            "description": "Templates"
        },
        {
            "name": "ThirdParty",
            "description": "ThirdParty"
        },
        {
            "name": "Users",
            "description": "Users"
        },
        {
            "name": "Webhooks",
            "description": "Webhooks"
        }
    ]
}