{
    "openapi": "3.0.0",
    "info": {
        "title": "Zimou Express API",
        "description": "Zimou Express city description",
        "contact": {
            "email": "contact@zimou.express"
        },
        "license": {
            "name": "Apache 2.0",
            "url": "http://www.apache.org/licenses/LICENSE-2.0.html"
        },
        "version": "1.0.0"
    },
    "servers": [
        {
            "url": "https://zimou.express/api/v1",
            "description": "URL pour version 1.0.0"
        }
    ],
    "paths": {
        "/login": {
            "post": {
                "tags": [
                    "Auth"
                ],
                "summary": "Logs user into system",
                "operationId": "login",
                "parameters": [
                    {
                        "name": "email",
                        "in": "query",
                        "description": "Email to login",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "example": "admin@gmail.com"
                    },
                    {
                        "name": "password",
                        "in": "query",
                        "description": "Password to login",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "example": "password"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "You'll get Bearer token, you can use it in this doc"
                    },
                    "422": {
                        "description": "The given data was invalid"
                    }
                }
            }
        },
        "/user": {
            "get": {
                "tags": [
                    "Auth"
                ],
                "summary": "Get logged user based on Bearer token authorization",
                "description": "Return logged user based on Bearer token authorization",
                "operationId": "getUser",
                "parameters": [
                    {
                        "name": "Authorization",
                        "in": "header",
                        "description": "Berear authorization given from post login",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Logged user object"
                    },
                    "401": {
                        "description": "Unauthorized"
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            }
        },
        "/packages/bulk": {
            "post": {
                "tags": [
                    "Packages"
                ],
                "summary": "Send bulk packages",
                "operationId": "packages_bulk",
                "requestBody": {
                    "description": "targetings",
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object"
                            },
                            "example": [
                                {
                                    "client_last_name": "client_last_name",
                                    "client_first_name": "client_first_name",
                                    "client_phone": "client_phone",
                                    "client_phone2": "client_phone2",
                                    "address": "adresse",
                                    "commune": "dar el beida or 16020",
                                    "wilaya": "alger or 16",
                                    "order_id": "order_id",
                                    "name": "0001:10",
                                    "weight": 6000,
                                    "delivery_type": "express",
                                    "price": 1000,
                                    "free_delivery": false,
                                    "can_be_opened": 1,
                                    "observation": "observation",
                                    "type": "warehouse"
                                },
                                {
                                    "client_last_name": "client_last_name",
                                    "client_first_name": "client_first_name",
                                    "client_phone": "client_phone",
                                    "client_phone2": "client_phone",
                                    "address": "adresse",
                                    "commune": "dar el beida or 16020",
                                    "wilaya": "alger or 16",
                                    "order_id": "order_id",
                                    "name": "package name",
                                    "weight": 6000,
                                    "delivery_type": "express",
                                    "price": 1000,
                                    "free_delivery": false,
                                    "can_be_opened": 0,
                                    "observation": "observation",
                                    "type": "ecommerce"
                                }
                            ]
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "NEW Tracking code for each order"
                    },
                    "401": {
                        "description": "Unauthorized"
                    },
                    "403": {
                        "description": "Not found or dont have access"
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            }
        },
        "/packages": {
            "post": {
                "tags": [
                    "Packages"
                ],
                "summary": "Store new package",
                "operationId": "storePackages",
                "parameters": [
                    {
                        "name": "name",
                        "in": "query",
                        "description": "Package name",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "example": "My package"
                    },
                    {
                        "name": "tracking_partner_company",
                        "in": "query",
                        "description": "Local tracking code(optional)",
                        "required": false,
                        "example": "zim-12345"
                    },
                    {
                        "name": "client_last_name",
                        "in": "query",
                        "description": "Last name of client",
                        "required": true,
                        "example": "Doe"
                    },
                    {
                        "name": "client_first_name",
                        "in": "query",
                        "description": "First name of client",
                        "required": true,
                        "example": "John"
                    },
                    {
                        "name": "client_phone",
                        "in": "query",
                        "description": "Phone number of client",
                        "required": true,
                        "example": "0777 77 77 77"
                    },
                    {
                        "name": "client_phone2",
                        "in": "query",
                        "description": "Second phone number of client",
                        "required": false,
                        "example": "0777 77 77 77"
                    },
                    {
                        "name": "address",
                        "in": "query",
                        "description": "Client address",
                        "required": true,
                        "example": "Algiers"
                    },
                    {
                        "name": "commune",
                        "in": "query",
                        "description": "Commune name/zipcode of client",
                        "required": true,
                        "example": "dar el beida or 16020"
                    },
                    {
                        "name": "wilaya",
                        "in": "query",
                        "description": "Wilaya name/id of client",
                        "required": true,
                        "example": "Alger or 16"
                    },
                    {
                        "name": "order_id",
                        "in": "query",
                        "description": "Order ID",
                        "required": true,
                        "example": "1234"
                    },
                    {
                        "name": "weight",
                        "in": "query",
                        "description": "Weight of package(Gr)",
                        "required": true,
                        "example": "1000"
                    },
                    {
                        "name": "delivery_type",
                        "in": "query",
                        "description": "Delivery type",
                        "required": false,
                        "example": "express"
                    },
                    {
                        "name": "price",
                        "in": "query",
                        "description": "Price of package",
                        "required": true,
                        "example": "1000"
                    },
                    {
                        "name": "free_delivery",
                        "in": "query",
                        "description": "Is delivery free(1) or no(0)",
                        "required": false,
                        "example": "0"
                    },
                    {
                        "name": "can_be_opened",
                        "in": "query",
                        "description": "Is package can be open(1) or no(0), by default: 1",
                        "required": false,
                        "example": "0"
                    },
                    {
                        "name": "type",
                        "in": "query",
                        "description": "Package type: warehouse/ecommerce",
                        "required": false,
                        "example": "ecommerce"
                    },
                    {
                        "name": "observation",
                        "in": "query",
                        "description": "Observation",
                        "required": false
                    }
                ],
                "responses": {
                    "201": {
                        "description": "Package object created"
                    },
                    "401": {
                        "description": "Unauthorized"
                    },
                    "403": {
                        "description": "Not found or dont have access"
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            }
        },
        "/packages/status": {
            "get": {
                "tags": [
                    "Packages"
                ],
                "summary": "Get status of given packages tracking id",
                "operationId": "getPackagesStatus",
                "parameters": [
                    {
                        "name": "packages[]",
                        "in": "query",
                        "description": "Array of tracking code of packages",
                        "required": true,
                        "schema": {
                            "type": "array",
                            "items": {}
                        }
                    }
                ],
                "responses": {
                    "201": {
                        "description": "Tracking code for package"
                    },
                    "401": {
                        "description": "Unauthorized"
                    },
                    "403": {
                        "description": "Not found or dont have access"
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            }
        },
        "/stores": {
            "get": {
                "tags": [
                    "Stores"
                ],
                "summary": "Get list of stores",
                "operationId": "stores.index",
                "responses": {
                    "200": {
                        "description": "Get list of stores"
                    },
                    "401": {
                        "description": "Unauthorized"
                    },
                    "403": {
                        "description": "Not found or dont have access"
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            },
            "post": {
                "tags": [
                    "Stores"
                ],
                "summary": "Store a new Store",
                "operationId": "stores.store",
                "parameters": [
                    {
                        "name": "name",
                        "in": "query",
                        "description": "Store name",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "example": "Awesome Store"
                    },
                    {
                        "name": "email",
                        "in": "query",
                        "description": "Email of store",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "example": "email@site.com"
                    },
                    {
                        "name": "password",
                        "in": "query",
                        "description": "Password of store",
                        "required": false,
                        "schema": {
                            "type": "string"
                        },
                        "example": "pass@123456"
                    },
                    {
                        "name": "phone",
                        "in": "query",
                        "description": "Phone of store",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "example": "0555555555"
                    },
                    {
                        "name": "delivery_types",
                        "in": "query",
                        "description": "Type of delivery as JSON array => 2:Express, 3:Point relais, 4:Economy Express",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "example": "[2,3,4]"
                    }
                ],
                "responses": {
                    "201": {
                        "description": "Return object",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Store"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Unauthorized"
                    },
                    "403": {
                        "description": "Not found or dont have access"
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            }
        },
        "/stores/{id}": {
            "get": {
                "tags": [
                    "Stores"
                ],
                "summary": "Get details of given store",
                "operationId": "stores.show",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "description": "Store ID",
                        "required": true,
                        "schema": {
                            "type": "number"
                        },
                        "example": "1"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Get details of given store ID"
                    },
                    "401": {
                        "description": "Unauthorized"
                    },
                    "403": {
                        "description": "Not found or dont have access"
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            },
            "delete": {
                "tags": [
                    "Stores"
                ],
                "summary": "Delete a store",
                "operationId": "stores.delete",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "description": "Store ID",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "example": "1"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success message"
                    },
                    "401": {
                        "description": "Unauthorized"
                    },
                    "403": {
                        "description": "Not found or dont have access"
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            }
        }
    },
    "components": {
        "schemas": {
            "Store": {
                "title": "Store",
                "properties": {
                    "id": {
                        "description": "ID of store",
                        "type": "number"
                    },
                    "name": {
                        "description": "Name of store",
                        "type": "string"
                    },
                    "email": {
                        "description": "Email of store",
                        "type": "string"
                    },
                    "phone": {
                        "description": "Phone of store",
                        "type": "string"
                    },
                    "delivery_types": {
                        "description": "Delivery types",
                        "type": "string"
                    },
                    "payment_days": {
                        "description": "Payment day for store",
                        "type": "string"
                    },
                    "api_token": {
                        "description": "Api token to send for API",
                        "type": "string"
                    }
                },
                "type": "object"
            }
        },
        "securitySchemes": {
            "bearerAuth": {
                "type": "http",
                "name": "bearerAuth",
                "in": "header",
                "flows": {
                    "password": {
                        "authorizationUrl": "/oauth/authorize",
                        "tokenUrl": "/oauth/token",
                        "refreshUrl": "/oauth/token/refresh",
                        "scopes": {}
                    }
                },
                "bearerFormat": "JWT",
                "scheme": "bearer"
            }
        }
    },
    "security": [
        []
    ]
}
