{
    "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": "Start a data layer extraction based on the schema given.",
                "operationId": "dataLayer",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "required": [
                                    "contract_id",
                                    "schema_key"
                                ],
                                "properties": {
                                    "contract_id": {
                                        "description": "The ID of the contract to get data from",
                                        "type": "integer"
                                    },
                                    "schema_key": {
                                        "description": "The schema on which extraction should be based",
                                        "type": "string"
                                    }
                                },
                                "type": "object"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Extraction started",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "data_layer_result_id": {
                                            "type": "integer"
                                        },
                                        "status": {
                                            "type": "string"
                                        },
                                        "result": {
                                            "type": "string"
                                        },
                                        "callback_status": {
                                            "type": "string"
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "Forbidden",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "status": {
                                            "type": "string",
                                            "example": "error"
                                        },
                                        "message": {
                                            "type": "string",
                                            "example": "Unauthorized or Invalid Credentials"
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "sanctum": []
                    }
                ]
            }
        },
        "/api/agent/ai/data-layers": {
            "get": {
                "tags": [
                    "Ai"
                ],
                "summary": "List available data layers (schemas)",
                "description": "Returns a list of active schemas belonging to the user, with name, description, and the expected JSON response structure (schema).",
                "operationId": "listDataLayers",
                "responses": {
                    "200": {
                        "description": "Query successful. The response contains a list of schemas.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "array",
                                    "items": {
                                        "properties": {
                                            "id": {
                                                "type": "integer",
                                                "example": 1
                                            },
                                            "name": {
                                                "description": "The schema_key to be provided to the extract endpoint.",
                                                "type": "string",
                                                "example": "szerzodes_alap_adatok"
                                            },
                                            "is_enabled": {
                                                "type": "boolean",
                                                "example": true
                                            },
                                            "expected_output": {
                                                "description": "An easy-to-read example JSON pattern that shows what response (keys, types) to expect.",
                                                "type": "object"
                                            },
                                            "schema": {
                                                "description": "The expected JSON response structure (schema) that the AI will return after successful extraction.",
                                                "type": "object"
                                            }
                                        },
                                        "type": "object"
                                    }
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "No active membership or authorization error.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "status": {
                                            "type": "string",
                                            "example": "error"
                                        },
                                        "message": {
                                            "type": "string",
                                            "example": "No active membership! - You cannot send API requests because your subscription is not active."
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "sanctum": []
                    }
                ]
            }
        },
        "/your-callback-url": {
            "post": {
                "tags": [
                    "Callbacks"
                ],
                "summary": "Sample Callback Endpoint",
                "description": "This describes the request that eSzerzodes will send to your callback_url. You should implement an endpoint that accepts this payload.",
                "operationId": "cc7761b5abfe85c27959323df6643ae4",
                "requestBody": {
                    "description": "Event data",
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/CallbackPayload"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Webhook received successfully",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "status": {
                                            "type": "string",
                                            "example": "success"
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/api/agent/contracts": {
            "get": {
                "tags": [
                    "Contract"
                ],
                "summary": "Get contracts list",
                "description": "Returns a paginated list of contracts where the user is an owner, invitee, or partner. Requires 'contracts:read' ability.",
                "operationId": "contracts",
                "parameters": [
                    {
                        "name": "page",
                        "in": "query",
                        "description": "Page number",
                        "required": false,
                        "schema": {
                            "type": "integer"
                        }
                    },
                    {
                        "name": "search_query",
                        "in": "query",
                        "description": "Search text (Subject, partner, etc.)",
                        "required": false,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "search_contract_type",
                        "in": "query",
                        "description": "Filter by Contract Type ID",
                        "required": false,
                        "schema": {
                            "type": "integer"
                        }
                    },
                    {
                        "name": "contract_creator",
                        "in": "query",
                        "description": "Filter by Creator User ID",
                        "required": false,
                        "schema": {
                            "type": "integer"
                        }
                    },
                    {
                        "name": "finalized_at",
                        "in": "query",
                        "description": "Filter by Finalized Date (Y-m-d)",
                        "required": false,
                        "schema": {
                            "type": "string",
                            "format": "date"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Paginated list of contracts",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "status": {
                                            "type": "string",
                                            "example": "success"
                                        },
                                        "data": {
                                            "properties": {
                                                "current_page": {
                                                    "type": "integer"
                                                },
                                                "data": {
                                                    "type": "array",
                                                    "items": {
                                                        "properties": {
                                                            "id": {
                                                                "type": "integer"
                                                            },
                                                            "subject": {
                                                                "type": "string"
                                                            },
                                                            "status": {
                                                                "type": "string"
                                                            },
                                                            "owner_user_id": {
                                                                "type": "integer"
                                                            },
                                                            "invitee_user_id": {
                                                                "type": "integer"
                                                            },
                                                            "finalized_at": {
                                                                "type": "string"
                                                            },
                                                            "created_at": {
                                                                "type": "string"
                                                            },
                                                            "contract_type_id": {
                                                                "type": "string"
                                                            },
                                                            "contract_type_title": {
                                                                "type": "string"
                                                            },
                                                            "own_id": {
                                                                "type": "string"
                                                            },
                                                            "contract_label": {
                                                                "type": "integer"
                                                            },
                                                            "is_archived": {
                                                                "description": "Indicates whether the currently logged-in user has archived (hidden) this contract.",
                                                                "type": "boolean"
                                                            },
                                                            "lang": {
                                                                "type": "string"
                                                            }
                                                        },
                                                        "type": "object"
                                                    }
                                                },
                                                "first_page_url": {
                                                    "type": "string"
                                                },
                                                "from": {
                                                    "type": "integer"
                                                },
                                                "last_page": {
                                                    "type": "integer"
                                                },
                                                "last_page_url": {
                                                    "type": "string"
                                                },
                                                "next_page_url": {
                                                    "type": "string"
                                                },
                                                "path": {
                                                    "type": "string"
                                                },
                                                "per_page": {
                                                    "type": "integer"
                                                },
                                                "prev_page_url": {
                                                    "type": "string"
                                                },
                                                "to": {
                                                    "type": "integer"
                                                },
                                                "total": {
                                                    "type": "integer"
                                                }
                                            },
                                            "type": "object"
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "400": {
                        "description": "Bad Request",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "status": {
                                            "type": "string",
                                            "example": "error"
                                        },
                                        "message": {
                                            "type": "string",
                                            "example": "Validation Error"
                                        },
                                        "errors": {
                                            "type": "object",
                                            "example": {
                                                "user_id": [
                                                    "The user id field is required."
                                                ]
                                            }
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Unauthenticated",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "status": {
                                            "type": "string",
                                            "example": "error"
                                        },
                                        "message": {
                                            "type": "string",
                                            "example": "Unauthorized or Invalid Credentials"
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "Forbidden",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "status": {
                                            "type": "string",
                                            "example": "error"
                                        },
                                        "message": {
                                            "type": "string",
                                            "example": "Unauthorized IP address OR You are not authorized for this operation (contracts:read)"
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "sanctum": [
                            "contracts:read"
                        ]
                    }
                ]
            },
            "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": {
                                    "properties": {
                                        "message": {
                                            "type": "string",
                                            "example": "Contract created successfully"
                                        },
                                        "contract": {
                                            "type": "object"
                                        }
                                    },
                                    "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 single contract details by ID",
                "description": "Returns detailed contract information matching the XML agent's single contract view. Requires 'contracts:read' ability.",
                "operationId": "showContract",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "description": "Contract ID",
                        "required": true,
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Detailed contract data",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "status": {
                                            "type": "string",
                                            "example": "success"
                                        },
                                        "data": {
                                            "type": "object"
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "400": {
                        "description": "Bad Request",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "status": {
                                            "type": "string",
                                            "example": "error"
                                        },
                                        "message": {
                                            "type": "string",
                                            "example": "Validation Error"
                                        },
                                        "errors": {
                                            "type": "object",
                                            "example": {
                                                "user_id": [
                                                    "The user id field is required."
                                                ]
                                            }
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Unauthenticated",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "status": {
                                            "type": "string",
                                            "example": "error"
                                        },
                                        "message": {
                                            "type": "string",
                                            "example": "Unauthorized or Invalid Credentials"
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "Forbidden",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "status": {
                                            "type": "string",
                                            "example": "error"
                                        },
                                        "message": {
                                            "type": "string",
                                            "example": "Unauthorized IP address OR You are not authorized for this operation (contracts:read)"
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "Contract not found",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "status": {
                                            "type": "string",
                                            "example": "error"
                                        },
                                        "message": {
                                            "type": "string",
                                            "example": "Contract not found or access denied"
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "sanctum": [
                            "contracts:read"
                        ]
                    }
                ]
            },
            "delete": {
                "tags": [
                    "Contract"
                ],
                "summary": "Delete a contract",
                "description": "Deletes the contract and all associated data (partners, fields, etc.). Replicates remove_en logic. Requires 'contracts:delete' ability.",
                "operationId": "deleteContract",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "description": "Contract ID",
                        "required": true,
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Delete success",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "status": {
                                            "type": "string",
                                            "example": "success"
                                        },
                                        "message": {
                                            "type": "string",
                                            "example": "Successfully deleted!"
                                        },
                                        "data": {
                                            "properties": {
                                                "contract_id": {
                                                    "type": "integer"
                                                },
                                                "result": {
                                                    "type": "string"
                                                }
                                            },
                                            "type": "object"
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "400": {
                        "description": "Bad Request",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "status": {
                                            "type": "string",
                                            "example": "error"
                                        },
                                        "message": {
                                            "type": "string",
                                            "example": "Coworker not found"
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Unauthenticated",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "status": {
                                            "type": "string",
                                            "example": "error"
                                        },
                                        "message": {
                                            "type": "string",
                                            "example": "Incorrect user_id / secret_key!"
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "Forbidden",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "status": {
                                            "type": "string",
                                            "example": "error"
                                        },
                                        "message": {
                                            "type": "string",
                                            "example": "You do not have xml access! OR You are not authorized for this operation (contracts:delete)"
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "Contract not found",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "status": {
                                            "type": "string",
                                            "example": "error"
                                        },
                                        "message": {
                                            "type": "string",
                                            "example": "Contract not found or not authorized!"
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "sanctum": [
                            "contracts:delete"
                        ]
                    }
                ]
            }
        },
        "/api/agent/contracts/own-id/{own_id}": {
            "get": {
                "tags": [
                    "Contract"
                ],
                "summary": "Get single contract details by Own ID",
                "description": "Returns detailed contract information matching the XML agent's single contract view. Requires 'contracts:read' ability.",
                "operationId": "showContractByOwnId",
                "parameters": [
                    {
                        "name": "own_id",
                        "in": "path",
                        "description": "Contract Own ID",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Detailed contract data",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "status": {
                                            "type": "string",
                                            "example": "success"
                                        },
                                        "data": {
                                            "type": "object"
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "400": {
                        "description": "Bad Request",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "status": {
                                            "type": "string",
                                            "example": "error"
                                        },
                                        "message": {
                                            "type": "string",
                                            "example": "Validation Error"
                                        },
                                        "errors": {
                                            "type": "object",
                                            "example": {
                                                "user_id": [
                                                    "The user id field is required."
                                                ]
                                            }
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Unauthenticated",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "status": {
                                            "type": "string",
                                            "example": "error"
                                        },
                                        "message": {
                                            "type": "string",
                                            "example": "Unauthorized or Invalid Credentials"
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "Forbidden",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "status": {
                                            "type": "string",
                                            "example": "error"
                                        },
                                        "message": {
                                            "type": "string",
                                            "example": "Unauthorized IP address OR You are not authorized for this operation (contracts:read)"
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "Contract not found",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "status": {
                                            "type": "string",
                                            "example": "error"
                                        },
                                        "message": {
                                            "type": "string",
                                            "example": "Contract not found or access denied"
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "sanctum": [
                            "contracts:read"
                        ]
                    }
                ]
            }
        },
        "/api/agent/contracts/{id}/comment": {
            "post": {
                "tags": [
                    "Contract"
                ],
                "summary": "Add comment to contract",
                "description": "Adds a new comment to a specific contract. Requires 'contracts:write' ability.",
                "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",
                                        "example": "This is a comment"
                                    }
                                },
                                "type": "object"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Comment added successfully",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "message": {
                                            "type": "string",
                                            "example": "Comment successfully added"
                                        },
                                        "contract": {
                                            "type": "object"
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "400": {
                        "description": "Bad Request",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "status": {
                                            "type": "string",
                                            "example": "error"
                                        },
                                        "message": {
                                            "type": "string",
                                            "example": "Validation Error"
                                        },
                                        "errors": {
                                            "type": "object",
                                            "example": {
                                                "comment": [
                                                    "The comment field is required."
                                                ]
                                            }
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Unauthenticated",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "status": {
                                            "type": "string",
                                            "example": "error"
                                        },
                                        "message": {
                                            "type": "string",
                                            "example": "Unauthorized or Invalid Credentials"
                                        }
                                    },
                                    "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": "Contract 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}/internal-status": {
            "post": {
                "tags": [
                    "Contract"
                ],
                "summary": "Set internal status of a contract",
                "description": "Sets the internal status (label) of a contract. You can provide either the ID or the Name of the status. Requires 'contracts:write' ability.",
                "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": "Name or ID of the status",
                                        "type": "string",
                                        "example": "Approved"
                                    }
                                },
                                "type": "object"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Internal status successfully set",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "message": {
                                            "type": "string",
                                            "example": "Internal status successfully set"
                                        },
                                        "contract": {
                                            "type": "object"
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "400": {
                        "description": "Bad Request",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "status": {
                                            "type": "string",
                                            "example": "error"
                                        },
                                        "message": {
                                            "type": "string",
                                            "example": "Invalid internal status"
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Unauthenticated",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "status": {
                                            "type": "string",
                                            "example": "error"
                                        },
                                        "message": {
                                            "type": "string",
                                            "example": "Unauthorized or Invalid Credentials"
                                        }
                                    },
                                    "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"
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "Server Error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "status": {
                                            "type": "string",
                                            "example": "error"
                                        },
                                        "message": {
                                            "type": "string",
                                            "example": "Error on save"
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "sanctum": [
                            "contracts:write"
                        ]
                    }
                ]
            }
        },
        "/api/agent/contracts/{id}/sign": {
            "post": {
                "tags": [
                    "Contract"
                ],
                "summary": "Sign a contract",
                "description": "Signs the contract. Matches logic of sign_contract_en. Requires 'contracts:sign' ability.",
                "operationId": "sign",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "description": "Contract ID",
                        "required": true,
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Sign success",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "message": {
                                            "type": "string",
                                            "example": "Successfully signed!"
                                        },
                                        "contract": {
                                            "type": "object"
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "400": {
                        "description": "Bad Request",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "status": {
                                            "type": "string",
                                            "example": "error"
                                        },
                                        "message": {
                                            "type": "string",
                                            "example": "Fill all required fields!"
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Unauthenticated",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "status": {
                                            "type": "string",
                                            "example": "error"
                                        },
                                        "message": {
                                            "type": "string",
                                            "example": "Incorrect user_id / secret_key!"
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "Forbidden",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "status": {
                                            "type": "string",
                                            "example": "error"
                                        },
                                        "message": {
                                            "type": "string",
                                            "example": "You do not have an active subscription! OR You are not authorized for this operation (contracts:sign)"
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "Contract not found",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "status": {
                                            "type": "string",
                                            "example": "error"
                                        },
                                        "message": {
                                            "type": "string",
                                            "example": "Contract not found!"
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "sanctum": [
                            "contracts:sign"
                        ]
                    }
                ]
            }
        },
        "/api/agent/contracts/{id}/resend": {
            "post": {
                "tags": [
                    "Contract"
                ],
                "summary": "Resend contract invites",
                "description": "Resends contract invites to partners who haven't accepted yet. Can specify a specific receiver. Requires 'contracts:write' ability.",
                "operationId": "resend",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "description": "Contract ID",
                        "required": true,
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "required": [
                                    "which_receiver"
                                ],
                                "properties": {
                                    "which_receiver": {
                                        "description": "Optional. Index of the receiver to resend to (1-based index).",
                                        "type": "integer",
                                        "example": 1
                                    }
                                },
                                "type": "object"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Resend success",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "message": {
                                            "type": "string",
                                            "example": "Successfully resend!"
                                        },
                                        "contract": {
                                            "type": "object"
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "400": {
                        "description": "Bad Request",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "status": {
                                            "type": "string",
                                            "example": "error"
                                        },
                                        "message": {
                                            "type": "string",
                                            "example": "For this contract, all partners accepted or rejected the contract!"
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Unauthenticated",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "status": {
                                            "type": "string",
                                            "example": "error"
                                        },
                                        "message": {
                                            "type": "string",
                                            "example": "Incorrect user_id / secret_key!"
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "Forbidden",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "status": {
                                            "type": "string",
                                            "example": "error"
                                        },
                                        "message": {
                                            "type": "string",
                                            "example": "You do not have xml access! OR You are not authorized for this operation (contracts:write)"
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "Contract 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}/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": {
                                    "properties": {
                                        "message": {
                                            "type": "string"
                                        },
                                        "contract": {
                                            "type": "object"
                                        }
                                    },
                                    "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": {
                                    "properties": {
                                        "message": {
                                            "type": "string"
                                        },
                                        "contract": {
                                            "type": "object"
                                        }
                                    },
                                    "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": {
                                    "properties": {
                                        "message": {
                                            "type": "string"
                                        }
                                    },
                                    "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": {
                                    "properties": {
                                        "message": {
                                            "type": "string"
                                        }
                                    },
                                    "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": {
                                    "properties": {
                                        "message": {
                                            "type": "string"
                                        },
                                        "contract": {
                                            "type": "object"
                                        }
                                    },
                                    "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": {
                                    "properties": {
                                        "message": {
                                            "type": "string",
                                            "example": "Contract created successfully"
                                        },
                                        "contract": {
                                            "type": "object"
                                        }
                                    },
                                    "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": "Successful operation",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "message": {
                                            "type": "string",
                                            "example": "Contract created successfully"
                                        },
                                        "contract": {
                                            "type": "object"
                                        }
                                    },
                                    "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": "Successful operation",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "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": "Successful operation",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "data": {
                                            "type": "array",
                                            "items": {
                                                "type": "object"
                                            }
                                        }
                                    },
                                    "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": "Successful operation",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "message": {
                                            "type": "string"
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "Link not found"
                    }
                },
                "security": [
                    {
                        "sanctum": [
                            "contracts:write"
                        ]
                    }
                ]
            }
        },
        "/api/agent/contract-status": {
            "get": {
                "tags": [
                    "Contract Status"
                ],
                "summary": "List contract statuses",
                "description": "Returns list of custom contract statuses. Requires 'statuses:read' ability.",
                "operationId": "contractStatusList",
                "responses": {
                    "200": {
                        "description": "Successful operation",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "status": {
                                            "type": "string",
                                            "example": "success"
                                        },
                                        "data": {
                                            "type": "array",
                                            "items": {
                                                "type": "object"
                                            }
                                        }
                                    },
                                    "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 (statuses:read)"
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "sanctum": [
                            "statuses:read"
                        ]
                    }
                ]
            },
            "post": {
                "tags": [
                    "Contract Status"
                ],
                "summary": "Create contract status",
                "description": "Creates a new custom contract status. Requires 'statuses:write' ability.",
                "operationId": "contractStatusStore",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "required": [
                                    "name",
                                    "color"
                                ],
                                "properties": {
                                    "name": {
                                        "type": "string"
                                    },
                                    "color": {
                                        "type": "string"
                                    },
                                    "email_to": {
                                        "type": "string"
                                    },
                                    "email_subject": {
                                        "type": "string"
                                    },
                                    "email_body": {
                                        "type": "string"
                                    },
                                    "permissions": {
                                        "type": "array",
                                        "items": {
                                            "type": "integer"
                                        }
                                    }
                                },
                                "type": "object"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Successful operation",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "status": {
                                            "type": "string",
                                            "example": "success"
                                        },
                                        "data": {
                                            "properties": {
                                                "id": {
                                                    "type": "integer"
                                                },
                                                "name": {
                                                    "type": "string"
                                                },
                                                "color": {
                                                    "type": "string"
                                                }
                                            },
                                            "type": "object"
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "400": {
                        "description": "Bad Request",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "status": {
                                            "type": "string",
                                            "example": "error"
                                        },
                                        "message": {
                                            "properties": {
                                                "name": {
                                                    "type": "array",
                                                    "items": {
                                                        "type": "string",
                                                        "example": "The name field is required."
                                                    }
                                                }
                                            },
                                            "type": "object"
                                        }
                                    },
                                    "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 (statuses:write)"
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "sanctum": [
                            "statuses:write"
                        ]
                    }
                ]
            }
        },
        "/api/agent/contract-status/{id}": {
            "put": {
                "tags": [
                    "Contract Status"
                ],
                "summary": "Update contract status",
                "description": "Updates an existing contract status. Requires 'statuses:write' ability.",
                "operationId": "contractStatusUpdate",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "required": [
                                    "name",
                                    "color"
                                ],
                                "properties": {
                                    "name": {
                                        "type": "string"
                                    },
                                    "color": {
                                        "type": "string"
                                    },
                                    "email_to": {
                                        "type": "string"
                                    },
                                    "email_subject": {
                                        "type": "string"
                                    },
                                    "email_body": {
                                        "type": "string"
                                    },
                                    "permissions": {
                                        "type": "array",
                                        "items": {
                                            "type": "integer"
                                        }
                                    }
                                },
                                "type": "object"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Successful operation",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "status": {
                                            "type": "string",
                                            "example": "success"
                                        },
                                        "data": {
                                            "properties": {
                                                "id": {
                                                    "type": "integer"
                                                },
                                                "name": {
                                                    "type": "string"
                                                },
                                                "color": {
                                                    "type": "string"
                                                }
                                            },
                                            "type": "object"
                                        }
                                    },
                                    "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 (statuses:write)"
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "sanctum": [
                            "statuses:write"
                        ]
                    }
                ]
            },
            "delete": {
                "tags": [
                    "Contract Status"
                ],
                "summary": "Delete contract status",
                "description": "Deletes a contract status. Requires 'statuses:write' ability.",
                "operationId": "contractStatusDestroy",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Successful operation",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "status": {
                                            "type": "string",
                                            "example": "success"
                                        },
                                        "data": {
                                            "properties": {
                                                "message": {
                                                    "type": "string",
                                                    "example": "Deleted successfully"
                                                }
                                            },
                                            "type": "object"
                                        }
                                    },
                                    "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 (statuses:write)"
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "sanctum": [
                            "statuses:write"
                        ]
                    }
                ]
            }
        },
        "/api/agent/coworkers": {
            "get": {
                "tags": [
                    "Coworker"
                ],
                "summary": "List coworkers",
                "description": "Returns list of coworkers associated with the user account. Requires 'coworkers:read' ability.",
                "operationId": "getCoworkers",
                "responses": {
                    "200": {
                        "description": "Successful operation",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "status": {
                                            "type": "string",
                                            "example": "success"
                                        },
                                        "data": {
                                            "properties": {
                                                "data": {
                                                    "type": "array",
                                                    "items": {
                                                        "properties": {
                                                            "id": {
                                                                "type": "integer"
                                                            },
                                                            "email": {
                                                                "type": "string"
                                                            },
                                                            "name": {
                                                                "type": "string"
                                                            },
                                                            "position": {
                                                                "type": "string"
                                                            },
                                                            "create_templates": {
                                                                "type": "integer"
                                                            },
                                                            "make_contract": {
                                                                "type": "integer"
                                                            },
                                                            "download_orders_invoices": {
                                                                "type": "integer"
                                                            },
                                                            "excel_export": {
                                                                "type": "integer"
                                                            },
                                                            "integration_access": {
                                                                "type": "integer"
                                                            },
                                                            "contract_branding": {
                                                                "type": "integer"
                                                            },
                                                            "create_contracts": {
                                                                "type": "integer"
                                                            },
                                                            "sign_contracts": {
                                                                "type": "integer"
                                                            },
                                                            "permission": {
                                                                "type": "integer"
                                                            },
                                                            "edit_permission": {
                                                                "type": "integer"
                                                            },
                                                            "manage_internal_statuses": {
                                                                "type": "integer"
                                                            },
                                                            "delete_contracts": {
                                                                "type": "integer"
                                                            },
                                                            "manage_co_accounts": {
                                                                "type": "integer"
                                                            },
                                                            "use_position_instead_of_delegate": {
                                                                "type": "integer"
                                                            },
                                                            "permissions": {
                                                                "type": "array",
                                                                "items": {
                                                                    "type": "string"
                                                                }
                                                            }
                                                        },
                                                        "type": "object"
                                                    }
                                                }
                                            },
                                            "type": "object"
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "400": {
                        "description": "Bad Request",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "status": {
                                            "type": "string",
                                            "example": "error"
                                        },
                                        "message": {
                                            "type": "string",
                                            "example": "Validation Error"
                                        },
                                        "errors": {
                                            "type": "object",
                                            "example": {
                                                "user_id": [
                                                    "The user id field is required."
                                                ]
                                            }
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Unauthenticated",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "status": {
                                            "type": "string",
                                            "example": "error"
                                        },
                                        "message": {
                                            "type": "string",
                                            "example": "Unauthorized or Invalid Credentials"
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "Forbidden",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "status": {
                                            "type": "string",
                                            "example": "error"
                                        },
                                        "message": {
                                            "type": "string",
                                            "example": "Unauthorized IP address OR You are not authorized for this operation (coworkers:read)"
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "sanctum": [
                            "coworkers:read"
                        ]
                    }
                ]
            },
            "post": {
                "tags": [
                    "Coworker"
                ],
                "summary": "Add a coworker",
                "description": "Adds a new coworker or updates an existing one for the user account. Requires 'coworkers:write' ability.",
                "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": {
                                        "type": "integer",
                                        "example": 1
                                    },
                                    "make_contract": {
                                        "type": "integer",
                                        "example": 1
                                    },
                                    "download_orders_invoices": {
                                        "type": "integer",
                                        "example": 1
                                    },
                                    "excel_export": {
                                        "type": "integer",
                                        "example": 1
                                    },
                                    "integration_access": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "contract_branding": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "create_contracts": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "sign_contracts": {
                                        "type": "integer",
                                        "example": 1
                                    },
                                    "permission": {
                                        "type": "integer",
                                        "example": 1
                                    },
                                    "edit_permission": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "manage_internal_statuses": {
                                        "type": "integer",
                                        "example": 1
                                    },
                                    "delete_contracts": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "manage_co_accounts": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "use_position_instead_of_delegate": {
                                        "type": "integer",
                                        "example": 1
                                    },
                                    "permissions": {
                                        "type": "string",
                                        "example": "perm1,perm2"
                                    }
                                },
                                "type": "object"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Coworker added successfully",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "status": {
                                            "type": "string",
                                            "example": "success"
                                        },
                                        "data": {
                                            "type": "string",
                                            "example": null,
                                            "nullable": true
                                        },
                                        "message": {
                                            "type": "string",
                                            "example": "Coworker successfully added"
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "400": {
                        "description": "Bad Request",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "status": {
                                            "type": "string",
                                            "example": "error"
                                        },
                                        "message": {
                                            "type": "string",
                                            "example": "Max coworker limit reached OR Validation Error"
                                        },
                                        "errors": {
                                            "type": "object",
                                            "example": {
                                                "email": [
                                                    "The email field is required."
                                                ]
                                            }
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Unauthenticated",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "status": {
                                            "type": "string",
                                            "example": "error"
                                        },
                                        "message": {
                                            "type": "string",
                                            "example": "Unauthorized or Invalid Credentials"
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "Forbidden",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "status": {
                                            "type": "string",
                                            "example": "error"
                                        },
                                        "message": {
                                            "type": "string",
                                            "example": "Unauthorized IP address OR You are not authorized for this operation (coworkers:write)"
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "Server Error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "status": {
                                            "type": "string",
                                            "example": "error"
                                        },
                                        "message": {
                                            "type": "string",
                                            "example": "Error on save"
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "sanctum": [
                            "coworkers:write"
                        ]
                    }
                ]
            },
            "delete": {
                "tags": [
                    "Coworker"
                ],
                "summary": "Remove a coworker",
                "description": "Removes a coworker from the user account. Requires 'coworkers:write' ability.",
                "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 successfully",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "status": {
                                            "type": "string",
                                            "example": "success"
                                        },
                                        "data": {
                                            "type": "string",
                                            "example": null,
                                            "nullable": true
                                        },
                                        "message": {
                                            "type": "string",
                                            "example": "Coworker successfully removed"
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "400": {
                        "description": "Bad Request or Coworker not found",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "status": {
                                            "type": "string",
                                            "example": "error"
                                        },
                                        "message": {
                                            "type": "string",
                                            "example": "Coworker not found"
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Unauthenticated",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "status": {
                                            "type": "string",
                                            "example": "error"
                                        },
                                        "message": {
                                            "type": "string",
                                            "example": "Unauthorized or Invalid Credentials"
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "Forbidden",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "status": {
                                            "type": "string",
                                            "example": "error"
                                        },
                                        "message": {
                                            "type": "string",
                                            "example": "Unauthorized IP address OR You are not authorized for this operation (coworkers:write)"
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "Server Error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "status": {
                                            "type": "string",
                                            "example": "error"
                                        },
                                        "message": {
                                            "type": "string",
                                            "example": "Error on save"
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "sanctum": [
                            "coworkers:write"
                        ]
                    }
                ]
            }
        },
        "/api/agent/partners": {
            "get": {
                "tags": [
                    "Partners"
                ],
                "summary": "Get partners list",
                "description": "Returns a list of partners (users) associated with the authenticated user via contracts. Supports search. Requires 'partners:read' ability.",
                "operationId": "partners",
                "parameters": [
                    {
                        "name": "term",
                        "in": "query",
                        "description": "Search term (Name, Email, Company Name)",
                        "required": false,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "List of partners",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "status": {
                                            "type": "string",
                                            "example": "success"
                                        },
                                        "data": {
                                            "type": "array",
                                            "items": {
                                                "properties": {
                                                    "id": {
                                                        "type": "integer",
                                                        "example": 101
                                                    },
                                                    "name": {
                                                        "type": "string",
                                                        "example": "Kovács Béla"
                                                    },
                                                    "email": {
                                                        "type": "string",
                                                        "example": "bela.kovacs@example.com"
                                                    },
                                                    "phone": {
                                                        "type": "string",
                                                        "example": "+36301234567"
                                                    },
                                                    "company_name": {
                                                        "type": "string",
                                                        "example": "Kovács Kft."
                                                    },
                                                    "company_residence": {
                                                        "type": "string",
                                                        "example": "1051 Budapest, Fő utca 1."
                                                    },
                                                    "company_tax_number": {
                                                        "type": "string",
                                                        "example": "12345678-1-41"
                                                    },
                                                    "address": {
                                                        "type": "string",
                                                        "example": "1111 Budapest, Mellék utca 2."
                                                    },
                                                    "mothers_name": {
                                                        "type": "string",
                                                        "example": "Nagy Anna"
                                                    },
                                                    "personal_id_number": {
                                                        "type": "string",
                                                        "example": "123456AB"
                                                    },
                                                    "birthday": {
                                                        "type": "string",
                                                        "format": "date",
                                                        "example": "1980-01-01"
                                                    },
                                                    "place_of_birth": {
                                                        "type": "string",
                                                        "example": "Debrecen"
                                                    }
                                                },
                                                "type": "object"
                                            }
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "400": {
                        "description": "Bad Request",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "status": {
                                            "type": "string",
                                            "example": "error"
                                        },
                                        "message": {
                                            "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": {
                                    "properties": {
                                        "status": {
                                            "type": "string",
                                            "example": "error"
                                        },
                                        "message": {
                                            "type": "string",
                                            "example": "Unauthenticated."
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "Forbidden",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "status": {
                                            "type": "string",
                                            "example": "error"
                                        },
                                        "message": {
                                            "type": "string",
                                            "example": "Unauthorized IP address OR You are not authorized for this operation (partners:read)"
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "sanctum": [
                            "partners:read"
                        ]
                    }
                ]
            }
        },
        "/api/agent/templates": {
            "get": {
                "tags": [
                    "Templates"
                ],
                "summary": "Get list of available templates",
                "description": "Returns a list of contract templates including static (HTML, PDF) and user-created dynamic templates. Requires 'templates:read' ability.",
                "operationId": "templates",
                "responses": {
                    "200": {
                        "description": "List of templates",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "status": {
                                            "type": "string",
                                            "example": "success"
                                        },
                                        "data": {
                                            "properties": {
                                                "templates": {
                                                    "type": "array",
                                                    "items": {
                                                        "properties": {
                                                            "id": {
                                                                "type": "string"
                                                            },
                                                            "name": {
                                                                "type": "string"
                                                            },
                                                            "language": {
                                                                "type": "string"
                                                            }
                                                        },
                                                        "type": "object"
                                                    }
                                                }
                                            },
                                            "type": "object"
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "400": {
                        "description": "Bad Request",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "status": {
                                            "type": "string",
                                            "example": "error"
                                        },
                                        "message": {
                                            "type": "string",
                                            "example": "Validation Error"
                                        },
                                        "errors": {
                                            "type": "object",
                                            "example": {
                                                "user_id": [
                                                    "The user id field is required."
                                                ]
                                            }
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Unauthenticated",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "status": {
                                            "type": "string",
                                            "example": "error"
                                        },
                                        "message": {
                                            "type": "string",
                                            "example": "Unauthorized or Invalid Credentials"
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "Forbidden",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "status": {
                                            "type": "string",
                                            "example": "error"
                                        },
                                        "message": {
                                            "type": "string",
                                            "example": "Unauthorized IP address OR You are not authorized for this operation (templates:read)"
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "sanctum": [
                            "templates:read"
                        ]
                    }
                ]
            },
            "post": {
                "tags": [
                    "Templates"
                ],
                "summary": "Create a new template",
                "description": "Creates a new contract template. Requires 'templates:write' ability.",
                "operationId": "createTemplate",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "required": [
                                    "title"
                                ],
                                "properties": {
                                    "title": {
                                        "type": "string",
                                        "example": "Contract Template"
                                    },
                                    "client_title": {
                                        "type": "string",
                                        "example": "Client"
                                    },
                                    "trustee_title": {
                                        "type": "string",
                                        "example": "Service Provider"
                                    },
                                    "template_content": {
                                        "type": "string",
                                        "example": "HTML content here..."
                                    },
                                    "template_intro": {
                                        "type": "string",
                                        "example": "Introduction text..."
                                    },
                                    "lang": {
                                        "type": "string",
                                        "example": "hu"
                                    },
                                    "signer_count": {
                                        "type": "integer",
                                        "example": 2
                                    },
                                    "single_signature": {
                                        "type": "boolean",
                                        "example": false
                                    },
                                    "allowed_user": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "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": "Creation success",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "message": {
                                            "type": "string",
                                            "example": "Successfully created!"
                                        },
                                        "template_id": {
                                            "type": "integer",
                                            "example": 123
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "400": {
                        "description": "Validation Error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "status": {
                                            "type": "string",
                                            "example": "error"
                                        },
                                        "message": {
                                            "properties": {
                                                "title": {
                                                    "type": "array",
                                                    "items": {
                                                        "type": "string",
                                                        "example": "The title field is required."
                                                    }
                                                },
                                                "lang": {
                                                    "type": "array",
                                                    "items": {
                                                        "type": "string",
                                                        "example": "The lang must be 2 characters."
                                                    }
                                                }
                                            },
                                            "type": "object"
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Unauthenticated",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "status": {
                                            "type": "string",
                                            "example": "error"
                                        },
                                        "message": {
                                            "type": "string",
                                            "example": "Incorrect user_id / secret_key!"
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "Forbidden",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "status": {
                                            "type": "string",
                                            "example": "error"
                                        },
                                        "message": {
                                            "type": "string",
                                            "example": "Unauthorized IP address OR You are not authorized for this operation (templates:write)"
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "Server Error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "error": {
                                            "type": "string",
                                            "example": "Error on create"
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "sanctum": [
                            "templates:write"
                        ]
                    }
                ]
            }
        },
        "/api/agent/templates/{id}": {
            "get": {
                "tags": [
                    "Templates"
                ],
                "summary": "Get a single template schema",
                "description": "Returns the structure/schema for a specific template, including available fields. Requires 'templates:read' ability.",
                "operationId": "template",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "description": "Template ID",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Template schema",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "status": {
                                            "type": "string",
                                            "example": "success"
                                        },
                                        "data": {
                                            "properties": {
                                                "head_for_contract": {
                                                    "type": "object"
                                                },
                                                "contract_variables": {
                                                    "type": "array",
                                                    "items": {
                                                        "type": "object"
                                                    }
                                                }
                                            },
                                            "type": "object"
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "400": {
                        "description": "Bad Request",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "status": {
                                            "type": "string",
                                            "example": "error"
                                        },
                                        "message": {
                                            "type": "string",
                                            "example": "Validation Error"
                                        },
                                        "errors": {
                                            "type": "object",
                                            "example": {
                                                "user_id": [
                                                    "The user id field is required."
                                                ]
                                            }
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Unauthenticated",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "status": {
                                            "type": "string",
                                            "example": "error"
                                        },
                                        "message": {
                                            "type": "string",
                                            "example": "Unauthorized or Invalid Credentials"
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "Forbidden",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "status": {
                                            "type": "string",
                                            "example": "error"
                                        },
                                        "message": {
                                            "type": "string",
                                            "example": "Unauthorized IP address OR You are not authorized for this operation (templates:read)"
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "Template not found",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "error": {
                                            "type": "string",
                                            "example": "Template not found or access denied"
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "sanctum": [
                            "templates:read"
                        ]
                    }
                ]
            },
            "put": {
                "tags": [
                    "Templates"
                ],
                "summary": "Update a template",
                "description": "Updates an existing contract template. Requires 'templates:write' ability.",
                "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"
                                    },
                                    "trustee_title": {
                                        "type": "string",
                                        "example": "Service Provider"
                                    },
                                    "template_content": {
                                        "type": "string",
                                        "example": "Updated HTML content..."
                                    },
                                    "template_intro": {
                                        "type": "string",
                                        "example": "Updated Introduction text..."
                                    },
                                    "lang": {
                                        "type": "string",
                                        "example": "hu"
                                    },
                                    "signer_count": {
                                        "type": "integer",
                                        "example": 2
                                    },
                                    "single_signature": {
                                        "type": "boolean",
                                        "example": false
                                    },
                                    "allowed_user": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "partner_3_title": {
                                        "type": "string",
                                        "example": "Guarantor"
                                    },
                                    "partner_4_title": {
                                        "type": "string",
                                        "example": "Witness"
                                    }
                                },
                                "type": "object"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Update success",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "message": {
                                            "type": "string",
                                            "example": "Successfully updated!"
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "400": {
                        "description": "Bad Request",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "status": {
                                            "type": "string",
                                            "example": "error"
                                        },
                                        "message": {
                                            "type": "string",
                                            "example": "Validation error"
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Unauthenticated",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "status": {
                                            "type": "string",
                                            "example": "error"
                                        },
                                        "message": {
                                            "type": "string",
                                            "example": "Incorrect user_id / secret_key!"
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "Forbidden",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "status": {
                                            "type": "string",
                                            "example": "error"
                                        },
                                        "message": {
                                            "type": "string",
                                            "example": "Unauthorized IP address OR You are not authorized for this operation (templates:write)"
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "Template not found",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "status": {
                                            "type": "string",
                                            "example": "error"
                                        },
                                        "message": {
                                            "type": "string",
                                            "example": "Template not found or access denied"
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "Server Error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "error": {
                                            "type": "string",
                                            "example": "Error on update"
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "sanctum": [
                            "templates:write"
                        ]
                    }
                ]
            },
            "delete": {
                "tags": [
                    "Templates"
                ],
                "summary": "Delete a template",
                "description": "Deletes a user-created template. Cannot delete if it is used by any contract. Requires 'templates:write' ability.",
                "operationId": "deleteTemplate",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "required": []
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Delete success",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "message": {
                                            "type": "string",
                                            "example": "Successfully deleted!"
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "400": {
                        "description": "Bad Request",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "status": {
                                            "type": "string",
                                            "example": "error"
                                        },
                                        "message": {
                                            "type": "string",
                                            "example": "Template is in use!"
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Unauthenticated",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "status": {
                                            "type": "string",
                                            "example": "error"
                                        },
                                        "message": {
                                            "type": "string",
                                            "example": "Incorrect user_id / secret_key!"
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "Forbidden",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "status": {
                                            "type": "string",
                                            "example": "error"
                                        },
                                        "message": {
                                            "type": "string",
                                            "example": "Unauthorized IP address OR You are not authorized for this operation (templates:write)"
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "Template not found",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "error": {
                                            "type": "string",
                                            "example": "Template not found or access denied"
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "Server Error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "error": {
                                            "type": "string",
                                            "example": "Error on delete"
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "sanctum": [
                            "templates:write"
                        ]
                    }
                ]
            }
        },
        "/api/agent/templates/{id}/archive": {
            "post": {
                "tags": [
                    "Templates"
                ],
                "summary": "Archive or Restore a template",
                "description": "Sets the archive status of a user-created template. Requires 'templates:write' ability.",
                "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": "Success",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "message": {
                                            "type": "string",
                                            "example": "Successfully updated!"
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "400": {
                        "description": "Bad Request",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "status": {
                                            "type": "string",
                                            "example": "error"
                                        },
                                        "message": {
                                            "type": "string",
                                            "example": "Invalid input"
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Unauthenticated",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "status": {
                                            "type": "string",
                                            "example": "error"
                                        },
                                        "message": {
                                            "type": "string",
                                            "example": "Incorrect user_id / secret_key!"
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "Forbidden",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "status": {
                                            "type": "string",
                                            "example": "error"
                                        },
                                        "message": {
                                            "type": "string",
                                            "example": "Unauthorized IP address OR You are not authorized for this operation (templates:write)"
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "Template not found",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "status": {
                                            "type": "string",
                                            "example": "error"
                                        },
                                        "message": {
                                            "type": "string",
                                            "example": "Template not found or access denied"
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "Server Error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "error": {
                                            "type": "string",
                                            "example": "Error on update"
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "sanctum": [
                            "templates:write"
                        ]
                    }
                ]
            }
        },
        "/api/agent/templates/{id}/fields": {
            "get": {
                "tags": [
                    "Templates"
                ],
                "summary": "List fields of a template",
                "description": "Returns the list of fields associated with a template. Requires 'templates:read' ability.",
                "operationId": "indexFields",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "List of fields",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "status": {
                                            "type": "string",
                                            "example": "success"
                                        },
                                        "data": {
                                            "type": "array",
                                            "items": {
                                                "properties": {
                                                    "id": {
                                                        "type": "integer"
                                                    },
                                                    "title": {
                                                        "type": "string"
                                                    },
                                                    "name": {
                                                        "type": "string"
                                                    },
                                                    "field_type": {
                                                        "description": "Field Type Identifier (e.g. text, select)",
                                                        "type": "string"
                                                    },
                                                    "options": {
                                                        "type": "string"
                                                    },
                                                    "reorder": {
                                                        "type": "integer"
                                                    }
                                                },
                                                "type": "object"
                                            }
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "Forbidden",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "status": {
                                            "type": "string",
                                            "example": "error"
                                        },
                                        "message": {
                                            "type": "string",
                                            "example": "Unauthorized OR You are not authorized for this operation (templates:read)"
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "sanctum": [
                            "templates:read"
                        ]
                    }
                ]
            },
            "post": {
                "tags": [
                    "Templates"
                ],
                "summary": "Add a new field to a template",
                "description": "Creates a new custom field for a specific template. Requires 'templates:write' ability.",
                "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 Identifier (e.g. text, select)",
                                        "type": "string"
                                    },
                                    "options": {
                                        "description": "Required for Select (9) and Radio (10). Newline separated values.",
                                        "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": "Field created",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "status": {
                                            "type": "string",
                                            "example": "success"
                                        },
                                        "data": {
                                            "properties": {
                                                "field": {
                                                    "properties": {
                                                        "id": {
                                                            "type": "integer"
                                                        },
                                                        "title": {
                                                            "type": "string"
                                                        },
                                                        "name": {
                                                            "type": "string"
                                                        },
                                                        "field_type": {
                                                            "description": "Field Type Identifier",
                                                            "type": "string"
                                                        },
                                                        "options": {
                                                            "type": "string"
                                                        },
                                                        "contract_type_id": {
                                                            "type": "integer"
                                                        },
                                                        "reorder": {
                                                            "type": "integer"
                                                        }
                                                    },
                                                    "type": "object"
                                                }
                                            },
                                            "type": "object"
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "Forbidden",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "status": {
                                            "type": "string",
                                            "example": "error"
                                        },
                                        "message": {
                                            "type": "string",
                                            "example": "Unauthorized OR You are not authorized for this operation (templates:write)"
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "sanctum": [
                            "templates:write"
                        ]
                    }
                ]
            }
        },
        "/api/agent/templates/{id}/fields/{field_id}": {
            "put": {
                "tags": [
                    "Templates"
                ],
                "summary": "Update an existing field",
                "description": "Updates a specific field of a template. Requires 'templates:write' ability.",
                "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 Identifier (e.g. text, select)",
                                        "type": "string"
                                    },
                                    "options": {
                                        "description": "Required for Select (9) and Radio (10). Newline separated values.",
                                        "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": "Field updated",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "status": {
                                            "type": "string",
                                            "example": "success"
                                        },
                                        "data": {
                                            "properties": {
                                                "field": {
                                                    "properties": {
                                                        "id": {
                                                            "type": "integer"
                                                        },
                                                        "title": {
                                                            "type": "string"
                                                        },
                                                        "name": {
                                                            "type": "string"
                                                        },
                                                        "field_type": {
                                                            "description": "Field Type Identifier",
                                                            "type": "string"
                                                        },
                                                        "options": {
                                                            "type": "string"
                                                        },
                                                        "contract_type_id": {
                                                            "type": "string"
                                                        },
                                                        "reorder": {
                                                            "type": "integer"
                                                        }
                                                    },
                                                    "type": "object"
                                                }
                                            },
                                            "type": "object"
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "Forbidden",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "status": {
                                            "type": "string",
                                            "example": "error"
                                        },
                                        "message": {
                                            "type": "string",
                                            "example": "Unauthorized OR You are not authorized for this operation (templates:write)"
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "Validation Error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "status": {
                                            "type": "string",
                                            "example": "error"
                                        },
                                        "message": {
                                            "properties": {
                                                "field_title": {
                                                    "type": "array",
                                                    "items": {
                                                        "type": "string",
                                                        "example": "The field title has already been taken."
                                                    }
                                                },
                                                "field_type": {
                                                    "type": "array",
                                                    "items": {
                                                        "type": "string",
                                                        "example": "The selected field type is invalid."
                                                    }
                                                }
                                            },
                                            "type": "object"
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "sanctum": [
                            "templates:write"
                        ]
                    }
                ]
            },
            "delete": {
                "tags": [
                    "Templates"
                ],
                "summary": "Delete a field from a template",
                "description": "Deletes a specific field from a template. Requires 'templates:write' ability.",
                "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": "Field deleted"
                    },
                    "403": {
                        "description": "Forbidden",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "status": {
                                            "type": "string",
                                            "example": "error"
                                        },
                                        "message": {
                                            "type": "string",
                                            "example": "Unauthorized OR You are not authorized for this operation (templates:write)"
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "sanctum": [
                            "templates:write"
                        ]
                    }
                ]
            }
        },
        "/api/agent/templates/{id}/reorder-fields": {
            "post": {
                "tags": [
                    "Templates"
                ],
                "summary": "Reorder fields",
                "description": "Updates the order of fields in a template. Requires 'templates:write' ability.",
                "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": "Fields reordered"
                    },
                    "403": {
                        "description": "Forbidden",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "status": {
                                            "type": "string",
                                            "example": "error"
                                        },
                                        "message": {
                                            "type": "string",
                                            "example": "Unauthorized OR You are not authorized for this operation (templates:write)"
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "sanctum": [
                            "templates:write"
                        ]
                    }
                ]
            }
        },
        "/api/agent/3rd-party/registration": {
            "post": {
                "tags": [
                    "ThirdParty"
                ],
                "summary": "Register a new 3rd party user (Partner)",
                "description": "Registers a new user account via a 3rd party integration. Requires '3rt_api' permission on the authenticated user.",
                "operationId": "thirdPartyRegister",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "required": [
                                    "partner_data"
                                ],
                                "properties": {
                                    "registration_header": {
                                        "properties": {
                                            "coupon_code": {
                                                "type": "string"
                                            },
                                            "otp_connection": {
                                                "type": "string"
                                            },
                                            "clone_account": {
                                                "type": "string",
                                                "enum": [
                                                    "yes",
                                                    "no"
                                                ]
                                            },
                                            "cloned_account_user_id": {
                                                "type": "string"
                                            },
                                            "cloned_account_secret_key": {
                                                "type": "string"
                                            }
                                        },
                                        "type": "object"
                                    },
                                    "partner_data": {
                                        "required": [
                                            "partner_type",
                                            "email"
                                        ],
                                        "properties": {
                                            "partner_type": {
                                                "description": "1: Private Person, 2: Company",
                                                "type": "string",
                                                "enum": [
                                                    "1",
                                                    "2"
                                                ]
                                            },
                                            "email": {
                                                "type": "string"
                                            },
                                            "signatory_name": {
                                                "type": "string"
                                            },
                                            "phone_number": {
                                                "type": "string"
                                            },
                                            "address": {
                                                "type": "string"
                                            },
                                            "mothers_name": {
                                                "type": "string"
                                            },
                                            "birthday": {
                                                "type": "string"
                                            },
                                            "place_of_birth": {
                                                "type": "string"
                                            },
                                            "company_name": {
                                                "type": "string"
                                            },
                                            "company_tax_number": {
                                                "type": "string"
                                            },
                                            "company_registered_office": {
                                                "type": "string"
                                            },
                                            "language": {
                                                "type": "string",
                                                "default": "hu"
                                            }
                                        },
                                        "type": "object"
                                    }
                                },
                                "type": "object"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "User created successfully",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "user_id": {
                                            "type": "integer"
                                        },
                                        "otp_link": {
                                            "type": "string"
                                        },
                                        "subscription_expiry_date": {
                                            "type": "string"
                                        },
                                        "timestamps": {
                                            "type": "integer"
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "400": {
                        "description": "Bad Request / Validation Error",
                        "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": "Unauthorized or Invalid Credentials"
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "sanctum": []
                    }
                ]
            }
        },
        "/api/agent/3rd-party/otp": {
            "post": {
                "tags": [
                    "ThirdParty"
                ],
                "summary": "Get OTP for a user",
                "description": "Generates an OTP magic link for the specified user (likely a sub-account/partner).",
                "operationId": "thirdPartyOtp",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "required": [
                                    "otp_account_user_id",
                                    "otp_link_key"
                                ],
                                "properties": {
                                    "otp_account_user_id": {
                                        "description": "The ID of the user to get OTP for",
                                        "type": "string"
                                    },
                                    "otp_link_key": {
                                        "description": "Validation key (legacy sha1 check)",
                                        "type": "string"
                                    },
                                    "contract_identifier": {
                                        "type": "string",
                                        "nullable": true
                                    }
                                },
                                "type": "object"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "OTP Link generated",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "otp_link": {
                                            "type": "string"
                                        },
                                        "user_id": {
                                            "type": "integer"
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "Forbidden",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "status": {
                                            "type": "string",
                                            "example": "error"
                                        },
                                        "message": {
                                            "type": "string",
                                            "example": "Unauthorized or Invalid Credentials"
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "sanctum": []
                    }
                ]
            }
        },
        "/api/agent/user-info": {
            "get": {
                "tags": [
                    "Users"
                ],
                "summary": "Get user information",
                "description": "Returns information about the authenticated user, including membership details. Requires 'user:read' ability.",
                "operationId": "userInfo",
                "responses": {
                    "200": {
                        "description": "User information retrieved successfully",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "status": {
                                            "type": "string",
                                            "example": "success"
                                        },
                                        "data": {
                                            "$ref": "#/components/schemas/UserInfo"
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Unauthenticated",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "status": {
                                            "type": "string",
                                            "example": "error"
                                        },
                                        "message": {
                                            "type": "string",
                                            "example": "Unauthenticated."
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "Forbidden",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "status": {
                                            "type": "string",
                                            "example": "error"
                                        },
                                        "message": {
                                            "type": "string",
                                            "example": "Unauthorized IP address OR You are not authorized for this operation (user:read)"
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "sanctum": [
                            "user:read"
                        ]
                    }
                ]
            }
        },
        "/api/agent/user/branding": {
            "post": {
                "tags": [
                    "Users"
                ],
                "summary": "Update global account branding",
                "description": "Updates the branding settings for the authenticated user's account. Supports logo and background image uploads. Requires 'user:write' ability.",
                "operationId": "updateBranding",
                "requestBody": {
                    "required": true,
                    "content": {
                        "multipart/form-data": {
                            "schema": {
                                "properties": {
                                    "contract_header_logo": {
                                        "description": "Logo file (png, bmp, jpeg, max 200kb)",
                                        "type": "string",
                                        "format": "binary"
                                    },
                                    "contract_email_header_image": {
                                        "description": "Email header image (png, bmp, jpeg, max 200kb)",
                                        "type": "string",
                                        "format": "binary"
                                    },
                                    "contract_background_image": {
                                        "description": "Contract background image (png, bmp, jpeg, max 300kb)",
                                        "type": "string",
                                        "format": "binary"
                                    },
                                    "contract_header_logo_enabled": {
                                        "type": "boolean"
                                    },
                                    "contract_style_enabled": {
                                        "type": "boolean"
                                    },
                                    "contract_email_heading_enabled": {
                                        "type": "boolean"
                                    },
                                    "contract_header_color": {
                                        "type": "string",
                                        "example": "#ffffff"
                                    },
                                    "contract_email_background_color": {
                                        "type": "string",
                                        "example": "#f0f0f0"
                                    },
                                    "contract_background_color": {
                                        "type": "string",
                                        "example": "#ffffff"
                                    },
                                    "contract_background_position": {
                                        "type": "integer",
                                        "enum": [
                                            0,
                                            1,
                                            2,
                                            3,
                                            4
                                        ]
                                    },
                                    "contract_email_edit_enabled": {
                                        "type": "boolean"
                                    },
                                    "email_text": {
                                        "type": "string"
                                    },
                                    "contract_header_logo_url": {
                                        "description": "URL to a logo image. If provided, it will be downloaded.",
                                        "type": "string"
                                    }
                                },
                                "type": "object"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Branding updated successfully",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "status": {
                                            "type": "string",
                                            "example": "success"
                                        },
                                        "message": {
                                            "type": "string",
                                            "example": "Branding updated successfully"
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "400": {
                        "description": "Validation Error"
                    },
                    "403": {
                        "description": "Forbidden"
                    }
                },
                "security": [
                    {
                        "sanctum": [
                            "user:write"
                        ]
                    }
                ]
            }
        }
    },
    "components": {
        "schemas": {
            "CallbackPayload": {
                "title": "Callback Payload",
                "description": "The payload sent to the callback URL when a contract event occurs",
                "required": [
                    "contract_id",
                    "action",
                    "contract_status"
                ],
                "properties": {
                    "contract_id": {
                        "description": "The ID of the contract",
                        "type": "integer",
                        "example": 12345
                    },
                    "action": {
                        "description": "The action that triggered the callback (e.g., 'signed', 'viewed', 'email_opened')",
                        "type": "string",
                        "example": "signed"
                    },
                    "message": {
                        "description": "Optional message associated with the event",
                        "type": "string",
                        "example": "User signed the document"
                    },
                    "contract_url": {
                        "description": "Direct URL to the contract",
                        "type": "string",
                        "format": "url",
                        "example": "https://eszerzodes.hu/contract/view/..."
                    },
                    "already_signed": {
                        "description": "List of partners who have already signed the contract",
                        "type": "array",
                        "items": {
                            "properties": {
                                "name": {
                                    "type": "string",
                                    "example": "John Doe"
                                },
                                "email": {
                                    "type": "string",
                                    "example": "john@example.com"
                                },
                                "signed_at": {
                                    "type": "string",
                                    "format": "date-time",
                                    "example": "2023-10-27 10:00:00"
                                }
                            },
                            "type": "object"
                        }
                    },
                    "contract_status": {
                        "description": "Current human-readable status of the contract",
                        "type": "string",
                        "example": "Signed by everyone"
                    },
                    "what": {
                        "description": "The latest history log entry for this contract",
                        "properties": {
                            "id": {
                                "type": "integer",
                                "example": 999
                            },
                            "comment": {
                                "type": "string",
                                "example": "Contract signed by Partner"
                            },
                            "created_at": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2023-10-27 10:05:00"
                            }
                        },
                        "type": "object"
                    }
                },
                "type": "object"
            },
            "ContractDetail": {
                "title": "Contract Detail",
                "description": "Detailed information about a single contract, structured similarly to the XML API logic but using JSON conventions",
                "properties": {
                    "identifier": {
                        "type": "integer",
                        "example": 123
                    },
                    "contract_title": {
                        "type": "string",
                        "example": "Service Agreement"
                    },
                    "template_id": {
                        "type": "string",
                        "example": "10"
                    },
                    "template_name": {
                        "type": "string",
                        "example": "B2B English"
                    },
                    "contract_status": {
                        "type": "string",
                        "example": "Waiting for signature"
                    },
                    "own_id": {
                        "type": "string",
                        "example": "MY-INT-123"
                    },
                    "contract_content_raw": {
                        "type": "string",
                        "example": "HTML content with [[variables]]"
                    },
                    "contract_content": {
                        "type": "string",
                        "example": "Parsed HTML content"
                    },
                    "status": {
                        "type": "string",
                        "example": "In progress"
                    },
                    "is_archived": {
                        "description": "Indicates whether the currently logged-in user has archived (hidden) this contract.",
                        "type": "boolean",
                        "example": false
                    },
                    "inside_status": {
                        "type": "string",
                        "example": "Internal approved"
                    },
                    "download_link": {
                        "type": "string",
                        "format": "url",
                        "example": "https://esz.hu/download/..."
                    },
                    "number_of_participants": {
                        "type": "integer",
                        "example": 2
                    },
                    "reference_number": {
                        "type": "string",
                        "example": "REF-2023-XYZ"
                    },
                    "created_at": {
                        "type": "string",
                        "format": "date-time",
                        "example": "2023-10-27 10:00:00"
                    },
                    "last_modification": {
                        "type": "string",
                        "format": "date-time",
                        "example": "2023-10-27 15:30:00"
                    },
                    "contract_signed": {
                        "type": "string",
                        "format": "date-time",
                        "example": "2023-10-30 08:20:00"
                    },
                    "language": {
                        "type": "string",
                        "example": "hu"
                    },
                    "parameters": {
                        "description": "List of template variables/parameters",
                        "type": "array",
                        "items": {
                            "$ref": "#/components/schemas/ContractParameter"
                        }
                    },
                    "partners": {
                        "description": "List of partners involved in the contract",
                        "type": "array",
                        "items": {
                            "$ref": "#/components/schemas/ContractPartner"
                        }
                    },
                    "email_log": {
                        "description": "Email delivery logs (Mailgun status)",
                        "type": "array",
                        "items": {
                            "$ref": "#/components/schemas/ContractEmailLog"
                        }
                    },
                    "event_log": {
                        "description": "Contract history log entries",
                        "type": "array",
                        "items": {
                            "$ref": "#/components/schemas/ContractEventLog"
                        }
                    },
                    "attachments": {
                        "description": "List of contract attachments (invoices, related contracts, hyperlinks, laws)",
                        "type": "array",
                        "items": {
                            "$ref": "#/components/schemas/ContractAttachment"
                        }
                    },
                    "share_with_external": {
                        "description": "List of external shares",
                        "type": "array",
                        "items": {
                            "$ref": "#/components/schemas/ContractShare"
                        }
                    },
                    "contract_public_url": {
                        "type": "boolean",
                        "example": false
                    },
                    "invites": {
                        "description": "List of pending invites (if public url enabled)",
                        "type": "array",
                        "items": {
                            "$ref": "#/components/schemas/ContractInvite"
                        }
                    }
                },
                "type": "object"
            },
            "ContractParameter": {
                "title": "Contract Parameter",
                "properties": {
                    "name": {
                        "type": "string",
                        "example": "price"
                    },
                    "data": {
                        "type": "string",
                        "example": "1000 EUR"
                    }
                },
                "type": "object"
            },
            "ContractPartner": {
                "title": "Contract Partner",
                "properties": {
                    "name": {
                        "type": "string",
                        "example": "John Doe"
                    },
                    "client_title": {
                        "type": "string",
                        "example": "Sender"
                    },
                    "personal_id_number": {
                        "type": "string",
                        "example": "ID-123456"
                    },
                    "address": {
                        "type": "string",
                        "example": "1234 City, Street 1"
                    },
                    "phone": {
                        "type": "string",
                        "example": "+36301234567"
                    },
                    "company_name": {
                        "type": "string",
                        "example": "Example Ltd."
                    },
                    "company_residence": {
                        "type": "string",
                        "example": "1234 City, Street 1"
                    },
                    "mothers_name": {
                        "type": "string",
                        "example": "Mother Name"
                    },
                    "company_tax_number": {
                        "type": "string",
                        "example": "12345678-1-42"
                    },
                    "email": {
                        "type": "string",
                        "example": "partner@example.com"
                    },
                    "birthday": {
                        "type": "string",
                        "format": "date",
                        "example": "1980-01-01"
                    },
                    "place_of_birth": {
                        "type": "string",
                        "example": "City"
                    }
                },
                "type": "object"
            },
            "ContractEmailLog": {
                "title": "Contract Email Log",
                "properties": {
                    "time": {
                        "type": "string",
                        "format": "date-time",
                        "example": "2023-10-27 10:00:00"
                    },
                    "who": {
                        "type": "string",
                        "example": "partner@example.com"
                    },
                    "subject": {
                        "type": "string",
                        "example": "Contract signature request"
                    },
                    "status": {
                        "type": "string",
                        "example": "delivered"
                    },
                    "opened": {
                        "type": "integer",
                        "example": 1
                    },
                    "clicked": {
                        "type": "integer",
                        "example": 0
                    }
                },
                "type": "object"
            },
            "ContractEventLog": {
                "title": "Contract Event Log",
                "properties": {
                    "type": {
                        "type": "string",
                        "example": "signature"
                    },
                    "time": {
                        "type": "string",
                        "format": "date-time",
                        "example": "2023-10-27 10:00:00"
                    },
                    "event": {
                        "type": "string",
                        "example": "Document has been signed"
                    },
                    "ip": {
                        "type": "string",
                        "example": "192.168.1.1"
                    },
                    "hash": {
                        "type": "string",
                        "example": "abcd1234efgh5678..."
                    }
                },
                "type": "object"
            },
            "ContractAttachment": {
                "title": "Contract Attachment",
                "properties": {
                    "type": {
                        "type": "string",
                        "enum": [
                            "invoice",
                            "contract",
                            "hyperlink",
                            "law"
                        ],
                        "example": "invoice"
                    },
                    "attachment_id": {
                        "type": "integer",
                        "example": 999
                    },
                    "title": {
                        "type": "string",
                        "example": "Invoice #12345"
                    },
                    "access": {
                        "type": "string",
                        "enum": [
                            "public",
                            "private"
                        ],
                        "example": "public"
                    },
                    "invoice_type": {
                        "type": "string",
                        "example": "NORM"
                    },
                    "invoice_fulfillment_date": {
                        "type": "string",
                        "format": "date",
                        "example": "2023-10-27"
                    },
                    "invoice_due_date": {
                        "type": "string",
                        "format": "date",
                        "example": "2023-11-04"
                    },
                    "invoice_total": {
                        "type": "string",
                        "example": "1000.00"
                    },
                    "invoice_currency": {
                        "type": "string",
                        "example": "EUR"
                    },
                    "attachment_contract_id": {
                        "type": "integer",
                        "example": 120
                    },
                    "contract_type": {
                        "type": "string",
                        "example": "NDA"
                    },
                    "created_at": {
                        "type": "string",
                        "format": "date-time",
                        "example": "2023-10-25 10:00:00"
                    },
                    "hyperlink_type": {
                        "type": "string",
                        "example": "external"
                    },
                    "description": {
                        "type": "string",
                        "example": "Reference document link"
                    },
                    "visibility": {
                        "type": "string",
                        "example": "public"
                    },
                    "link": {
                        "type": "string",
                        "format": "url",
                        "example": "https://example.com/doc"
                    },
                    "status": {
                        "type": "string",
                        "example": "accepted"
                    },
                    "status_label": {
                        "type": "string",
                        "example": "Accepted"
                    },
                    "canonical_id": {
                        "type": "string",
                        "example": "jurisdiction_123"
                    },
                    "jurisdiction": {
                        "type": "string",
                        "example": "HU"
                    }
                },
                "type": "object"
            },
            "ContractShare": {
                "title": "Contract Share",
                "properties": {
                    "email": {
                        "type": "string",
                        "example": "external@example.com"
                    },
                    "expiration": {
                        "type": "string",
                        "format": "date-time",
                        "example": "2023-11-27 10:00:00"
                    }
                },
                "type": "object"
            },
            "ContractInvite": {
                "title": "Contract Invite",
                "properties": {
                    "email": {
                        "type": "string",
                        "example": "invitee@example.com"
                    },
                    "used": {
                        "type": "boolean",
                        "example": false
                    }
                },
                "type": "object"
            },
            "ContractListItem": {
                "title": "Contract List Item",
                "properties": {
                    "id": {
                        "type": "integer",
                        "example": 123
                    },
                    "subject": {
                        "type": "string",
                        "example": "Service Agreement"
                    },
                    "status": {
                        "type": "string",
                        "example": "Pending"
                    },
                    "owner_user_id": {
                        "type": "integer",
                        "example": 10
                    },
                    "invitee_user_id": {
                        "type": "integer",
                        "example": 20
                    },
                    "finalized_at": {
                        "type": "string",
                        "format": "date-time",
                        "example": "2023-10-30 08:20:00"
                    },
                    "created_at": {
                        "type": "string",
                        "format": "date-time",
                        "example": "2023-10-27 10:00:00"
                    },
                    "contract_type_id": {
                        "type": "string",
                        "example": "10"
                    },
                    "contract_type_title": {
                        "type": "string",
                        "example": "B2B English"
                    },
                    "own_id": {
                        "type": "string",
                        "example": "MY-INT-123"
                    },
                    "contract_label": {
                        "type": "integer",
                        "example": 1
                    },
                    "is_archived": {
                        "description": "Indicates whether the currently logged-in user has archived (hidden) this contract.",
                        "type": "boolean",
                        "example": false
                    },
                    "lang": {
                        "type": "string",
                        "example": "hu"
                    }
                },
                "type": "object"
            },
            "TemplateDetail": {
                "title": "Template Detail",
                "properties": {
                    "head_for_contract": {
                        "properties": {
                            "type_of_contract": {
                                "type": "string",
                                "example": "10"
                            },
                            "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"
                    },
                    "contract_variables": {
                        "type": "array",
                        "items": {
                            "$ref": "#/components/schemas/TemplateVariable"
                        }
                    }
                },
                "type": "object"
            },
            "TemplateVariable": {
                "title": "Template Variable",
                "properties": {
                    "name": {
                        "type": "string",
                        "example": "_1price"
                    },
                    "description": {
                        "type": "string",
                        "example": "Price of the service"
                    },
                    "value": {
                        "type": "string",
                        "example": ""
                    }
                },
                "type": "object"
            },
            "BrandingSettings": {
                "title": "Branding Settings",
                "properties": {
                    "contract_header_logo": {
                        "description": "Filename of the header logo",
                        "type": "string"
                    },
                    "contract_header_logo_enabled": {
                        "type": "boolean"
                    },
                    "contract_header_color": {
                        "type": "string",
                        "example": "#ffffff"
                    },
                    "contract_style_enabled": {
                        "type": "boolean"
                    },
                    "contract_background_color": {
                        "type": "string",
                        "example": "#ffffff"
                    },
                    "contract_background_image": {
                        "description": "Filename of the background image",
                        "type": "string"
                    },
                    "contract_background_position": {
                        "type": "integer"
                    },
                    "contract_email_heading_enabled": {
                        "type": "boolean"
                    },
                    "contract_email_background_color": {
                        "type": "string",
                        "example": "#f0f0f0"
                    },
                    "contract_email_header_image": {
                        "description": "Filename of the email header image",
                        "type": "string"
                    },
                    "contract_email_edit_enabled": {
                        "type": "boolean"
                    },
                    "email_text": {
                        "type": "string"
                    },
                    "for_preview": {
                        "type": "boolean"
                    }
                },
                "type": "object"
            },
            "UserInfo": {
                "title": "User Information",
                "properties": {
                    "id": {
                        "type": "integer",
                        "example": 42
                    },
                    "name": {
                        "type": "string",
                        "example": "Kovács János"
                    },
                    "email": {
                        "type": "string",
                        "example": "janos.kovacs@example.com"
                    },
                    "membership": {
                        "type": "string",
                        "example": "Premium Package"
                    },
                    "credit": {
                        "type": "integer",
                        "example": 150
                    },
                    "membership_ends_at": {
                        "type": "string",
                        "format": "date-time",
                        "example": "2026-12-31 23:59:59"
                    },
                    "branding": {
                        "$ref": "#/components/schemas/BrandingSettings"
                    }
                },
                "type": "object"
            }
        },
        "responses": {
            "422": {
                "description": "Validation Error",
                "content": {
                    "application/json": {
                        "schema": {
                            "properties": {
                                "status": {
                                    "type": "string",
                                    "example": "error"
                                },
                                "message": {
                                    "properties": {
                                        "field_title": {
                                            "type": "array",
                                            "items": {
                                                "type": "string",
                                                "example": "The field title has already been taken."
                                            }
                                        },
                                        "options": {
                                            "type": "array",
                                            "items": {
                                                "type": "string",
                                                "example": "The options field is required."
                                            }
                                        }
                                    },
                                    "type": "object"
                                }
                            },
                            "type": "object"
                        }
                    }
                }
            },
            "400": {
                "description": "Bad Request"
            }
        },
        "securitySchemes": {
            "sanctum": {
                "type": "http",
                "scheme": "bearer"
            }
        }
    },
    "tags": [
        {
            "name": "Ai",
            "description": "Ai"
        },
        {
            "name": "Callbacks",
            "description": "Callbacks"
        },
        {
            "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"
        }
    ]
}