{
    "openapi": "3.0.0",
    "info": {
        "title": "Tailor Management API",
        "description": "API documentation for the Tailor Management System",
        "version": "1.0.0"
    },
    "servers": [
        {
            "url": "http://localhost:8000",
            "description": "Local Server"
        }
    ],
    "paths": {
        "/api/login": {
            "post": {
                "tags": [
                    "Authentication"
                ],
                "summary": "Login user and return Bearer token",
                "operationId": "222b2625838e3c57e017987f73598fda",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "required": [
                                    "email",
                                    "password"
                                ],
                                "properties": {
                                    "email": {
                                        "type": "string",
                                        "format": "email",
                                        "example": "admin@tailor.com"
                                    },
                                    "password": {
                                        "type": "string",
                                        "format": "password",
                                        "example": "password"
                                    }
                                },
                                "type": "object"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Login successful",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "status": {
                                            "type": "string",
                                            "example": "success"
                                        },
                                        "message": {
                                            "type": "string",
                                            "example": "Login successful"
                                        },
                                        "data": {
                                            "properties": {
                                                "user": {
                                                    "type": "object"
                                                },
                                                "token": {
                                                    "type": "string",
                                                    "example": "1|Abc123Token..."
                                                }
                                            },
                                            "type": "object"
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Invalid credentials"
                    }
                }
            }
        },
        "/api/logout": {
            "post": {
                "tags": [
                    "Authentication"
                ],
                "summary": "Logout user (Revoke token)",
                "operationId": "ad65cbbd4e9f201619eae184a5961a98",
                "responses": {
                    "200": {
                        "description": "Logged out successfully",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "status": {
                                            "type": "string",
                                            "example": "success"
                                        },
                                        "message": {
                                            "type": "string",
                                            "example": "Logged out successfully"
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            }
        },
        "/api/user": {
            "get": {
                "tags": [
                    "Authentication"
                ],
                "summary": "Get authenticated user profile",
                "operationId": "961ad57987905b44ae2e2f40b82e76de",
                "responses": {
                    "200": {
                        "description": "Authenticated user data",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "status": {
                                            "type": "string",
                                            "example": "success"
                                        },
                                        "data": {
                                            "type": "object"
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            }
        },
        "/api/orders": {
            "get": {
                "tags": [
                    "Orders"
                ],
                "summary": "List orders with filters",
                "operationId": "955bb77a45ae173a485fadb8befed93f",
                "parameters": [
                    {
                        "name": "search",
                        "in": "query",
                        "description": "Search by order number or customer",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "status",
                        "in": "query",
                        "description": "Filter by order status",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "college_id",
                        "in": "query",
                        "description": "Filter by college",
                        "schema": {
                            "type": "integer"
                        }
                    },
                    {
                        "name": "per_page",
                        "in": "query",
                        "schema": {
                            "type": "integer",
                            "default": 15
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "List of orders",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            },
            "post": {
                "tags": [
                    "Orders"
                ],
                "summary": "Create a new order",
                "operationId": "2123ba58dadb22bd6f2c8081af562230",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "required": [
                                    "customer",
                                    "total_amount",
                                    "items",
                                    "deadline"
                                ],
                                "properties": {
                                    "customer": {
                                        "properties": {
                                            "name": {
                                                "type": "string",
                                                "example": "John Doe"
                                            },
                                            "phone": {
                                                "type": "string",
                                                "example": "08123456789"
                                            }
                                        },
                                        "type": "object"
                                    },
                                    "items": {
                                        "type": "array",
                                        "items": {
                                            "type": "object"
                                        }
                                    },
                                    "total_amount": {
                                        "type": "number",
                                        "format": "float",
                                        "example": 100
                                    },
                                    "advance_payment": {
                                        "type": "number",
                                        "format": "float",
                                        "example": 20
                                    }
                                },
                                "type": "object"
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "Order created"
                    },
                    "422": {
                        "description": "Validation error"
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            }
        },
        "/api/orders/{order}": {
            "get": {
                "tags": [
                    "Orders"
                ],
                "summary": "Get order details",
                "operationId": "8114ac185cc1bf301d8862617e497098",
                "parameters": [
                    {
                        "name": "order",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Detailed order info"
                    },
                    "404": {
                        "description": "Order not found"
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            },
            "put": {
                "tags": [
                    "Orders"
                ],
                "summary": "Update order details",
                "operationId": "451beac48796437035c70268bc39ee41",
                "parameters": [
                    {
                        "name": "order",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Order updated"
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            },
            "delete": {
                "tags": [
                    "Orders"
                ],
                "summary": "Delete an order (Soft delete)",
                "operationId": "983c7813fdcb0d66fd5d1386fa8f6f22",
                "parameters": [
                    {
                        "name": "order",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Order deleted"
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            }
        },
        "/api/orders/{order}/status": {
            "patch": {
                "tags": [
                    "Orders"
                ],
                "summary": "Update order status and log transition",
                "operationId": "186761e4638080314ffcc09ee265e4b2",
                "parameters": [
                    {
                        "name": "order",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "required": [
                                    "status"
                                ],
                                "properties": {
                                    "status": {
                                        "type": "string",
                                        "example": "cutting"
                                    },
                                    "notes": {
                                        "type": "string",
                                        "example": "Fabric cut started"
                                    }
                                },
                                "type": "object"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Status updated"
                    },
                    "422": {
                        "description": "Invalid status"
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            }
        }
    },
    "tags": [
        {
            "name": "Authentication",
            "description": "Authentication"
        },
        {
            "name": "Orders",
            "description": "Orders"
        }
    ],
    "components": {
        "securitySchemes": {
            "bearerAuth": {
                "type": "http",
                "scheme": "bearer",
                "bearerFormat": "JWT"
            }
        }
    },
    "security": [
        {
            "bearerAuth": []
        }
    ]
}