package com.ruoyi.erp.request;

import com.alibaba.fastjson2.JSONObject;

public class ProductListQueryRequest extends ERPRequestBase {
    public ProductListQueryRequest(IERPAccount erpAccount) {
        super("https://open.goofish.pro/api/open/product/list", erpAccount);
    }

    public void setOnlineTime(long start, long end) {
        ensureRequestBodyInitialized();
        this.requestBody.put("online_time", new long[]{start, end});
    }

    public void setOfflineTime(long start, long end) {
        ensureRequestBodyInitialized();
        this.requestBody.put("offline_time", new long[]{start, end});
    }

    public void setSoldTime(long start, long end) {
        ensureRequestBodyInitialized();
        this.requestBody.put("sold_time", new long[]{start, end});
    }

    public void setUpdateTime(long start, long end) {
        ensureRequestBodyInitialized();
        this.requestBody.put("update_time", new long[]{start, end});
    }

    public void setCreateTime(long start, long end) {
        ensureRequestBodyInitialized();
        this.requestBody.put("create_time", new long[]{start, end});
    }

    public void setProductStatus(int productStatus) {
        ensureRequestBodyInitialized();
        this.requestBody.put("product_status", productStatus);
    }

    public void setSaleStatus(Integer saleStatus) {
        if (saleStatus == null) {
            return;
        }
        ensureRequestBodyInitialized();
        this.requestBody.put("sale_status", saleStatus);
    }

    public void setPageNo(int pageNo) {
        ensureRequestBodyInitialized();
        this.requestBody.put("page_no", pageNo);
    }

    public void setPageSize(int pageSize) {
        ensureRequestBodyInitialized();
        this.requestBody.put("page_size", pageSize);
    }

    public void setPage(int pageNo, int pageSize) {
        ensureRequestBodyInitialized();
        this.requestBody.put("page_no", pageNo);
        this.requestBody.put("page_size", pageSize);
    }

    private void ensureRequestBodyInitialized() {
        if (this.requestBody == null) {
            this.requestBody = new JSONObject();
        }
    }
}
