{
    "swagger": "2.0",
    "info": {
        "title": "API",
        "description": "Api GMTV",
        "version": "1"
    },
    "basePath": "/api/v1",
    "schemes": [
        "http",
        "https"
    ],
    "paths": {
        "/counterOffer": {
            "post": {
                "summary": "Create an offer",
                "description": "Creates a counter offer; if there is an offer created earlier, it will be automatically rejected. As a result, you will receive a new offer identifier.",
                "parameters": [
                    {
                        "name": "Accept",
                        "in": "header",
                        "description": "",
                        "required": true,
                        "type": "string",
                        "default": "application/json"
                    },
                    {
                        "name": "Authorization",
                        "in": "header",
                        "description": "Bearer $token",
                        "required": true,
                        "type": "string",
                        "default": "Bearer qweasdzxc1"
                    },
                    {
                        "name": "body",
                        "in": "body",
                        "required": true,
                        "schema": {
                            "required": [
                                "id",
                                "request_amount"
                            ],
                            "properties": {
                                "id": {
                                    "description": "ID of the request received when creating a new lead",
                                    "type": "integer",
                                    "minimum": "1",
                                    "example": "22"
                                },
                                "request_amount": {
                                    "description": "Offer amount",
                                    "type": "integer",
                                    "minimum": "1",
                                    "example": "22350"
                                }
                            }
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "successful offer update",
                        "schema": {
                            "properties": {
                                "successful": {
                                    "description": "confirmation of successful request",
                                    "type": "boolean",
                                    "example": "true"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Unauthorized user"
                    },
                    "422": {
                        "description": "Exception",
                        "schema": {
                            "properties": {
                                "successful": {
                                    "description": "An error occurred on the server",
                                    "type": "boolean",
                                    "example": "false"
                                },
                                "error": {
                                    "description": "General error message",
                                    "type": "string",
                                    "example": "Try again later or contact your administrator"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/updateOffer": {
            "post": {
                "summary": "Update offer status",
                "description": "Response to a previously received offer.",
                "parameters": [
                    {
                        "name": "Accept",
                        "in": "header",
                        "description": "",
                        "required": true,
                        "type": "string",
                        "default": "application/json"
                    },
                    {
                        "name": "Authorization",
                        "in": "header",
                        "description": "Bearer $token",
                        "required": true,
                        "type": "string",
                        "default": "Bearer qweasdzxc1"
                    },
                    {
                        "name": "body",
                        "in": "body",
                        "required": true,
                        "schema": {
                            "required": [
                                "offer_id",
                                "request_amount"
                            ],
                            "properties": {
                                "id": {
                                    "description": "Offer ID",
                                    "type": "integer",
                                    "minimum": "1",
                                    "example": "22"
                                },
                                "request_amount_accepted": {
                                    "description": "Confirmation or refusal of the offered price",
                                    "type": "boolean",
                                    "example": "true"
                                }
                            }
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "successful offer update",
                        "schema": {
                            "properties": {
                                "successful": {
                                    "description": "confirmation of successful request",
                                    "type": "boolean",
                                    "example": "true"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Unauthorized user"
                    },
                    "422": {
                        "description": "Exception",
                        "schema": {
                            "properties": {
                                "successful": {
                                    "description": "An error occurred on the server",
                                    "type": "boolean",
                                    "example": "false"
                                },
                                "error": {
                                    "description": "General error message",
                                    "type": "string",
                                    "example": "Try again later or contact your administrator"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/{id}/counterOffer": {
            "post": {
                "summary": "Create an offer",
                "description": "Creates a counter offer; if there is an offer created earlier, it will be automatically rejected. As a result, you will receive a new offer identifier.",
                "parameters": [
                    {
                        "name": "Accept",
                        "in": "header",
                        "description": "",
                        "required": true,
                        "type": "string",
                        "default": "application/json"
                    },
                    {
                        "name": "Authorization",
                        "in": "header",
                        "description": "Bearer $token",
                        "required": true,
                        "type": "string",
                        "default": "Bearer qweasdzxc1"
                    },
                    {
                        "name": "id",
                        "in": "path",
                        "description": "ID of the request received when creating a new lead",
                        "required": true,
                        "type": "string"
                    },
                    {
                        "name": "body",
                        "in": "body",
                        "required": true,
                        "schema": {
                            "required": [
                                "request_amount"
                            ],
                            "properties": {
                                "request_amount": {
                                    "description": "Offer amount",
                                    "type": "integer",
                                    "minimum": "1",
                                    "example": "22350"
                                }
                            }
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "successful offer update",
                        "schema": {
                            "properties": {
                                "successful": {
                                    "description": "confirmation of successful request",
                                    "type": "boolean",
                                    "example": "true"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Unauthorized user"
                    },
                    "422": {
                        "description": "Exception",
                        "schema": {
                            "properties": {
                                "successful": {
                                    "description": "An error occurred on the server",
                                    "type": "boolean",
                                    "example": "false"
                                },
                                "error": {
                                    "description": "General error message",
                                    "type": "string",
                                    "example": "Try again later or contact your administrator"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/{id}/updateOffer": {
            "post": {
                "summary": "Update offer status",
                "description": "Response to a previously received offer.",
                "parameters": [
                    {
                        "name": "Accept",
                        "in": "header",
                        "description": "",
                        "required": true,
                        "type": "string",
                        "default": "application/json"
                    },
                    {
                        "name": "Authorization",
                        "in": "header",
                        "description": "Bearer $token",
                        "required": true,
                        "type": "string",
                        "default": "Bearer qweasdzxc1"
                    },
                    {
                        "name": "id",
                        "in": "path",
                        "description": "Offer ID",
                        "required": true,
                        "type": "string"
                    },
                    {
                        "name": "body",
                        "in": "body",
                        "required": true,
                        "schema": {
                            "required": [
                                "request_amount"
                            ],
                            "properties": {
                                "request_amount_accepted": {
                                    "description": "Confirmation or refusal of the offered price",
                                    "type": "boolean",
                                    "example": "true"
                                }
                            }
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "successful offer update",
                        "schema": {
                            "properties": {
                                "successful": {
                                    "description": "confirmation of successful request",
                                    "type": "boolean",
                                    "example": "true"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Unauthorized user"
                    },
                    "422": {
                        "description": "Exception",
                        "schema": {
                            "properties": {
                                "successful": {
                                    "description": "An error occurred on the server",
                                    "type": "boolean",
                                    "example": "false"
                                },
                                "error": {
                                    "description": "General error message",
                                    "type": "string",
                                    "example": "Try again later or contact your administrator"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/lead": {
            "post": {
                "summary": "Created new lead",
                "description": "Returns information about the created lead.",
                "parameters": [
                    {
                        "name": "Accept",
                        "in": "header",
                        "description": "",
                        "required": true,
                        "type": "string",
                        "default": "application/json"
                    },
                    {
                        "name": "Authorization",
                        "in": "header",
                        "description": "Bearer $token",
                        "required": true,
                        "type": "string",
                        "default": "Bearer qweasdzxc1"
                    },
                    {
                        "name": "body",
                        "in": "body",
                        "required": true,
                        "schema": {
                            "required": [
                                "zip",
                                "vehicle",
                                "conditions"
                            ],
                            "properties": {
                                "zip": {
                                    "description": "Zip code",
                                    "type": "integer",
                                    "maxLength": 5,
                                    "minLength": 5,
                                    "example": "90011"
                                },
                                "vehicle": {
                                    "description": "Vehicle information",
                                    "required": [
                                        "year",
                                        "make",
                                        "model",
                                        "trim",
                                        "vin",
                                        "mileage",
                                        "exterior_color",
                                        "vehicle_type"
                                    ],
                                    "properties": {
                                        "year": {
                                            "description": "Year of car manufacture",
                                            "type": "integer",
                                            "maxLength": 4,
                                            "minLength": 4,
                                            "example": "2020"
                                        },
                                        "make": {
                                            "description": "Car manufacturer brand",
                                            "type": "string",
                                            "maxLength": 191,
                                            "example": "Hyundai"
                                        },
                                        "model": {
                                            "description": "Automobile model",
                                            "type": "string",
                                            "maxLength": 191,
                                            "example": "Elantra GT"
                                        },
                                        "trim": {
                                            "description": "",
                                            "type": "string",
                                            "maxLength": 191,
                                            "example": "N Line"
                                        },
                                        "vin": {
                                            "description": "VIN",
                                            "type": "string",
                                            "maxLength": 4,
                                            "example": "KMHH55LC2LU126831"
                                        },
                                        "mileage": {
                                            "description": "Vehicle mileage in miles",
                                            "type": "integer",
                                            "maximum": "300000",
                                            "minimum": "1",
                                            "example": "22350"
                                        },
                                        "comments": {
                                            "description": "Additional information about the car",
                                            "type": "string",
                                            "example": "lift kit, supercharger, modified exhaust,service lights, body damag, etc."
                                        },
                                        "exterior_color": {
                                            "description": "Vehicle Exterior Color",
                                            "type": "string",
                                            "maxLength": 191,
                                            "example": "Beige"
                                        },
                                        "vehicle_type": {
                                            "description": "Vehicle Type",
                                            "type": "string",
                                            "enum": [
                                                "car",
                                                "truck",
                                                "suv",
                                                "rv",
                                                "motorcycle"
                                            ],
                                            "example": "car"
                                        }
                                    },
                                    "type": "object"
                                },
                                "conditions": {
                                    "description": "Path to the uploaded file",
                                    "required": [
                                        "damage"
                                    ],
                                    "properties": {
                                        "damage": {
                                            "description": "Previous Damage History",
                                            "type": "string",
                                            "enum": [
                                                "Clean",
                                                "Bad",
                                                "Flood",
                                                "Salvage",
                                                "Frame",
                                                "Total Loss"
                                            ],
                                            "example": "Flood"
                                        },
                                        "needs_repairs": {
                                            "description": "Does your vehicle need any repairs?",
                                            "type": "boolean",
                                            "example": "true"
                                        },
                                        "repairs_amount": {
                                            "description": "Estimate the cost of mechanical and/or cosmetic repairs?",
                                            "type": "integer",
                                            "example": "200"
                                        }
                                    },
                                    "type": "object"
                                },
                                "payoff": {
                                    "description": "Path to the uploaded file",
                                    "properties": {
                                        "has_payoff": {
                                            "description": "Does your car have a payoff with a bank or lender?",
                                            "type": "boolean",
                                            "example": "true"
                                        },
                                        "payoff_amount": {
                                            "description": "Payoff Amount",
                                            "type": "integer",
                                            "example": "3000"
                                        },
                                        "is_lease": {
                                            "description": "Is your car a lease?",
                                            "type": "boolean",
                                            "example": "true"
                                        },
                                        "leasing_company": {
                                            "description": "Leasing Company",
                                            "type": "string",
                                            "maxLength": 191,
                                            "example": "Test"
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "successful operation with price",
                        "schema": {
                            "required": [
                                "zip",
                                "vehicle",
                                "conditions"
                            ],
                            "properties": {
                                "year": {
                                    "description": "Year of car manufacture",
                                    "type": "integer",
                                    "maxLength": 4,
                                    "minLength": 4,
                                    "example": "2020"
                                },
                                "make": {
                                    "description": "Car manufacturer brand",
                                    "type": "string",
                                    "maxLength": 191,
                                    "example": "Hyundai"
                                },
                                "model": {
                                    "description": "Automobile model",
                                    "type": "string",
                                    "maxLength": 191,
                                    "example": "Elantra GT"
                                },
                                "trim": {
                                    "description": "",
                                    "type": "string",
                                    "maxLength": 191,
                                    "example": "N Line"
                                },
                                "vin": {
                                    "description": "VIN",
                                    "type": "string",
                                    "maxLength": 4,
                                    "example": "KMHH55LC2LU126831"
                                },
                                "mileage": {
                                    "description": "Vehicle mileage in miles",
                                    "type": "integer",
                                    "maximum": "300000",
                                    "example": "22350"
                                },
                                "offer": {
                                    "description": "Result amount",
                                    "type": "object",
                                    "example": {
                                        "id": 22,
                                        "amount": 22350,
                                        "offerType": "Instant",
                                        "isFirmOffer": true,
                                        "offerUrl": "https://givemethevin.com/api/57/updateOffer",
                                        "created_at": "2023-09-11 18:48:34",
                                        "expires_at": "2023-09-14"
                                    }
                                }
                            }
                        }
                    },
                    "202": {
                        "description": "The lead was accepted and sent to the queue",
                        "schema": {
                            "required": [
                                "zip",
                                "vehicle",
                                "conditions"
                            ],
                            "properties": {
                                "year": {
                                    "description": "Year of car manufacture",
                                    "type": "integer",
                                    "maxLength": 4,
                                    "minLength": 4,
                                    "example": "2020"
                                },
                                "make": {
                                    "description": "Car manufacturer brand",
                                    "type": "string",
                                    "maxLength": 191,
                                    "example": "Hyundai"
                                },
                                "model": {
                                    "description": "Automobile model",
                                    "type": "string",
                                    "maxLength": 191,
                                    "example": "Elantra GT"
                                },
                                "trim": {
                                    "description": "",
                                    "type": "string",
                                    "maxLength": 191,
                                    "example": "N Line"
                                },
                                "vin": {
                                    "description": "VIN",
                                    "type": "string",
                                    "maxLength": 4,
                                    "example": "KMHH55LC2LU126831"
                                },
                                "mileage": {
                                    "description": "Vehicle mileage in miles",
                                    "type": "integer",
                                    "maximum": "300000",
                                    "example": "22350"
                                },
                                "notification": {
                                    "description": "Message that says CRM is not available",
                                    "type": "string",
                                    "example": "This lead can not be processed automatically. Our Manager will send to you manual offer"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Unauthorized user"
                    }
                }
            }
        }
    },
    "definitions": {}
}