{
    "openapi": "3.0.0",
    "info": {
        "title": "Peasi App API Documentation",
        "contact": {
            "email": "email@gmail.com"
        },
        "version": "1.0.0"
    },
    "servers": [
        {
            "url": "localhost:8000",
            "description": "Development API Server"
        }
    ],
    "paths": {
        "/offers": {
            "get": {
                "tags": [
                    "Offers"
                ],
                "description": "Get user's list offer. Can use to get offer to add in boost",
                "operationId": "App\\Http\\Controllers\\OfferController::index",
                "parameters": [
                    {
                        "name": "is_boost",
                        "in": "query",
                        "description": "Filter unboosted offers",
                        "required": false,
                        "schema": {
                            "type": "boolean"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Get success",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "result": {
                                            "type": "integer",
                                            "example": 1
                                        },
                                        "current_time": {
                                            "type": "integer",
                                            "example": 1594742370
                                        },
                                        "message": {
                                            "type": "string",
                                            "example": "Get Success"
                                        },
                                        "data": {
                                            "type": "object",
                                            "example": {
                                                "current_page": 1,
                                                "data": [
                                                    {
                                                        "id": 1,
                                                        "user_id": 1,
                                                        "base_product_id": 77,
                                                        "type": 2,
                                                        "position": 1,
                                                        "content": null,
                                                        "customer_template_id": null,
                                                        "created_at": "2020-07-15 09:36:13",
                                                        "updated_at": "2020-07-15 09:36:13",
                                                        "name": "[Sample] Fog Linen Chambray Towel - Beige Stripe",
                                                        "group_id": 1,
                                                        "is_boosted": 0,
                                                        "address": "No. 189, Grove St, Los Angeles",
                                                        "group_name": "Group Name",
                                                        "date": "2016-05-02",
                                                        "cvs_rate": "35%",
                                                        "aov": "$234.04",
                                                        "views": 142
                                                    }
                                                ],
                                                "first_page_url": "http://localhost:8000/api/offers?page=1",
                                                "from": 1,
                                                "last_page": 4,
                                                "last_page_url": "http://localhost:8000/api/offers?page=4",
                                                "next_page_url": "http://localhost:8000/api/offers?page=2",
                                                "path": "http://localhost:8000/api/offers",
                                                "per_page": "4",
                                                "prev_page_url": null,
                                                "to": 4,
                                                "total": 16
                                            }
                                        },
                                        "error": {
                                            "type": "string",
                                            "example": []
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    }
                }
            },
            "post": {
                "tags": [
                    "Offers"
                ],
                "description": "Create a offer",
                "operationId": "App\\Http\\Controllers\\OfferController::store",
                "requestBody": {
                    "description": "Data to create new offer",
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "properties": {
                                    "targetProductId": {
                                        "type": "object",
                                        "example": [
                                            1,
                                            2,
                                            3
                                        ]
                                    },
                                    "offerProductId": {
                                        "type": "object",
                                        "example": [
                                            {
                                                "id": 5,
                                                "variant_id": 10
                                            },
                                            {
                                                "id": 15,
                                                "variant_id": 100
                                            }
                                        ]
                                    },
                                    "customerTemplateId": {
                                        "type": "integer",
                                        "example": 1
                                    },
                                    "content": {
                                        "type": "object",
                                        "example": {
                                            "offerName": "Offer's name",
                                            "groupName": "Group's name",
                                            "headLine": "Headline",
                                            "description": "Description"
                                        }
                                    },
                                    "name": {
                                        "type": "string",
                                        "example": "Offer's name"
                                    },
                                    "type": {
                                        "type": "integer",
                                        "example": 1
                                    },
                                    "position": {
                                        "type": "integer",
                                        "example": 1
                                    },
                                    "boostOptions": {
                                        "type": "object",
                                        "example": {
                                            "countdownTimer": true,
                                            "countdownCart": true,
                                            "trafficBoost": true
                                        }
                                    },
                                    "boostOptionsValue": {
                                        "type": "object",
                                        "example": {
                                            "countdownTimer": {
                                                "days": 1,
                                                "hours": 2,
                                                "minutes": 3,
                                                "seconds": 4,
                                                "message": "Example message"
                                            },
                                            "countdowntCart": {
                                                "default": false,
                                                "values": [
                                                    {
                                                        "id": 1,
                                                        "cartMode": "sold",
                                                        "bar_value": 50,
                                                        "amount": 0
                                                    },
                                                    {
                                                        "id": 2,
                                                        "cartMode": "stockLeft",
                                                        "bar_value": 10,
                                                        "amount": 5
                                                    }
                                                ]
                                            },
                                            "trafficBoost": {
                                                "message": "Example message"
                                            }
                                        }
                                    }
                                },
                                "type": "object"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Create success",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "result": {
                                            "type": "integer",
                                            "example": 200
                                        },
                                        "current_time": {
                                            "type": "integer",
                                            "example": 1594742370
                                        },
                                        "message": {
                                            "type": "string",
                                            "example": "Insert Success"
                                        },
                                        "data": {
                                            "type": "object",
                                            "example": []
                                        },
                                        "error": {
                                            "type": "string",
                                            "example": []
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "Group does not exist",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "result": {
                                            "type": "integer",
                                            "example": 404
                                        },
                                        "current_time": {
                                            "type": "integer",
                                            "example": 1594742370
                                        },
                                        "message": {
                                            "type": "string",
                                            "example": "Group does not exist"
                                        },
                                        "data": {
                                            "type": "object",
                                            "example": []
                                        },
                                        "error": {
                                            "type": "string",
                                            "example": []
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "Create Error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "result": {
                                            "type": "integer",
                                            "example": 500
                                        },
                                        "current_time": {
                                            "type": "integer",
                                            "example": 1594742370
                                        },
                                        "message": {
                                            "type": "string",
                                            "example": "Insert Failed"
                                        },
                                        "data": {
                                            "type": "object",
                                            "example": []
                                        },
                                        "error": {
                                            "type": "string",
                                            "example": []
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/offers/{id}": {
            "get": {
                "tags": [
                    "Offers"
                ],
                "description": "Get user's offer detail",
                "operationId": "App\\Http\\Controllers\\OfferController::detail",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "description": "Specify offer's id",
                        "required": true,
                        "schema": {
                            "type": "Unsigned big integer"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Get success",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "result": {
                                            "type": "integer",
                                            "example": 1
                                        },
                                        "current_time": {
                                            "type": "integer",
                                            "example": 1594742370
                                        },
                                        "message": {
                                            "type": "string",
                                            "example": "Get Success"
                                        },
                                        "data": {
                                            "type": "object",
                                            "example": {
                                                "type": "Upsell",
                                                "position": "Add to cart",
                                                "template": null,
                                                "triggerProducts": {
                                                    "0": {
                                                        "id": 77,
                                                        "name": "[Sample] Fog Linen Chambray Towel - Beige Stripe"
                                                    },
                                                    "2": {
                                                        "id": 81,
                                                        "name": "[Sample] Orbit Terrarium - Small"
                                                    }
                                                },
                                                "offerItems": {
                                                    "1": {
                                                        "id": 80,
                                                        "name": "[Sample] Orbit Terrarium - Large"
                                                    },
                                                    "3": {
                                                        "id": 93,
                                                        "name": "[Sample] 1 L Le Parfait Jar"
                                                    }
                                                }
                                            }
                                        },
                                        "error": {
                                            "type": "string",
                                            "example": []
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "Offer does not exist",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "result": {
                                            "type": "integer",
                                            "example": 1
                                        },
                                        "current_time": {
                                            "type": "integer",
                                            "example": 1594742370
                                        },
                                        "message": {
                                            "type": "string",
                                            "example": "Offer does not exist"
                                        },
                                        "data": {
                                            "type": "object",
                                            "example": []
                                        },
                                        "error": {
                                            "type": "string",
                                            "example": []
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/product": {
            "get": {
                "tags": [
                    "Products"
                ],
                "description": "Get user's store product list",
                "operationId": "App\\Http\\Controllers\\ProductController::get",
                "responses": {
                    "200": {
                        "description": "Get success",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": true
                                        },
                                        "msg": {
                                            "type": "string",
                                            "example": "Get success"
                                        },
                                        "message": {
                                            "type": "string",
                                            "example": "Get Success"
                                        },
                                        "data": {
                                            "type": "object",
                                            "example": {
                                                "success": true,
                                                "msg": "Get success",
                                                "data": {
                                                    "data": [
                                                        {
                                                            "id": 77,
                                                            "name": "[Sample] Fog Linen Chambray Towel - Beige Stripe",
                                                            "image": "https://cdn11.bigcommerce.com/s-b9u5amxjcu/products/77/images/265/foglinenbeigestripetowel3b.1435946201.220.290.jpg?c=1",
                                                            "price": 49,
                                                            "options": [
                                                                {
                                                                    "id": 108,
                                                                    "display_name": "Size",
                                                                    "values": [
                                                                        {
                                                                            "id": 68,
                                                                            "label": "XS",
                                                                            "value_data": null,
                                                                            "is_default": false
                                                                        },
                                                                        {
                                                                            "id": 70,
                                                                            "label": "M",
                                                                            "value_data": null,
                                                                            "is_default": true
                                                                        }
                                                                    ]
                                                                },
                                                                {
                                                                    "id": 109,
                                                                    "display_name": "Color",
                                                                    "values": [
                                                                        {
                                                                            "id": 11,
                                                                            "label": "Green",
                                                                            "value_data": {
                                                                                "colors": [
                                                                                    "#0f961e"
                                                                                ]
                                                                            },
                                                                            "is_default": false
                                                                        },
                                                                        {
                                                                            "id": 12,
                                                                            "label": "Yellow",
                                                                            "value_data": {
                                                                                "colors": [
                                                                                    "#f0f005"
                                                                                ]
                                                                            },
                                                                            "is_default": true
                                                                        },
                                                                        {
                                                                            "id": 14,
                                                                            "label": "Pink",
                                                                            "value_data": {
                                                                                "colors": [
                                                                                    "#e841c1"
                                                                                ]
                                                                            },
                                                                            "is_default": false
                                                                        }
                                                                    ]
                                                                }
                                                            ],
                                                            "variants": [
                                                                {
                                                                    "id": 44,
                                                                    "sku": "SLCTBS-70D1759E",
                                                                    "display_name": [
                                                                        {
                                                                            "id": 71,
                                                                            "label": "L",
                                                                            "option_id": 108,
                                                                            "option_display_name": "Size"
                                                                        },
                                                                        {
                                                                            "id": 14,
                                                                            "label": "Pink",
                                                                            "option_id": 109,
                                                                            "option_display_name": "Color"
                                                                        }
                                                                    ]
                                                                },
                                                                {
                                                                    "id": 45,
                                                                    "sku": "SLCTBS-C17A7D36",
                                                                    "display_name": [
                                                                        {
                                                                            "id": 72,
                                                                            "label": "XL",
                                                                            "option_id": 108,
                                                                            "option_display_name": "Size"
                                                                        },
                                                                        {
                                                                            "id": 14,
                                                                            "label": "Pink",
                                                                            "option_id": 109,
                                                                            "option_display_name": "Color"
                                                                        }
                                                                    ]
                                                                }
                                                            ]
                                                        },
                                                        {
                                                            "id": 80,
                                                            "name": "[Sample] Orbit Terrarium - Large",
                                                            "image": "https://cdn11.bigcommerce.com/s-b9u5amxjcu/products/80/images/271/roundterrariumlarge2.1435946527.220.290.jpg?c=1",
                                                            "price": 109,
                                                            "options": [],
                                                            "variants": [
                                                                {
                                                                    "id": 64,
                                                                    "sku": "OTL",
                                                                    "display_name": []
                                                                }
                                                            ]
                                                        }
                                                    ]
                                                }
                                            }
                                        },
                                        "error": {
                                            "type": "string",
                                            "example": []
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/product/search": {
            "get": {
                "tags": [
                    "Products"
                ],
                "description": "Get user's products and groups by keyword",
                "operationId": "App\\Http\\Controllers\\ProductController::search",
                "parameters": [
                    {
                        "name": "keyword",
                        "in": "query",
                        "description": "Keyword to search",
                        "required": true,
                        "schema": {
                            "type": "String"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Get success",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": true
                                        },
                                        "msg": {
                                            "type": "string",
                                            "example": "Get success"
                                        },
                                        "data": {
                                            "type": "object",
                                            "example": {
                                                "groups": [
                                                    {
                                                        "id": 18,
                                                        "name": "bath",
                                                        "description": "",
                                                        "image_url": ""
                                                    }
                                                ],
                                                "products": [
                                                    {
                                                        "id": 77,
                                                        "name": "[Sample] Fog Linen Chambray Towel - Beige Stripe",
                                                        "image": "https://cdn11.bigcommerce.com/s-b9u5amxjcu/products/77/images/265/foglinenbeigestripetowel3b.1435946201.220.290.jpg?c=1",
                                                        "price": 49,
                                                        "options": [],
                                                        "variants": []
                                                    }
                                                ]
                                            }
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "Bad request",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": false
                                        },
                                        "msg": {
                                            "type": "string",
                                            "example": "Bad request"
                                        },
                                        "message": {
                                            "type": "string",
                                            "example": "Get Success"
                                        },
                                        "data": {
                                            "type": "object",
                                            "example": {
                                                "keyword": "keyword field is required"
                                            }
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    }
                }
            }
        }
    },
    "tags": [
        {
            "name": "Offers",
            "description": "API Endpoints for Offers"
        }
    ]
}