package com.ruoyi.jarvis.domain.request;

import javax.validation.Valid;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import java.util.List;

/**
 * 批量发品请求对象
 * 
 * @author ruoyi
 * @date 2025-01-10
 */
public class BatchPublishRequest {

    /** 任务名称 */
    private String taskName;

    /** 原始线报消息 */
    private String originalMessage;

    /** 选中的商品列表 */
    @Valid
    @NotEmpty(message = "商品列表不能为空")
    private List<ProductItem> products;

    /** 账号配置列表（包含多个主账号及其子账号） */
    @Valid
    @NotEmpty(message = "账号配置不能为空")
    private List<AccountConfig> accountConfigs;

    /** 通用参数 */
    @Valid
    @NotNull(message = "通用参数不能为空")
    private CommonParams commonParams;

    /** 延迟上架时间（秒），默认3秒 */
    private Integer delaySeconds = 3;

    /**
     * 账号配置（主账号+子账号列表）
     */
    public static class AccountConfig {
        /** 目标ERP账号（appid） */
        @NotBlank(message = "目标账号不能为空")
        private String targetAccount;

        /** 该账号下的子账号列表 */
        @NotEmpty(message = "子账号不能为空")
        private List<String> subAccounts;

        public String getTargetAccount() {
            return targetAccount;
        }

        public void setTargetAccount(String targetAccount) {
            this.targetAccount = targetAccount;
        }

        public List<String> getSubAccounts() {
            return subAccounts;
        }

        public void setSubAccounts(List<String> subAccounts) {
            this.subAccounts = subAccounts;
        }
    }

    public static class ProductItem {
        /** SKUID */
        @NotBlank(message = "SKUID不能为空")
        private String skuid;

        /** 商品名称 */
        private String productName;

        /** 京东原价（元） */
        private Double price;

        /** 发布价格（元） */
        private Double publishPrice;

        /** 商品主图 */
        private String productImage;

        /** 商品图片数组 */
        private List<String> images;

        /** 店铺名称 */
        private String shopName;

        /** 店铺ID */
        private String shopId;

        /** 佣金 */
        private String commission;

        /** 佣金比例 */
        private String commissionShare;

        /** 佣金信息（兼容旧字段） */
        private String commissionInfo;

        /** 文案数组 */
        private List<WenanItem> wenan;

        /** 选中的文案索引 */
        private Integer selectedWenanIndex;

        public String getSkuid() {
            return skuid;
        }

        public void setSkuid(String skuid) {
            this.skuid = skuid;
        }

        public String getProductName() {
            return productName;
        }

        public void setProductName(String productName) {
            this.productName = productName;
        }

        public Double getPrice() {
            return price;
        }

        public void setPrice(Double price) {
            this.price = price;
        }

        public Double getPublishPrice() {
            return publishPrice;
        }

        public void setPublishPrice(Double publishPrice) {
            this.publishPrice = publishPrice;
        }

        public String getProductImage() {
            return productImage;
        }

        public void setProductImage(String productImage) {
            this.productImage = productImage;
        }

        public List<String> getImages() {
            return images;
        }

        public void setImages(List<String> images) {
            this.images = images;
        }

        public String getShopName() {
            return shopName;
        }

        public void setShopName(String shopName) {
            this.shopName = shopName;
        }

        public String getShopId() {
            return shopId;
        }

        public void setShopId(String shopId) {
            this.shopId = shopId;
        }

        public String getCommission() {
            return commission;
        }

        public void setCommission(String commission) {
            this.commission = commission;
        }

        public String getCommissionShare() {
            return commissionShare;
        }

        public void setCommissionShare(String commissionShare) {
            this.commissionShare = commissionShare;
        }

        public String getCommissionInfo() {
            return commissionInfo;
        }

        public void setCommissionInfo(String commissionInfo) {
            this.commissionInfo = commissionInfo;
        }

        public List<WenanItem> getWenan() {
            return wenan;
        }

        public void setWenan(List<WenanItem> wenan) {
            this.wenan = wenan;
        }

        public Integer getSelectedWenanIndex() {
            return selectedWenanIndex;
        }

        public void setSelectedWenanIndex(Integer selectedWenanIndex) {
            this.selectedWenanIndex = selectedWenanIndex;
        }
    }

    /**
     * 文案项
     */
    public static class WenanItem {
        /** 文案类型 */
        private String type;

        /** 文案内容 */
        private String content;

        public String getType() {
            return type;
        }

        public void setType(String type) {
            this.type = type;
        }

        public String getContent() {
            return content;
        }

        public void setContent(String content) {
            this.content = content;
        }
    }

    public static class CommonParams {
        /** 会员名 */
        @NotBlank(message = "会员名不能为空")
        private String userName;

        /** 省 */
        @NotNull(message = "省不能为空")
        private Integer province;

        /** 市 */
        @NotNull(message = "市不能为空")
        private Integer city;

        /** 区 */
        @NotNull(message = "区不能为空")
        private Integer district;

        /** 商品类型 */
        @NotNull(message = "商品类型不能为空")
        private Integer itemBizType;

        /** 行业类型 */
        @NotNull(message = "行业类型不能为空")
        private Integer spBizType;

        /** 类目ID */
        @NotBlank(message = "类目ID不能为空")
        private String channelCatId;

        /** 邮费（元） */
        @NotNull(message = "邮费不能为空")
        private Double expressFee;

        /** 库存 */
        @NotNull(message = "库存不能为空")
        private Integer stock;

        /** 成色 */
        private Integer stuffStatus;

        /** 服务支持（逗号分隔） */
        private String serviceSupport;

        /** 商品属性（JSON） */
        private String channelPv;

        /** 白底图链接 */
        private String whiteImages;

        public String getUserName() {
            return userName;
        }

        public void setUserName(String userName) {
            this.userName = userName;
        }

        public Integer getProvince() {
            return province;
        }

        public void setProvince(Integer province) {
            this.province = province;
        }

        public Integer getCity() {
            return city;
        }

        public void setCity(Integer city) {
            this.city = city;
        }

        public Integer getDistrict() {
            return district;
        }

        public void setDistrict(Integer district) {
            this.district = district;
        }

        public Integer getItemBizType() {
            return itemBizType;
        }

        public void setItemBizType(Integer itemBizType) {
            this.itemBizType = itemBizType;
        }

        public Integer getSpBizType() {
            return spBizType;
        }

        public void setSpBizType(Integer spBizType) {
            this.spBizType = spBizType;
        }

        public String getChannelCatId() {
            return channelCatId;
        }

        public void setChannelCatId(String channelCatId) {
            this.channelCatId = channelCatId;
        }

        public Double getExpressFee() {
            return expressFee;
        }

        public void setExpressFee(Double expressFee) {
            this.expressFee = expressFee;
        }

        public Integer getStock() {
            return stock;
        }

        public void setStock(Integer stock) {
            this.stock = stock;
        }

        public Integer getStuffStatus() {
            return stuffStatus;
        }

        public void setStuffStatus(Integer stuffStatus) {
            this.stuffStatus = stuffStatus;
        }

        public String getServiceSupport() {
            return serviceSupport;
        }

        public void setServiceSupport(String serviceSupport) {
            this.serviceSupport = serviceSupport;
        }

        public String getChannelPv() {
            return channelPv;
        }

        public void setChannelPv(String channelPv) {
            this.channelPv = channelPv;
        }

        public String getWhiteImages() {
            return whiteImages;
        }

        public void setWhiteImages(String whiteImages) {
            this.whiteImages = whiteImages;
        }
    }

    public String getTaskName() {
        return taskName;
    }

    public void setTaskName(String taskName) {
        this.taskName = taskName;
    }

    public String getOriginalMessage() {
        return originalMessage;
    }

    public void setOriginalMessage(String originalMessage) {
        this.originalMessage = originalMessage;
    }

    public List<ProductItem> getProducts() {
        return products;
    }

    public void setProducts(List<ProductItem> products) {
        this.products = products;
    }

    public List<AccountConfig> getAccountConfigs() {
        return accountConfigs;
    }

    public void setAccountConfigs(List<AccountConfig> accountConfigs) {
        this.accountConfigs = accountConfigs;
    }

    public CommonParams getCommonParams() {
        return commonParams;
    }

    public void setCommonParams(CommonParams commonParams) {
        this.commonParams = commonParams;
    }

    public Integer getDelaySeconds() {
        return delaySeconds;
    }

    public void setDelaySeconds(Integer delaySeconds) {
        this.delaySeconds = delaySeconds;
    }
}

