{
    "openapi": "3.0.0",
    "info": {
        "title": "Mozakhtaf API swagger documentation",
        "description": "Mozakhtaf API Documentation",
        "termsOfService": "http://swagger.io/terms/",
        "contact": {
            "email": "a@a.net"
        },
        "license": {
            "name": "Apache 2.0",
            "url": "http://www.apache.org/licenses/LICENSE-2.0.html"
        },
        "version": "1.0.0"
    },
    "paths": {
        "/api": {},
        "/api/field-collection/v1/forms": {
            "get": {
                "tags": [
                    "Field Collection"
                ],
                "summary": "Get the forms assigned to the authenticated employee",
                "operationId": "fieldCollectionV1FormsIndex",
                "responses": {
                    "200": {
                        "description": "Demo form returned successfully",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "data": {
                                            "type": "array",
                                            "items": {
                                                "properties": {
                                                    "form_id": {
                                                        "type": "string",
                                                        "example": "demo-form-1"
                                                    },
                                                    "assignment_id": {
                                                        "type": "string",
                                                        "example": "demo-assignment-1"
                                                    },
                                                    "name": {
                                                        "type": "string",
                                                        "example": "نموذج حصر الحرف والمهن"
                                                    },
                                                    "purpose": {
                                                        "type": "string",
                                                        "example": "جمع بيانات الحرف ميدانيًا"
                                                    },
                                                    "status": {
                                                        "type": "string",
                                                        "example": "published"
                                                    },
                                                    "fields": {
                                                        "type": "array",
                                                        "items": {
                                                            "properties": {
                                                                "id": {
                                                                    "type": "string",
                                                                    "example": "craft_type"
                                                                },
                                                                "label": {
                                                                    "type": "string",
                                                                    "example": "نوع الحرفة"
                                                                },
                                                                "type": {
                                                                    "type": "string",
                                                                    "enum": [
                                                                        "text",
                                                                        "phone",
                                                                        "date",
                                                                        "number",
                                                                        "textarea",
                                                                        "select",
                                                                        "boolean",
                                                                        "checkboxes",
                                                                        "radio",
                                                                        "rating",
                                                                        "files",
                                                                        "section"
                                                                    ],
                                                                    "example": "select"
                                                                },
                                                                "required": {
                                                                    "type": "boolean",
                                                                    "example": true
                                                                },
                                                                "order": {
                                                                    "type": "integer",
                                                                    "example": 3
                                                                },
                                                                "options": {
                                                                    "type": "array",
                                                                    "items": {
                                                                        "properties": {
                                                                            "value": {
                                                                                "type": "string",
                                                                                "example": "pottery"
                                                                            },
                                                                            "label": {
                                                                                "type": "string",
                                                                                "example": "فخار"
                                                                            }
                                                                        },
                                                                        "type": "object"
                                                                    },
                                                                    "nullable": true
                                                                }
                                                            },
                                                            "type": "object"
                                                        }
                                                    },
                                                    "sections": {
                                                        "type": "array",
                                                        "items": {
                                                            "properties": {
                                                                "id": {
                                                                    "type": "string",
                                                                    "example": "work_locations"
                                                                },
                                                                "label": {
                                                                    "type": "string",
                                                                    "example": "مواقع العمل"
                                                                },
                                                                "type": {
                                                                    "type": "string",
                                                                    "example": "section"
                                                                },
                                                                "repeatable": {
                                                                    "type": "boolean",
                                                                    "example": true
                                                                },
                                                                "fields": {
                                                                    "type": "array",
                                                                    "items": {
                                                                        "type": "object"
                                                                    }
                                                                }
                                                            },
                                                            "type": "object"
                                                        }
                                                    }
                                                },
                                                "type": "object"
                                            }
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Unauthenticated"
                    },
                    "422": {
                        "description": "User is not allowed to access field collection forms"
                    }
                },
                "security": [
                    {
                        "api_key": []
                    }
                ]
            }
        },
        "/api/field-collection/v1/submissions": {
            "post": {
                "tags": [
                    "Field Collection"
                ],
                "summary": "Store a field collection submission",
                "operationId": "fieldCollectionV1SubmissionsStore",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "required": [
                                    "form_id",
                                    "assignment_id",
                                    "answers"
                                ],
                                "properties": {
                                    "form_id": {
                                        "type": "string",
                                        "example": "demo-form-1"
                                    },
                                    "assignment_id": {
                                        "type": "string",
                                        "example": "demo-assignment-1"
                                    },
                                    "answers": {
                                        "required": [
                                            "craft_name",
                                            "owner_name",
                                            "craft_type",
                                            "visit_date"
                                        ],
                                        "properties": {
                                            "craft_name": {
                                                "type": "string",
                                                "example": "صناعة الفخار"
                                            },
                                            "owner_name": {
                                                "type": "string",
                                                "example": "أحمد محمد"
                                            },
                                            "craft_type": {
                                                "type": "string",
                                                "enum": [
                                                    "wood",
                                                    "pottery",
                                                    "textile"
                                                ],
                                                "example": "pottery"
                                            },
                                            "mobile": {
                                                "type": "string",
                                                "example": "0590000000",
                                                "nullable": true
                                            },
                                            "visit_date": {
                                                "type": "string",
                                                "format": "date",
                                                "example": "2026-08-05"
                                            },
                                            "latitude": {
                                                "type": "number",
                                                "format": "float",
                                                "example": 31.9,
                                                "nullable": true
                                            },
                                            "longitude": {
                                                "type": "number",
                                                "format": "float",
                                                "example": 35.2,
                                                "nullable": true
                                            },
                                            "notes": {
                                                "type": "string",
                                                "example": "تمت الزيارة بنجاح",
                                                "nullable": true
                                            },
                                            "is_operating": {
                                                "type": "boolean",
                                                "example": true
                                            },
                                            "available_services": {
                                                "type": "array",
                                                "items": {
                                                    "type": "string",
                                                    "enum": [
                                                        "retail",
                                                        "custom_orders",
                                                        "training"
                                                    ]
                                                }
                                            },
                                            "ownership_type": {
                                                "type": "string",
                                                "enum": [
                                                    "owned",
                                                    "rented",
                                                    "shared"
                                                ],
                                                "example": "owned"
                                            },
                                            "quality_rating": {
                                                "type": "integer",
                                                "maximum": 100,
                                                "minimum": 1,
                                                "example": 85,
                                                "nullable": true
                                            },
                                            "supporting_files": {
                                                "type": "array",
                                                "items": {
                                                    "type": "string",
                                                    "format": "binary"
                                                },
                                                "nullable": true
                                            },
                                            "work_locations": {
                                                "type": "array",
                                                "items": {
                                                    "required": [
                                                        "location_name",
                                                        "is_primary"
                                                    ],
                                                    "properties": {
                                                        "location_name": {
                                                            "type": "string",
                                                            "example": "الموقع الرئيسي"
                                                        },
                                                        "is_primary": {
                                                            "type": "boolean",
                                                            "example": true
                                                        }
                                                    },
                                                    "type": "object"
                                                }
                                            }
                                        },
                                        "type": "object"
                                    }
                                },
                                "type": "object"
                            },
                            "example": {
                                "form_id": "demo-form-1",
                                "assignment_id": "demo-assignment-1",
                                "answers": {
                                    "craft_name": "صناعة الفخار",
                                    "owner_name": "أحمد محمد",
                                    "craft_type": "pottery",
                                    "mobile": "0590000000",
                                    "visit_date": "2026-08-05",
                                    "latitude": 31.9,
                                    "longitude": 35.2,
                                    "notes": "تمت الزيارة بنجاح",
                                    "is_operating": true,
                                    "available_services": [
                                        "retail",
                                        "custom_orders"
                                    ],
                                    "ownership_type": "owned",
                                    "quality_rating": 85,
                                    "supporting_files": [
                                        "craft-front.jpg",
                                        "craft-license.pdf"
                                    ],
                                    "work_locations": [
                                        {
                                            "location_name": "الموقع الرئيسي",
                                            "is_primary": true
                                        },
                                        {
                                            "location_name": "نقطة البيع الثانية",
                                            "is_primary": false
                                        }
                                    ]
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "Submission stored successfully",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "data": {
                                            "properties": {
                                                "id": {
                                                    "type": "integer",
                                                    "example": 1
                                                },
                                                "public_id": {
                                                    "type": "string",
                                                    "format": "uuid",
                                                    "example": "550e8400-e29b-41d4-a716-446655440000"
                                                },
                                                "form_id": {
                                                    "type": "string",
                                                    "example": "demo-form-1"
                                                },
                                                "assignment_id": {
                                                    "type": "string",
                                                    "example": "demo-assignment-1"
                                                },
                                                "employee_id": {
                                                    "type": "integer",
                                                    "example": 25
                                                },
                                                "answers": {
                                                    "type": "object"
                                                },
                                                "status": {
                                                    "type": "string",
                                                    "example": "submitted"
                                                },
                                                "submitted_at": {
                                                    "type": "string",
                                                    "format": "date-time",
                                                    "example": "2026-08-05T10:30:00Z"
                                                }
                                            },
                                            "type": "object"
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Unauthenticated"
                    },
                    "422": {
                        "description": "Validation failure or user is not allowed to submit data"
                    }
                },
                "security": [
                    {
                        "api_key": []
                    }
                ]
            }
        },
        "/api/jomhor/login": {
            "post": {
                "tags": [
                    "Jomhor Authentication"
                ],
                "summary": "Citizen login",
                "description": "Authenticate a citizen using national ID and password, returns a Sanctum token",
                "operationId": "jomhorLogin",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "required": [
                                    "national_id",
                                    "password"
                                ],
                                "properties": {
                                    "national_id": {
                                        "description": "Citizen national ID",
                                        "type": "string",
                                        "example": "1234567890"
                                    },
                                    "password": {
                                        "description": "Citizen password",
                                        "type": "string",
                                        "format": "password",
                                        "example": "secret123"
                                    }
                                },
                                "type": "object"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Login successful",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "status": {
                                            "type": "boolean",
                                            "example": true
                                        },
                                        "message": {
                                            "type": "string",
                                            "example": "تم تسجيل الدخول بنجاح"
                                        },
                                        "token": {
                                            "type": "string",
                                            "example": "1|abc123..."
                                        },
                                        "citizen": {
                                            "type": "object"
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Invalid credentials",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "status": {
                                            "type": "boolean",
                                            "example": false
                                        },
                                        "message": {
                                            "type": "string",
                                            "example": "بيانات الدخول غير صحيحة"
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/api/jomhor/logout": {
            "post": {
                "tags": [
                    "Jomhor Authentication"
                ],
                "summary": "Citizen logout",
                "description": "Logout the authenticated citizen and delete the current access token",
                "operationId": "jomhorLogout",
                "responses": {
                    "200": {
                        "description": "Logout successful",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "status": {
                                            "type": "boolean",
                                            "example": true
                                        },
                                        "message": {
                                            "type": "string",
                                            "example": "تم تسجيل الخروج بنجاح"
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Unauthenticated"
                    }
                },
                "security": [
                    {
                        "api_key": []
                    }
                ]
            }
        },
        "/api/jomhor/services/{service}/save": {
            "post": {
                "tags": [
                    "Jomhor Services"
                ],
                "summary": "Submit a new service request",
                "description": "Submit a new service request with address details and optional attachments",
                "operationId": "jomhorSaveService",
                "parameters": [
                    {
                        "name": "service",
                        "in": "path",
                        "description": "Service template ID",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "example": 1
                        }
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "multipart/form-data": {
                            "schema": {
                                "required": [
                                    "street_number",
                                    "building_number",
                                    "block",
                                    "address_text",
                                    "service_details"
                                ],
                                "properties": {
                                    "street_number": {
                                        "description": "4-digit street number",
                                        "type": "string",
                                        "example": "1234"
                                    },
                                    "building_number": {
                                        "description": "Building number",
                                        "type": "string",
                                        "example": "56"
                                    },
                                    "postal_code": {
                                        "description": "Postal code",
                                        "type": "string",
                                        "example": "P1234567",
                                        "nullable": true
                                    },
                                    "block": {
                                        "description": "Block identifier",
                                        "type": "string",
                                        "example": "A"
                                    },
                                    "address_text": {
                                        "description": "Full address text",
                                        "type": "string",
                                        "example": "شارع الملك فهد"
                                    },
                                    "service_details": {
                                        "description": "Service request details (5-400 chars)",
                                        "type": "string",
                                        "example": "طلب صيانة للطريق"
                                    },
                                    "service_comments": {
                                        "description": "Additional comments",
                                        "type": "string",
                                        "nullable": true
                                    },
                                    "attachment[]": {
                                        "description": "Attachments (jpg, jpeg, png, pdf, max 6MB each)",
                                        "type": "array",
                                        "items": {
                                            "type": "string",
                                            "format": "binary"
                                        }
                                    }
                                },
                                "type": "object"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Service request submitted successfully",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "status": {
                                            "type": "boolean",
                                            "example": true
                                        },
                                        "message": {
                                            "type": "string",
                                            "example": "تمت العملية بنجاح"
                                        },
                                        "has_fees": {
                                            "type": "boolean",
                                            "example": false
                                        },
                                        "service": {
                                            "type": "object"
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "Validation error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "message": {
                                            "type": "string",
                                            "example": "The street number field is required."
                                        },
                                        "errors": {
                                            "type": "object"
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Unauthenticated"
                    },
                    "500": {
                        "description": "Server error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "status": {
                                            "type": "boolean",
                                            "example": false
                                        },
                                        "message": {
                                            "type": "string"
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "api_key": []
                    }
                ]
            }
        },
        "/api/jomhor/services/add_payment": {
            "post": {
                "tags": [
                    "payment Services"
                ],
                "summary": "Submit a new service request",
                "description": "Submit a new service request with address details and optional attachments",
                "operationId": "add_payment",
                "requestBody": {
                    "required": true,
                    "content": {
                        "multipart/form-data": {
                            "schema": {
                                "required": [
                                    "service_public_id",
                                    "account_holder_name"
                                ],
                                "properties": {
                                    "service_public_id": {
                                        "description": "service_public_id",
                                        "type": "string",
                                        "example": "1234"
                                    },
                                    "account_holder_name": {
                                        "description": "account_holder_name",
                                        "type": "string",
                                        "example": "56"
                                    }
                                },
                                "type": "object"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Service request submitted successfully",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "status": {
                                            "type": "boolean",
                                            "example": true
                                        },
                                        "message": {
                                            "type": "string",
                                            "example": "تمت العملية بنجاح"
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "Validation error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "message": {
                                            "type": "string",
                                            "example": "The street number field is required."
                                        },
                                        "errors": {
                                            "type": "object"
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Unauthenticated"
                    },
                    "500": {
                        "description": "Server error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "status": {
                                            "type": "boolean",
                                            "example": false
                                        },
                                        "message": {
                                            "type": "string"
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "api_key": []
                    }
                ]
            }
        },
        "/api/jomhor/sync/services": {
            "get": {
                "tags": [
                    "sync_services"
                ],
                "description": "Submit a new service request with address details and optional attachments",
                "operationId": "sync_services",
                "responses": {
                    "200": {
                        "description": "Service request submitted successfully",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "status": {
                                            "type": "boolean",
                                            "example": true
                                        },
                                        "message": {
                                            "type": "string",
                                            "example": "تمت العملية بنجاح"
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "Validation error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "message": {
                                            "type": "string",
                                            "example": "The street number field is required."
                                        },
                                        "errors": {
                                            "type": "object"
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Unauthenticated"
                    },
                    "500": {
                        "description": "Server error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "status": {
                                            "type": "boolean",
                                            "example": false
                                        },
                                        "message": {
                                            "type": "string"
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "api_key": []
                    }
                ]
            }
        },
        "/api/jomhor/v2/auth/precheck": {
            "post": {
                "tags": [
                    "Jomhor V2 Auth"
                ],
                "summary": "Start citizen verification",
                "operationId": "jomhorV2AuthPrecheck",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "required": [
                                    "national_id",
                                    "birth_date"
                                ],
                                "properties": {
                                    "national_id": {
                                        "type": "string",
                                        "example": "123456789"
                                    },
                                    "birth_date": {
                                        "type": "string",
                                        "format": "date",
                                        "example": "1990-01-15"
                                    }
                                },
                                "type": "object"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Verification questions generated",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "data": {
                                            "$ref": "#/components/schemas/JomhorV2VerificationPrecheck"
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "Validation or business-rule failure"
                    }
                }
            }
        },
        "/api/jomhor/v2/auth/verify": {
            "post": {
                "tags": [
                    "Jomhor V2 Auth"
                ],
                "summary": "Complete citizen verification and issue app token",
                "operationId": "jomhorV2AuthVerify",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "required": [
                                    "verification_session_id",
                                    "national_id",
                                    "answers"
                                ],
                                "properties": {
                                    "verification_session_id": {
                                        "type": "integer",
                                        "example": 12
                                    },
                                    "national_id": {
                                        "type": "string",
                                        "example": "123456789"
                                    },
                                    "answers": {
                                        "type": "object",
                                        "example": {
                                            "father_id_number": "111111111",
                                            "mother_birth_date": "1970-05-20"
                                        }
                                    }
                                },
                                "type": "object"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Citizen verified successfully",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "data": {
                                            "properties": {
                                                "token": {
                                                    "type": "string",
                                                    "example": "1|token"
                                                },
                                                "citizen": {
                                                    "$ref": "#/components/schemas/JomhorV2CitizenSummary"
                                                }
                                            },
                                            "type": "object"
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "Validation or business-rule failure"
                    }
                }
            }
        },
        "/api/jomhor/v2/employee/auth/login": {
            "post": {
                "tags": [
                    "Jomhor V2 Employee Auth"
                ],
                "summary": "Login an employee user",
                "operationId": "jomhorV2EmployeeAuthLogin",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "required": [
                                    "username",
                                    "password"
                                ],
                                "properties": {
                                    "username": {
                                        "description": "Employee identity number stored in users.email",
                                        "type": "string",
                                        "example": "987654321"
                                    },
                                    "password": {
                                        "type": "string",
                                        "format": "password",
                                        "example": "secret123"
                                    }
                                },
                                "type": "object"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Employee logged in successfully",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "data": {
                                            "properties": {
                                                "token": {
                                                    "type": "string",
                                                    "example": "1|token"
                                                },
                                                "user": {
                                                    "$ref": "#/components/schemas/JomhorV2EmployeeUser"
                                                }
                                            },
                                            "type": "object"
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Invalid credentials"
                    },
                    "422": {
                        "description": "Validation failure or employee not allowed"
                    }
                }
            }
        },
        "/api/jomhor/v2/employee/auth/logout": {
            "post": {
                "tags": [
                    "Jomhor V2 Employee Auth"
                ],
                "summary": "Logout the authenticated employee token",
                "operationId": "jomhorV2EmployeeAuthLogout",
                "responses": {
                    "200": {
                        "description": "Employee logged out successfully",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "data": {
                                            "properties": {
                                                "message": {
                                                    "type": "string",
                                                    "example": "Logged out successfully."
                                                }
                                            },
                                            "type": "object"
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Unauthenticated"
                    }
                },
                "security": [
                    {
                        "api_key": []
                    }
                ]
            }
        },
        "/api/jomhor/v2/employee/services": {
            "get": {
                "tags": [
                    "Jomhor V2 Employee Services"
                ],
                "summary": "List all services currently assigned to the authenticated employee",
                "operationId": "jomhorV2EmployeeServicesIndex",
                "responses": {
                    "200": {
                        "description": "Employee assigned services returned successfully",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "data": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/JomhorV2EmployeeService"
                                            }
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Unauthenticated"
                    },
                    "422": {
                        "description": "User is not allowed to access employee services"
                    }
                },
                "security": [
                    {
                        "api_key": []
                    }
                ]
            }
        },
        "/api/jomhor/v2/employee/services/{service}/reply": {
            "post": {
                "tags": [
                    "Jomhor V2 Employee Services"
                ],
                "summary": "Submit an employee reply on an assigned service",
                "operationId": "jomhorV2EmployeeServicesReply",
                "parameters": [
                    {
                        "name": "service",
                        "in": "path",
                        "description": "Service public ID",
                        "required": true,
                        "schema": {
                            "type": "string",
                            "example": "01KVMSE1QRPF02HRG5HZQC1B53"
                        }
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "required": [
                                    "action",
                                    "response"
                                ],
                                "properties": {
                                    "action": {
                                        "type": "string",
                                        "enum": [
                                            "accept",
                                            "reject",
                                            "hold",
                                            "forward"
                                        ],
                                        "example": "accept"
                                    },
                                    "response": {
                                        "type": "string",
                                        "example": "Approved by employee API."
                                    },
                                    "citizen_response_summary": {
                                        "type": "string",
                                        "example": "Please update the citizen with this note.",
                                        "nullable": true
                                    }
                                },
                                "type": "object"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Employee reply submitted successfully",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "data": {
                                            "properties": {
                                                "message": {
                                                    "type": "string",
                                                    "example": "Service reply submitted successfully."
                                                },
                                                "service": {
                                                    "$ref": "#/components/schemas/JomhorV2EmployeeService"
                                                }
                                            },
                                            "type": "object"
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Unauthenticated"
                    },
                    "404": {
                        "description": "Service not found"
                    },
                    "422": {
                        "description": "Validation failure, invalid action, or employee not allowed"
                    }
                },
                "security": [
                    {
                        "api_key": []
                    }
                ]
            }
        },
        "/api/jomhor/v2/invoices": {
            "get": {
                "tags": [
                    "Jomhor V2 Invoices"
                ],
                "summary": "List authenticated citizen subscriptions with latest invoice details",
                "operationId": "jomhorV2InvoicesIndex",
                "responses": {
                    "200": {
                        "description": "Citizen invoices list"
                    },
                    "401": {
                        "description": "Unauthenticated"
                    }
                },
                "security": [
                    {
                        "api_key": []
                    }
                ]
            }
        },
        "/api/jomhor/v2/profile": {
            "put": {
                "tags": [
                    "Jomhor V2 Profile"
                ],
                "summary": "Update citizen profile",
                "operationId": "jomhorV2UpdateProfile",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "required": [
                                    "mobile"
                                ],
                                "properties": {
                                    "mobile": {
                                        "type": "string",
                                        "example": "0599111222"
                                    },
                                    "email": {
                                        "type": "string",
                                        "example": "updated@example.com",
                                        "nullable": true
                                    },
                                    "whatsapp_number": {
                                        "type": "string",
                                        "example": "0599333444",
                                        "nullable": true
                                    }
                                },
                                "type": "object"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Profile updated successfully"
                    },
                    "401": {
                        "description": "Unauthenticated"
                    },
                    "422": {
                        "description": "Validation failure"
                    }
                },
                "security": [
                    {
                        "api_key": []
                    }
                ]
            }
        },
        "/api/jomhor/v2/services": {
            "get": {
                "tags": [
                    "Jomhor V2 Services"
                ],
                "summary": "List citizen services",
                "operationId": "jomhorV2ServicesIndex",
                "parameters": [
                    {
                        "name": "from_date",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string",
                            "format": "date"
                        }
                    },
                    {
                        "name": "to_date",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string",
                            "format": "date"
                        }
                    },
                    {
                        "name": "status",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "page",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Citizen services list",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "data": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/JomhorV2ServiceListItem"
                                            }
                                        },
                                        "meta": {
                                            "$ref": "#/components/schemas/JomhorV2PaginationMeta"
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Unauthenticated"
                    },
                    "422": {
                        "description": "Validation failure"
                    }
                },
                "security": [
                    {
                        "api_key": []
                    }
                ]
            }
        },
        "/api/jomhor/v2/settings": {
            "get": {
                "tags": [
                    "Settings"
                ],
                "summary": "Settings",
                "operationId": "settings",
                "responses": {
                    "200": {
                        "description": "Citizen services list"
                    },
                    "401": {
                        "description": "Unauthenticated"
                    },
                    "422": {
                        "description": "Validation failure"
                    }
                },
                "security": [
                    {
                        "api_key": []
                    }
                ]
            }
        },
        "/api/jomhor/v2/services/{service}": {
            "get": {
                "tags": [
                    "Jomhor V2 Services"
                ],
                "summary": "Show citizen service details",
                "operationId": "jomhorV2ServicesShow",
                "parameters": [
                    {
                        "name": "service",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Citizen service details",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "data": {
                                            "$ref": "#/components/schemas/JomhorV2ServiceDetail"
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Unauthenticated"
                    },
                    "404": {
                        "description": "Service not found"
                    }
                },
                "security": [
                    {
                        "api_key": []
                    }
                ]
            }
        },
        "/api/jomhor/v2/services/{serviceTemplate}/save": {
            "post": {
                "tags": [
                    "Jomhor V2 Services"
                ],
                "summary": "Create a citizen service request",
                "operationId": "jomhorV2ServicesStore",
                "parameters": [
                    {
                        "name": "serviceTemplate",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "multipart/form-data": {
                            "schema": {
                                "required": [
                                    "latitude",
                                    "longitude",
                                    "service_details"
                                ],
                                "properties": {
                                    "latitude": {
                                        "type": "number",
                                        "format": "double",
                                        "example": 31.5065001
                                    },
                                    "longitude": {
                                        "type": "number",
                                        "format": "double",
                                        "example": 34.4578002
                                    },
                                    "street_number": {
                                        "type": "string",
                                        "example": "1234",
                                        "nullable": true
                                    },
                                    "building_number": {
                                        "type": "string",
                                        "example": "56",
                                        "nullable": true
                                    },
                                    "postal_code": {
                                        "type": "string",
                                        "example": "P1234567",
                                        "nullable": true
                                    },
                                    "block": {
                                        "type": "string",
                                        "example": "A",
                                        "nullable": true
                                    },
                                    "address_text": {
                                        "type": "string",
                                        "example": "Main street address",
                                        "nullable": true
                                    },
                                    "service_details": {
                                        "type": "string",
                                        "example": "Need help with this service request."
                                    },
                                    "service_comments": {
                                        "type": "string",
                                        "example": "Extra note",
                                        "nullable": true
                                    },
                                    "attachment[]": {
                                        "type": "array",
                                        "items": {
                                            "type": "string",
                                            "format": "binary"
                                        }
                                    }
                                },
                                "type": "object"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Service created successfully",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "data": {
                                            "$ref": "#/components/schemas/JomhorV2ServiceStoreResult"
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Unauthenticated"
                    },
                    "422": {
                        "description": "Validation failure"
                    }
                },
                "security": [
                    {
                        "api_key": []
                    }
                ]
            }
        },
        "/api/jomhor/v2/services/add_payment": {
            "post": {
                "tags": [
                    "Jomhor V2 Services"
                ],
                "summary": "Confirm citizen service payment",
                "operationId": "jomhorV2ServicesAddPayment",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "required": [
                                    "service_public_id",
                                    "account_holder_name"
                                ],
                                "properties": {
                                    "service_public_id": {
                                        "type": "string",
                                        "example": "01JABCDEF1234567890"
                                    },
                                    "account_holder_name": {
                                        "type": "string",
                                        "example": "Citizen Holder"
                                    }
                                },
                                "type": "object"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Payment confirmation submitted successfully",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "data": {
                                            "properties": {
                                                "message": {
                                                    "type": "string",
                                                    "example": "Payment confirmation submitted successfully."
                                                },
                                                "payment": {
                                                    "$ref": "#/components/schemas/JomhorV2PaymentAttempt"
                                                }
                                            },
                                            "type": "object"
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Unauthenticated"
                    },
                    "404": {
                        "description": "Service not found"
                    },
                    "422": {
                        "description": "Validation failure"
                    }
                },
                "security": [
                    {
                        "api_key": []
                    }
                ]
            }
        },
        "/api/jomhor/v2/services/{service}/add_attachments": {
            "post": {
                "tags": [
                    "Jomhor V2 Services"
                ],
                "summary": "Upload citizen-requested attachments",
                "operationId": "jomhorV2ServicesAddAttachments",
                "parameters": [
                    {
                        "name": "service",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "multipart/form-data": {
                            "schema": {
                                "properties": {
                                    "attachment[]": {
                                        "type": "array",
                                        "items": {
                                            "type": "string",
                                            "format": "binary"
                                        }
                                    }
                                },
                                "type": "object"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Requested attachments uploaded successfully",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "data": {
                                            "$ref": "#/components/schemas/JomhorV2AttachmentUploadResult"
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Unauthenticated"
                    },
                    "404": {
                        "description": "Service not found"
                    },
                    "422": {
                        "description": "Validation or business-rule failure"
                    }
                },
                "security": [
                    {
                        "api_key": []
                    }
                ]
            }
        },
        "/api/get_all_buildings_data": {
            "get": {
                "tags": [
                    "MainApiSection"
                ],
                "summary": "Get get_all_buildings_data API",
                "description": "Get get_all_buildings_data service",
                "operationId": "get_all_buildings_data",
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "array",
                                    "items": {
                                        "type": "object"
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    },
    "components": {
        "schemas": {
            "JomhorV2VerificationPrecheck": {
                "properties": {
                    "is_valid": {
                        "type": "boolean",
                        "example": true
                    },
                    "verification_session_id": {
                        "type": "integer",
                        "example": 12
                    },
                    "expires_at": {
                        "type": "string",
                        "format": "date-time"
                    },
                    "questions": {
                        "type": "array",
                        "items": {
                            "$ref": "#/components/schemas/JomhorV2VerificationQuestion"
                        }
                    }
                },
                "type": "object"
            },
            "JomhorV2VerificationQuestion": {
                "properties": {
                    "key": {
                        "type": "string",
                        "example": "father_id_number"
                    },
                    "label": {
                        "type": "string",
                        "example": "ما رقم هوية الأب؟"
                    }
                },
                "type": "object"
            },
            "JomhorV2CitizenSummary": {
                "properties": {
                    "id": {
                        "type": "integer",
                        "example": 1
                    },
                    "national_id": {
                        "type": "string",
                        "example": "123456789"
                    },
                    "full_name": {
                        "type": "string",
                        "example": "Citizen Name"
                    },
                    "mobile": {
                        "type": "string",
                        "example": "0599000011",
                        "nullable": true
                    },
                    "whatsapp_number": {
                        "type": "string",
                        "example": "0599333444",
                        "nullable": true
                    },
                    "email": {
                        "type": "string",
                        "example": "citizen@example.com",
                        "nullable": true
                    },
                    "image": {
                        "type": "string",
                        "example": "https://example.com/citizen.jpg",
                        "nullable": true
                    }
                },
                "type": "object"
            },
            "JomhorV2EmployeeService": {
                "type": "object",
                "allOf": [
                    {
                        "$ref": "#/components/schemas/JomhorV2ServiceDetail"
                    },
                    {
                        "properties": {
                            "responses": {
                                "type": "array",
                                "items": {
                                    "$ref": "#/components/schemas/JomhorV2EmployeeServiceResponse"
                                }
                            },
                            "active_path": {
                                "type": "object",
                                "nullable": true
                            },
                            "allowed_actions": {
                                "type": "array",
                                "items": {
                                    "type": "string",
                                    "example": "accept"
                                }
                            }
                        },
                        "type": "object"
                    }
                ]
            },
            "JomhorV2EmployeeServiceResponse": {
                "properties": {
                    "id": {
                        "type": "integer",
                        "example": 1
                    },
                    "response_text": {
                        "type": "string",
                        "example": "Initial employee note."
                    },
                    "response_view": {
                        "type": "string",
                        "example": "general_response"
                    },
                    "response_action": {
                        "type": "string",
                        "example": "accept"
                    },
                    "created_at": {
                        "type": "string",
                        "format": "date-time"
                    },
                    "employee": {
                        "properties": {
                            "id": {
                                "type": "integer",
                                "example": 4
                            },
                            "name": {
                                "type": "string",
                                "example": "API Employee"
                            },
                            "user_id": {
                                "type": "integer",
                                "example": 2
                            }
                        },
                        "type": "object"
                    }
                },
                "type": "object"
            },
            "JomhorV2EmployeeUser": {
                "properties": {
                    "id": {
                        "type": "integer",
                        "example": 1
                    },
                    "name": {
                        "type": "string",
                        "example": "API Employee"
                    },
                    "mobile": {
                        "type": "string",
                        "example": "0599000000"
                    },
                    "email": {
                        "type": "string",
                        "example": "987654321"
                    },
                    "employee_id": {
                        "type": "integer",
                        "example": 4
                    },
                    "employee_name": {
                        "type": "string",
                        "example": "API Employee"
                    },
                    "job_places": {
                        "type": "array",
                        "items": {
                            "properties": {
                                "id": {
                                    "type": "integer",
                                    "example": 1
                                },
                                "name": {
                                    "type": "string",
                                    "example": "Employee Desk"
                                }
                            },
                            "type": "object"
                        }
                    }
                },
                "type": "object"
            },
            "JomhorV2AttachmentUploadResult": {
                "properties": {
                    "message": {
                        "type": "string",
                        "example": "Requested attachments uploaded successfully."
                    },
                    "service_id": {
                        "type": "integer",
                        "example": 5
                    },
                    "uploaded_attachments_count": {
                        "type": "integer",
                        "example": 2
                    }
                },
                "type": "object"
            },
            "JomhorV2PaymentAttempt": {
                "properties": {
                    "id": {
                        "type": "integer",
                        "example": 1
                    },
                    "service_id": {
                        "type": "integer",
                        "example": 10
                    },
                    "citizen_id": {
                        "type": "integer",
                        "example": 2
                    },
                    "amount": {
                        "type": "number",
                        "format": "float",
                        "example": 25
                    },
                    "account_holder_name": {
                        "type": "string",
                        "example": "Citizen Holder"
                    },
                    "status": {
                        "type": "string",
                        "example": "pending"
                    }
                },
                "type": "object"
            },
            "JomhorV2PaginationMeta": {
                "properties": {
                    "current_page": {
                        "type": "integer",
                        "example": 1
                    },
                    "last_page": {
                        "type": "integer",
                        "example": 1
                    },
                    "per_page": {
                        "type": "integer",
                        "example": 15
                    },
                    "total": {
                        "type": "integer",
                        "example": 1
                    }
                },
                "type": "object"
            },
            "JomhorV2ServiceDetail": {
                "type": "object",
                "allOf": [
                    {
                        "$ref": "#/components/schemas/JomhorV2ServiceListItem"
                    },
                    {
                        "properties": {
                            "citizen": {
                                "$ref": "#/components/schemas/JomhorV2CitizenSummary"
                            },
                            "paths": {
                                "type": "array",
                                "items": {
                                    "type": "object"
                                }
                            },
                            "attachments": {
                                "type": "array",
                                "items": {
                                    "type": "object"
                                }
                            },
                            "requires_citizen_action": {
                                "type": "boolean",
                                "example": true
                            },
                            "citizen_action_type": {
                                "type": "string",
                                "example": "requested_attachments",
                                "nullable": true
                            },
                            "citizen_action_payload": {
                                "type": "object",
                                "nullable": true
                            }
                        },
                        "type": "object"
                    }
                ]
            },
            "JomhorV2ServiceListItem": {
                "properties": {
                    "id": {
                        "type": "integer",
                        "example": 1
                    },
                    "public_id": {
                        "type": "string",
                        "example": "01JABCDEF1234567890"
                    },
                    "service_code": {
                        "type": "string",
                        "example": "P20260610001"
                    },
                    "service_status": {
                        "type": "string",
                        "example": "hold"
                    },
                    "service_details": {
                        "type": "string",
                        "nullable": true
                    },
                    "service_comments": {
                        "type": "string",
                        "nullable": true
                    },
                    "service_fees": {
                        "type": "integer",
                        "example": 0
                    },
                    "is_fees_collected": {
                        "type": "integer",
                        "example": 0
                    },
                    "added_at": {
                        "type": "string",
                        "format": "date-time",
                        "nullable": true
                    },
                    "due_date": {
                        "type": "string",
                        "format": "date-time",
                        "nullable": true
                    },
                    "service_template": {
                        "properties": {
                            "id": {
                                "type": "integer"
                            },
                            "name": {
                                "type": "string"
                            }
                        },
                        "type": "object"
                    },
                    "service_category": {
                        "properties": {
                            "id": {
                                "type": "integer"
                            },
                            "name": {
                                "type": "string"
                            }
                        },
                        "type": "object"
                    }
                },
                "type": "object"
            },
            "JomhorV2ServiceStoreResult": {
                "properties": {
                    "message": {
                        "type": "string",
                        "example": "Service request created successfully."
                    },
                    "has_fees": {
                        "type": "boolean",
                        "example": false
                    },
                    "service": {
                        "$ref": "#/components/schemas/JomhorV2ServiceDetail"
                    }
                },
                "type": "object"
            }
        },
        "securitySchemes": {
            "api_key": {
                "type": "apiKey",
                "description": "send Bearer token",
                "name": "Authorization",
                "in": "header",
                "scheme": "Bearer"
            }
        }
    },
    "tags": [
        {
            "name": "Field Collection",
            "description": "Field collection form and submission APIs"
        },
        {
            "name": "Jomhor Authentication",
            "description": "Citizen authentication endpoints"
        },
        {
            "name": "Jomhor Services",
            "description": "Citizen service request endpoints"
        },
        {
            "name": "Jomhor V2 Auth",
            "description": "Jomhor mobile application authentication and verification endpoints"
        },
        {
            "name": "Jomhor V2 Employee Auth",
            "description": "Employee authentication endpoints for the Jomhor V2 API"
        },
        {
            "name": "Jomhor V2 Employee Services",
            "description": "Employee service workflow endpoints for the Jomhor V2 API"
        },
        {
            "name": "Jomhor V2 Invoices",
            "description": "Jomhor mobile application citizen invoices endpoints"
        },
        {
            "name": "Jomhor V2 Profile",
            "description": "Jomhor mobile application citizen profile endpoints"
        },
        {
            "name": "Jomhor V2 Services",
            "description": "Jomhor mobile application citizen services endpoints"
        },
        {
            "name": "MainApiSection",
            "description": "API Package for retrieving data requests"
        },
        {
            "name": "payment Services",
            "description": "payment Services"
        },
        {
            "name": "sync_services",
            "description": "sync_services"
        },
        {
            "name": "Settings",
            "description": "Settings"
        }
    ],
    "security": [
        {
            "api_key": []
        }
    ]
}