package com.yonge.cooleshow.biz.dal.dto.req;

import com.yonge.cooleshow.biz.dal.enums.ClientEnum;
import com.yonge.cooleshow.biz.dal.enums.GoodTypeEnum;
import com.yonge.cooleshow.biz.dal.enums.OrderTypeEnum;
import com.yonge.cooleshow.biz.dal.vo.res.OrderCreateRes;
import com.yonge.toolset.payment.base.enums.PaymentClientEnum;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import springfox.documentation.annotations.ApiIgnore;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.math.BigDecimal;
import java.util.List;
import java.util.Optional;

/**
 * 下单请求
 *
 * @Author: liweifan
 * @Data: 2022/3/31 14:55
 */
@ApiModel(value = "OrderReq对象", description = "下单请求")
public class OrderReq {
    @ApiModelProperty(value = "用户id ",hidden = true)
    private Long userId;
    @ApiModelProperty(value = "订单号", hidden = true)
    private String orderNo;
    @ApiModelProperty(value = "下单客户端 ",hidden = true)
    private ClientEnum orderClient;
    @NotBlank(message = "订单名称不能为空")
    @ApiModelProperty(value = "订单名称 ", required = true)
    private String orderName;
    @NotNull(message = "订单类型不能为空")
    @ApiModelProperty(value = "订单类型: 学生端（ VIP、开通会员  PRACTICE、陪练课购买  LIVE、直播课购买 VIDEO、视频课购买 MUSIC、单曲点播 ACTI_REGIST、活动报名 ） 老师端（VIP、开通会员 PINAO_ROOM、琴房时长 ACTI_REGIST 活动报名）", required = true)
    private OrderTypeEnum orderType;
    @ApiModelProperty(value = "订单描述信息 ")
    private String orderDesc;
    @ApiModelProperty("用户备注 ")
    private String userNote;
    @ApiModelProperty(value = "优惠券id；多个使用，隔开")
    private String couponId;
    @ApiModelProperty(value = "推荐用户id(有推荐人的情况)")
    private Long recomUserId;

    @ApiModelProperty(value = "活动id")
    private Long activityId;

    @ApiModelProperty(value = "活动奖品id",hidden = true)
    private Long rewardId;
    @NotNull(message = "订单金额不能为空")
    @ApiModelProperty(value = "订单金额", required = true)
    private BigDecimal actualPrice;
    @NotNull(message = "商品详情不能为空")
    @ApiModelProperty(value = "业务请求详情", required = true)
    private List<OrderReqInfo> orderInfos;


    @ApiModel(value = "OrderReqInfo对象", description = "下单请求业务详情对象")
    public class OrderReqInfo {
        @ApiModelProperty(value = "y用户id", hidden = true)
        private Long userId;
        @ApiModelProperty(value = "推荐用户id(有推荐人的情况)", hidden = true)
        private Long recomUserId;
        @ApiModelProperty(value = "订单号", hidden = true)
        private String orderNo;
        @ApiModelProperty(value = "订单详情号", hidden = true)
        private String subOrderNo;
        @NotNull(message = "商品类型不能为空")
        @ApiModelProperty(value = "商品类型: 学生端（ VIP、开通会员  PRACTICE、陪练课购买  LIVE、直播课购买 VIDEO、视频课购买 MUSIC、单曲点播 ACTI_REGIST、活动报名） 老师端（ PINAO_ROOM、琴房时长 ACTI_REGIST 活动报名）", required = true)
        private GoodTypeEnum goodType;
        @ApiModelProperty("商品名称 ")
        private String goodName;
        @ApiModelProperty(value = "优惠券id")
        private Long couponId;
        @ApiModelProperty(value = "业务内容")
        private Object bizContent;
        @ApiModelProperty(value = "调用业务创建方法返回", hidden = true)
        private OrderCreateRes createRes;
        @ApiModelProperty(value = "订单金额", required = true)
        private BigDecimal actualPrice;
        @ApiModelProperty(value = "活动id")
        private Long activityId;

        // 透传订单类型
        private OrderTypeEnum orderType;

        public BigDecimal getActualPrice() {
            return actualPrice;
        }

        public void setActualPrice(BigDecimal actualPrice) {
            this.actualPrice = actualPrice;
        }

        public Long getActivityId() {
            return activityId;
        }

        public void setActivityId(Long activityId) {
            this.activityId = activityId;
        }

        public Long getUserId() {
            return userId;
        }

        public void setUserId(Long userId) {
            this.userId = userId;
        }

        public String getOrderNo() {
            return orderNo;
        }

        public void setOrderNo(String orderNo) {
            this.orderNo = orderNo;
        }

        public GoodTypeEnum getGoodType() {
            return goodType;
        }

        public void setGoodType(GoodTypeEnum goodType) {
            this.goodType = goodType;
        }

        public Object getBizContent() {
            return bizContent;
        }

        public void setBizContent(Object bizContent) {
            this.bizContent = bizContent;
        }

        public String getGoodName() {
            return goodName;
        }

        public void setGoodName(String goodName) {
            this.goodName = goodName;
        }

        public Long getCouponId() {
            return couponId;
        }

        public void setCouponId(Long couponId) {
            this.couponId = couponId;
        }

        public String getSubOrderNo() {
            return subOrderNo;
        }

        public void setSubOrderNo(String subOrderNo) {
            this.subOrderNo = subOrderNo;
        }

        public OrderCreateRes getCreateRes() {
            return createRes;
        }

        public void setCreateRes(OrderCreateRes createRes) {
            this.createRes = createRes;
        }

        public Long getRecomUserId() {
            return recomUserId;
        }

        public void setRecomUserId(Long recomUserId) {
            this.recomUserId = recomUserId;
        }

        public OrderTypeEnum getOrderType() {
            return orderType;
        }

        public void setOrderType(OrderTypeEnum orderType) {
            this.orderType = orderType;
        }
    }

    public Long getRewardId() {
        return rewardId;
    }

    public void setRewardId(Long rewardId) {
        this.rewardId = rewardId;
    }

    public Long getUserId() {
        return userId;
    }

    public void setUserId(Long userId) {
        this.userId = userId;
    }

    public String getOrderName() {
        return orderName;
    }

    public void setOrderName(String orderName) {
        this.orderName = orderName;
    }

    public OrderTypeEnum getOrderType() {
        return orderType;
    }

    public void setOrderType(OrderTypeEnum orderType) {
        this.orderType = orderType;
    }

    public String getOrderDesc() {
        return orderDesc;
    }

    public void setOrderDesc(String orderDesc) {
        this.orderDesc = orderDesc;
    }

    public List<OrderReqInfo> getOrderInfos() {
        return orderInfos;
    }

    public void setOrderInfos(List<OrderReqInfo> orderInfos) {
        this.orderInfos = orderInfos;
    }

    public String getUserNote() {
        return userNote;
    }

    public void setUserNote(String userNote) {
        this.userNote = userNote;
    }

    public String getCouponId() {
        return Optional.ofNullable(couponId).orElse("");
    }

    public void setCouponId(String couponId) {
        this.couponId = couponId;
    }

    public BigDecimal getActualPrice() {
        return actualPrice;
    }

    public void setActualPrice(BigDecimal actualPrice) {
        this.actualPrice = actualPrice;
    }

    public String getOrderNo() {
        return orderNo;
    }

    public void setOrderNo(String orderNo) {
        this.orderNo = orderNo;
    }

    public ClientEnum getOrderClient() {
        return orderClient;
    }

    public void setOrderClient(ClientEnum orderClient) {
        this.orderClient = orderClient;
    }

    public Long getRecomUserId() {
        return recomUserId;
    }

    public void setRecomUserId(Long recomUserId) {
        this.recomUserId = recomUserId;
    }

    public Long getActivityId() {
        return activityId;
    }

    public void setActivityId(Long activityId) {
        this.activityId = activityId;
    }
}
