{
    "openapi": "3.1.0",
    "info": {
        "title": "CRC Transport API",
        "version": "1.0.8",
        "description": "Machine-readable API discovery document for CRC Transport. Quote and route endpoints are documented as planned/beta until their production handlers are available."
    },
    "servers": [
        {
            "url": "https://crctransport.us",
            "description": "CRC Transport production site"
        }
    ],
    "paths": {
        "/api/health": {
            "get": {
                "summary": "API health check",
                "description": "Returns service status for CRC Transport API discovery checks.",
                "operationId": "getApiHealth",
                "responses": {
                    "200": {
                        "description": "Service is available.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/HealthResponse"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/api/quote": {
            "post": {
                "summary": "Request a car shipping quote",
                "description": "Planned/beta endpoint. Expected to accept shipment, vehicle, and customer details for a CRC Transport quote request.",
                "operationId": "createShippingQuote",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/QuoteRequest"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Quote request accepted or estimated quote returned.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/QuoteResponse"
                                }
                            }
                        }
                    },
                    "400": {
                        "description": "Missing or invalid quote request fields."
                    }
                }
            }
        },
        "/api/routes": {
            "get": {
                "summary": "Search car shipping routes",
                "description": "Planned/beta endpoint. Expected to return informational CRC Transport route availability by origin and destination.",
                "operationId": "searchShippingRoutes",
                "parameters": [
                    {
                        "name": "origin_state",
                        "in": "query",
                        "required": true,
                        "description": "Two-letter pickup state code, such as CA.",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "destination_state",
                        "in": "query",
                        "required": true,
                        "description": "Two-letter delivery state code, such as FL.",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "origin_city",
                        "in": "query",
                        "required": false,
                        "description": "Optional pickup city.",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "destination_city",
                        "in": "query",
                        "required": false,
                        "description": "Optional delivery city.",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "transport_type",
                        "in": "query",
                        "required": false,
                        "description": "Optional transport type, such as open or enclosed.",
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Matching planned/beta route information.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/RoutesResponse"
                                }
                            }
                        }
                    },
                    "400": {
                        "description": "Missing or invalid route search parameters."
                    }
                }
            }
        }
    },
    "components": {
        "schemas": {
            "HealthResponse": {
                "type": "object",
                "required": [
                    "status",
                    "service",
                    "version"
                ],
                "properties": {
                    "status": {
                        "type": "string",
                        "const": "ok"
                    },
                    "service": {
                        "type": "string",
                        "const": "CRC Transport API"
                    },
                    "version": {
                        "type": "string",
                        "const": "1.0.8"
                    }
                }
            },
            "Location": {
                "type": "object",
                "required": [
                    "city",
                    "state"
                ],
                "properties": {
                    "city": {
                        "type": "string"
                    },
                    "state": {
                        "type": "string",
                        "minLength": 2,
                        "maxLength": 2
                    },
                    "postal_code": {
                        "type": "string"
                    }
                }
            },
            "Vehicle": {
                "type": "object",
                "required": [
                    "year",
                    "make",
                    "model"
                ],
                "properties": {
                    "year": {
                        "type": "integer",
                        "minimum": 1900
                    },
                    "make": {
                        "type": "string"
                    },
                    "model": {
                        "type": "string"
                    },
                    "condition": {
                        "type": "string",
                        "enum": [
                            "running",
                            "non-running"
                        ]
                    }
                }
            },
            "Customer": {
                "type": "object",
                "properties": {
                    "name": {
                        "type": "string"
                    },
                    "email": {
                        "type": "string",
                        "format": "email"
                    },
                    "phone": {
                        "type": "string"
                    }
                }
            },
            "QuoteRequest": {
                "type": "object",
                "required": [
                    "origin",
                    "destination",
                    "vehicle"
                ],
                "properties": {
                    "origin": {
                        "$ref": "#/components/schemas/Location"
                    },
                    "destination": {
                        "$ref": "#/components/schemas/Location"
                    },
                    "vehicle": {
                        "$ref": "#/components/schemas/Vehicle"
                    },
                    "transport_type": {
                        "type": "string",
                        "enum": [
                            "open",
                            "enclosed"
                        ]
                    },
                    "ship_date": {
                        "type": "string",
                        "format": "date"
                    },
                    "customer": {
                        "$ref": "#/components/schemas/Customer"
                    }
                }
            },
            "Money": {
                "type": "object",
                "required": [
                    "amount",
                    "currency"
                ],
                "properties": {
                    "amount": {
                        "type": "number"
                    },
                    "currency": {
                        "type": "string",
                        "const": "USD"
                    }
                }
            },
            "QuoteResponse": {
                "type": "object",
                "required": [
                    "status",
                    "message"
                ],
                "properties": {
                    "status": {
                        "type": "string",
                        "enum": [
                            "planned",
                            "accepted",
                            "quoted"
                        ]
                    },
                    "message": {
                        "type": "string"
                    },
                    "quote_id": {
                        "type": "string"
                    },
                    "estimated_price": {
                        "$ref": "#/components/schemas/Money"
                    }
                }
            },
            "Route": {
                "type": "object",
                "required": [
                    "origin",
                    "destination"
                ],
                "properties": {
                    "origin": {
                        "type": "string"
                    },
                    "destination": {
                        "type": "string"
                    },
                    "transport_types": {
                        "type": "array",
                        "items": {
                            "type": "string",
                            "enum": [
                                "open",
                                "enclosed"
                            ]
                        }
                    },
                    "estimated_transit_days": {
                        "type": "object",
                        "properties": {
                            "min": {
                                "type": "integer",
                                "minimum": 0
                            },
                            "max": {
                                "type": "integer",
                                "minimum": 0
                            }
                        }
                    }
                }
            },
            "RoutesResponse": {
                "type": "object",
                "required": [
                    "status",
                    "routes"
                ],
                "properties": {
                    "status": {
                        "type": "string",
                        "enum": [
                            "planned",
                            "ok"
                        ]
                    },
                    "routes": {
                        "type": "array",
                        "items": {
                            "$ref": "#/components/schemas/Route"
                        }
                    }
                }
            }
        }
    }
}