package com.ruoyi.erp.request;

import com.alibaba.fastjson2.JSONArray;
import com.alibaba.fastjson2.JSONObject;

/**
 * 上架商品请求
 *
 * 对应接口：POST /api/open/product/publish
 */
public class ProductPublishRequest extends ERPRequestBase {
	public ProductPublishRequest(IERPAccount erpAccount) {
		super("https://open.goofish.pro/api/open/product/publish", erpAccount);
	}

	public void setProductId(long productId) {
		ensureBody();
		this.requestBody.put("product_id", productId);
	}

	public void setUserName(String userName) {
		ensureBody();
		JSONArray arr = new JSONArray();
		arr.add(userName);
		this.requestBody.put("user_name", arr);
	}

	public void setSpecifyPublishTime(String time) {
		if (time == null) return;
		ensureBody();
		this.requestBody.put("specify_publish_time", time);
	}

	public void setNotifyUrl(String notifyUrl) {
		if (notifyUrl == null) return;
		ensureBody();
		this.requestBody.put("notify_url", notifyUrl);
	}

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


