{
    "openapi": "3.0.0",
    "info": {
        "title": "Order Management API",
        "description": "API documentation for Order Management System",
        "version": "1.0.0"
    },
    "servers": [
        {
            "url": "/api",
            "description": "Local API Server"
        }
    ],
    "paths": {
        "/auth/login/send-otp": {
            "post": {
                "tags": [
                    "Authentication"
                ],
                "summary": "Send a login OTP to the user email address",
                "operationId": "23b5f36c2aa29c647003933817ce9c90",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "required": [
                                    "email"
                                ],
                                "properties": {
                                    "email": {
                                        "type": "string",
                                        "format": "email"
                                    }
                                },
                                "type": "object"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "OTP request accepted"
                    },
                    "422": {
                        "description": "Validation failed"
                    },
                    "429": {
                        "description": "Too many requests"
                    }
                }
            }
        },
        "/auth/login/verify-otp": {
            "post": {
                "tags": [
                    "Authentication"
                ],
                "summary": "Verify a login OTP and issue Sanctum tokens",
                "operationId": "7a573b4ed48c277b9c7ee4271639b463",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "required": [
                                    "email",
                                    "otp"
                                ],
                                "properties": {
                                    "email": {
                                        "type": "string",
                                        "format": "email"
                                    },
                                    "otp": {
                                        "type": "string",
                                        "maxLength": 6,
                                        "minLength": 6
                                    }
                                },
                                "type": "object"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "OTP verified"
                    },
                    "422": {
                        "description": "Invalid or expired OTP"
                    },
                    "429": {
                        "description": "Too many requests"
                    }
                }
            }
        },
        "/auth/logout": {
            "post": {
                "tags": [
                    "Authentication"
                ],
                "summary": "Revoke the authenticated user tokens",
                "operationId": "a6b71ce8aa5321dd135f36b86ea60bc2",
                "responses": {
                    "200": {
                        "description": "Logged out"
                    },
                    "401": {
                        "description": "Unauthenticated"
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            }
        },
        "/companies": {
            "get": {
                "tags": [
                    "Companies"
                ],
                "summary": "List companies",
                "operationId": "8805e9d8bbc2953d483afc7eea6e7369",
                "parameters": [
                    {
                        "name": "page",
                        "in": "query",
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        }
                    },
                    {
                        "name": "perPage",
                        "in": "query",
                        "schema": {
                            "type": "integer",
                            "maximum": 100,
                            "minimum": 1
                        }
                    },
                    {
                        "name": "search",
                        "in": "query",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "sortBy",
                        "in": "query",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "sortOrder",
                        "in": "query",
                        "schema": {
                            "type": "string",
                            "enum": [
                                "asc",
                                "desc"
                            ]
                        }
                    },
                    {
                        "name": "statusIn",
                        "in": "query",
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Paginated company list"
                    },
                    "401": {
                        "description": "Unauthenticated"
                    },
                    "403": {
                        "description": "Forbidden"
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            },
            "post": {
                "tags": [
                    "Companies"
                ],
                "summary": "Create a company",
                "operationId": "087e25a23a6b7cf1e4803ccde10e53a1",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/CompanyInput"
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "Company created"
                    },
                    "401": {
                        "description": "Unauthenticated"
                    },
                    "403": {
                        "description": "Forbidden"
                    },
                    "422": {
                        "description": "Validation failed"
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            }
        },
        "/companies/{company}": {
            "get": {
                "tags": [
                    "Companies"
                ],
                "summary": "View a company",
                "operationId": "327d68fb1e08b772de76f262505906f3",
                "parameters": [
                    {
                        "name": "company",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string",
                            "format": "uuid"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Company details"
                    },
                    "401": {
                        "description": "Unauthenticated"
                    },
                    "403": {
                        "description": "Forbidden"
                    },
                    "404": {
                        "description": "Company not found"
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            },
            "put": {
                "tags": [
                    "Companies"
                ],
                "summary": "Update a company",
                "operationId": "6edbc7265af224b11bb7f16d080d0a7f",
                "parameters": [
                    {
                        "name": "company",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string",
                            "format": "uuid"
                        }
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/CompanyInput"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Company updated"
                    },
                    "401": {
                        "description": "Unauthenticated"
                    },
                    "403": {
                        "description": "Forbidden"
                    },
                    "404": {
                        "description": "Company not found"
                    },
                    "422": {
                        "description": "Validation failed"
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            },
            "delete": {
                "tags": [
                    "Companies"
                ],
                "summary": "Delete a company",
                "operationId": "38ab21dafe1a3239ed0c557f372110f7",
                "parameters": [
                    {
                        "name": "company",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string",
                            "format": "uuid"
                        }
                    }
                ],
                "responses": {
                    "204": {
                        "description": "Company deleted"
                    },
                    "401": {
                        "description": "Unauthenticated"
                    },
                    "403": {
                        "description": "Forbidden"
                    },
                    "404": {
                        "description": "Company not found"
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            }
        },
        "/companies/{company}/toggle-status": {
            "post": {
                "tags": [
                    "Companies"
                ],
                "summary": "Toggle company status",
                "operationId": "9fd42dbcab03aab96645f3962ac6ce73",
                "parameters": [
                    {
                        "name": "company",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string",
                            "format": "uuid"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Company status updated"
                    },
                    "401": {
                        "description": "Unauthenticated"
                    },
                    "403": {
                        "description": "Forbidden"
                    },
                    "404": {
                        "description": "Company not found"
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            }
        }
    },
    "components": {
        "schemas": {
            "CompanyInput": {
                "required": [
                    "name",
                    "status"
                ],
                "properties": {
                    "name": {
                        "type": "string",
                        "maxLength": 255,
                        "minLength": 2
                    },
                    "status": {
                        "type": "string",
                        "enum": [
                            "active",
                            "inactive"
                        ]
                    }
                },
                "type": "object"
            }
        },
        "securitySchemes": {
            "bearerAuth": {
                "type": "http",
                "bearerFormat": "Sanctum",
                "scheme": "bearer"
            }
        }
    },
    "tags": [
        {
            "name": "Authentication",
            "description": "Authentication"
        },
        {
            "name": "Companies",
            "description": "Companies"
        }
    ]
}