# Quà tặng sản phẩm

* /api/product/gift: Tính năng này dùng để lấy danh sách quà tặng theo sản phẩm. Hỗ trợ tìm kiếm thông qua ID sản phẩm.

## Request

* Xem các [common request params](/v2/readme.md#request-params)
* Các key của mảng **data array** dùng để tạo **data** json string:

| Key  | Type  | Description                                                          |
| ---- | ----- | -------------------------------------------------------------------- |
| page | int   | Phân trang (giá trị mặc định là 1)                                   |
| icpp | int   | Số lượng sản phẩm trên 1 trang. Mặc định là 10. Tối đa không quá 20. |
| ids  | array | Tìm kiếm theo ID sản phẩm có quà tặng                                |

## Response

JSON decode the response to get the structure:

| Key      | Type  | Description                               |
| -------- | ----- | ----------------------------------------- |
| code     | int   | 1 = success or 0 = failed                 |
| messages | array | is an array of error messages if code = 0 |
| data     | array | Mảng danh sách sản phẩm có quà tặng       |

```javascript
data = [
    [
        "productId" => int, // id sản phẩm có quà tặng
        "productCode" => string, // mã sản phẩm có quà tặng
        "productName" => string, // tên sản phẩm có quà tặng
        "productGiftId" => int, // id sản phẩm quà tặng
        "productGiftCode" => string, //  mã sản phẩm quà tặng
        "productGiftName" => string, //  tên sản phẩm quà tặng
        "quantity" => int, // số lượng quà tặng
        "value" => int, // giá trị quà tặng (tính theo quantity = 1),
        "promotionFromDate" => string, // ngày bắt đầu chương trình,
        "promotionToDate" => string, // ngày kết thúc chương trình
        "promotionStatus" => int, // trạng thái chương trình( Trạng thái 1 = Active, 2 = Inactive)
        "promotionDepotIds" => array // danh sách cửa hàng được áp dụng (Vì có thể áp dụng offline, online riêng), VD [1,2,3]
    ],
    [...]
]
```

**Chú ý**: quantity của quà tặng có hệ số là 1. VD mua 1 sản phẩm A được tặng 2 sản phẩm B, thì nếu mua 2 sản phẩm A sẽ được tặng 4 sản phẩm B


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://apidocs.nhanh.vn/v2/product/gift.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
