package com.cool.store.request.close.refund;

import com.cool.store.request.xgj.XgjSavePartnerRequest;
import com.cool.store.utils.BeanUtil;
import com.cool.store.utils.UUIDUtils;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

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

/**
 * <p>
 * 闭店退款供应商同步Request
 * </p>
 *
 * @author wangff
 * @since 2025/12/11
 */
@Data
public class CloseStorePartnerRequest {
    @ApiModelProperty("供应商名称")
    @NotBlank(message = "供应商名称不能为空")
    private String name;

    @ApiModelProperty("所属分类，测试环境填‘测试供应商分类’")
    @NotBlank(message = "供应商名称不能为空")
    private String parentName;

    @ApiModelProperty("所属分类编码，测试环境CGYS")
    @NotBlank(message = "供应商名称不能为空")
    private String parentBizCode;

    @ApiModelProperty("往来关系")
    private String partnerType;

    @ApiModelProperty("往来性质")
    private String partnerProperty;

    @ApiModelProperty("往来单位账户列表")
    @NotEmpty(message = "往来单位账户列表不能为空")
    @Valid
    private List<CloseStorePartnerAccountRequest> accounts;

    public XgjSavePartnerRequest convertXgj() {
        XgjSavePartnerRequest request = BeanUtil.toBean(this, XgjSavePartnerRequest.class);
        request.setBusinessCode(UUIDUtils.get32UUID());
        return request;
    }
}
