package com.yonge.cooleshow.admin.io.request.coupon;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.annotation.JSONField;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.yonge.cooleshow.biz.dal.dto.UserParam;
import com.yonge.cooleshow.biz.dal.enums.ClientEnum;
import com.yonge.cooleshow.biz.dal.enums.SendTypeEnum;
import com.yonge.cooleshow.biz.dal.enums.coupon.CouponCategoryEnum;
import com.yonge.cooleshow.biz.dal.enums.coupon.CouponTypeEnum;
import com.yonge.cooleshow.biz.dal.enums.coupon.CouponUseStateEnum;
import com.yonge.toolset.base.page.QueryInfo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.joda.time.DateTime;
import org.springframework.format.annotation.DateTimeFormat;

import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
import java.util.Optional;

/**
 * Description
 *
 * @author liujunchi
 * @date 2022-09-02
 */
public class CouponIssueVo {

    @ApiModel("优惠券发放信息分页请求")
    public static class PageRequest extends QueryInfo {

        @ApiModelProperty(value = "优惠券id",required = true)
        private Long couponId;

        // 真实姓名/昵称/手机号/编号
        @ApiModelProperty("真实姓名/昵称/手机号/编号")
        private String keyword;

        @ApiModelProperty("用户id")
        private Long userId;

        // 客户端 TEACHER  STUDENT
        @ApiModelProperty("客户端 TEACHER  STUDENT")
        private ClientEnum clientType;

        // 发放方式 PLATFORM AVTIVITY
        @ApiModelProperty("发放方式 PLATFORM：后台发放 ACTIVITY：活动领取")
        private SendTypeEnum issueWay;

        //使用状态 USED:已使用 USABLE：未使用 EXPIRED：过期
        @ApiModelProperty("使用状态 USED:已使用 USABLE：未使用 EXPIRED：过期 WITHDRAW 撤回")
        private CouponUseStateEnum useState;

        //  发放开始时间
        @ApiModelProperty("发放开始时间")
        private Long issueStartTime;

        // 发放结束时间
        @ApiModelProperty("发放结束时间")
        private Long issueEndTime;

        //  使用开始时间
        @ApiModelProperty("使用开始时间")
        private Long usedStartTime;

        // 使用结束时间
        @ApiModelProperty("使用结束时间")
        private Long usedEndTime;

        public Long getUserId() {
            return userId;
        }

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

        public Long getCouponId() {
            return couponId;
        }

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

        public String getKeyword() {
            return keyword;
        }

        public void setKeyword(String keyword) {
            this.keyword = keyword;
        }

        public ClientEnum getClientType() {
            return clientType;
        }

        public void setClientType(ClientEnum clientType) {
            this.clientType = clientType;
        }

        public SendTypeEnum getIssueWay() {
            return issueWay;
        }

        public void setIssueWay(SendTypeEnum issueWay) {
            this.issueWay = issueWay;
        }

        public CouponUseStateEnum getUseState() {
            return useState;
        }

        public void setUseState(CouponUseStateEnum useState) {
            this.useState = useState;
        }

        public Long getIssueStartTime() {
            return issueStartTime;
        }

        public void setIssueStartTime(Long issueStartTime) {
            this.issueStartTime = issueStartTime;
        }

        public Long getIssueEndTime() {
            return issueEndTime;
        }

        public void setIssueEndTime(Long issueEndTime) {
            this.issueEndTime = issueEndTime;
        }

        public Long getUsedStartTime() {
            return usedStartTime;
        }

        public void setUsedStartTime(Long usedStartTime) {
            this.usedStartTime = usedStartTime;
        }

        public Long getUsedEndTime() {
            return usedEndTime;
        }

        public void setUsedEndTime(Long usedEndTime) {
            this.usedEndTime = usedEndTime;
        }

        public String jsonString() {
            return JSON.toJSONString(this);
        }
    }




    @ApiModel("优惠券发放信息分页信息")
    public static class CouponIssuePageInfo implements Serializable {

        @ApiModelProperty("用户id")
        private Long userId;

        @ApiModelProperty("优惠券发放id")
        private Long couponIssueId;

        @ApiModelProperty("用户实名")
        private String realName;

        @ApiModelProperty("用户昵称")
        private String username;

        @ApiModelProperty("客户端类型 TEACHER :老师端 STUDENT:学生端")
        private ClientEnum clientType;

        @ApiModelProperty("使用状态 USED:已使用 USABLE：未使用 EXPIRED：过期  WITHDRAW 撤回")
        private CouponUseStateEnum useState;

        @ApiModelProperty("订单号")
        private String orderNo;

        @ApiModelProperty("有效期开始时间")
        @JSONField(format = "yyyy-MM-dd")
        private Date startTime;

        @ApiModelProperty("有效期结束时间")
        @JSONField(format = "yyyy-MM-dd")
        private Date endTime;

        @ApiModelProperty("发放时间")
        private Date issueTime;

        @ApiModelProperty("使用时间")
        private Date useTime;

        @ApiModelProperty("发放途径PLATFORM：后台发放 ACTIVITY：活动领取")
        private SendTypeEnum issueWay;

        @ApiModelProperty("发放人昵称")
        private String issueUsername;

        @ApiModelProperty("发放人实名")
        private String issueRealName;

        @ApiModelProperty("备注")
        private String remark;


        @ApiModelProperty("用户手机号")
        private String phone;

        @ApiModelProperty("使用类型")
        private CouponCategoryEnum useType;

        public CouponCategoryEnum getUseType() {
            return useType;
        }

        public void setUseType(CouponCategoryEnum useType) {
            this.useType = useType;
        }

        public String getPhone() {
            return phone;
        }

        public void setPhone(String phone) {
            this.phone = phone;
        }

        public Long getUserId() {
            return userId;
        }

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

        public Long getCouponIssueId() {
            return couponIssueId;
        }

        public void setCouponIssueId(Long couponIssueId) {
            this.couponIssueId = couponIssueId;
        }

        public String getRealName() {
            return realName;
        }

        public void setRealName(String realName) {
            this.realName = realName;
        }

        public String getUsername() {
            return username;
        }

        public void setUsername(String username) {
            this.username = username;
        }

        public ClientEnum getClientType() {
            return clientType;
        }

        public void setClientType(ClientEnum clientType) {
            this.clientType = clientType;
        }

        public CouponUseStateEnum getUseState() {
            return useState;
        }

        public void setUseState(CouponUseStateEnum useState) {
            this.useState = useState;
        }

        public String getOrderNo() {
            return orderNo;
        }

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

        public Date getStartTime() {
            return startTime;
        }

        public void setStartTime(Date startTime) {
            this.startTime = startTime;
        }

        public Date getEndTime() {
            return endTime;
        }

        public void setEndTime(Date endTime) {
            this.endTime = endTime;
        }

        public Date getIssueTime() {
            return issueTime;
        }

        public void setIssueTime(Date issueTime) {
            this.issueTime = issueTime;
        }

        public Date getUseTime() {
            return useTime;
        }

        public void setUseTime(Date useTime) {
            this.useTime = useTime;
        }

        public SendTypeEnum getIssueWay() {
            return issueWay;
        }

        public void setIssueWay(SendTypeEnum issueWay) {
            this.issueWay = issueWay;
        }

        public String getIssueUsername() {
            return issueUsername;
        }

        public void setIssueUsername(String issueUsername) {
            this.issueUsername = issueUsername;
        }

        public String getIssueRealName() {
            return issueRealName;
        }

        public void setIssueRealName(String issueRealName) {
            this.issueRealName = issueRealName;
        }

        public String getRemark() {
            return remark;
        }

        public void setRemark(String remark) {
            this.remark = remark;
        }
    }

    @ApiModel("优惠券发放用户分页查询")
    public static class CouponIssueUserRequest extends QueryInfo {

        @ApiModelProperty(value = "优惠券id",required = true)
        @NotNull(message = "优惠券id不能为空")
        private Long couponId;

        // 真实姓名/昵称/手机号/编号
        @ApiModelProperty("真实姓名/昵称/手机号/编号")
        private String keyword;

        // 客户端 TEACHER  STUDENT
        @ApiModelProperty("客户端 TEACHER  STUDENT")
        private ClientEnum client;

        public Long getCouponId() {
            return couponId;
        }

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

        public String getKeyword() {
            return keyword;
        }

        public void setKeyword(String keyword) {
            this.keyword = keyword;
        }

        public ClientEnum getClient() {
            return client;
        }

        public void setClient(ClientEnum client) {
            this.client = client;
        }

        public String jsonString() {
            return JSON.toJSONString(this);
        }
    }

    @ApiModel("发送优惠券")
    public static class CouponIssueUserParam {

        @ApiModelProperty(value = "优惠券id",required = true)
        @NotNull(message = "优惠券id不能为空")
        private Long couponId;

        @ApiModelProperty("用户信息")
        @Size(min = 1,message = "请选择发送优惠券用户")
        private List<UserParam> userParam;


        @ApiModelProperty(value = "发放原因",required = true)
        private String remark;

        public String getRemark() {
            return remark;
        }

        public void setRemark(String remark) {
            this.remark = remark;
        }

        public Long getCouponId() {
            return couponId;
        }

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

        public List<UserParam> getUserParam() {
            return userParam;
        }

        public void setUserParam(List<UserParam> userParam) {
            this.userParam = userParam;
        }


    }

    @ApiModel("用户查询优惠券分页请求")
    public static class UserCouponIssuePageRequest extends QueryInfo{


        @ApiModelProperty("用户id")
        @NotNull(message = "用户id不能为空")
        private Long userId;


        @ApiModelProperty("用户类型")
        @NotNull(message = "用户类型不能为空")
        private ClientEnum clientType;

        @ApiModelProperty("优惠券编号/名称")
        private String couponKeyword;

        @ApiModelProperty("优惠券类型 ")
        private CouponTypeEnum couponType;

        @ApiModelProperty("可用品类 UNIVERSAL：全场通用 VIP：小酷Ai PIANO：云酷琴房 MALL：商场购物券 MUSIC：单曲点播券 SPARRING：陪练课购买券 LIVE：直播课购买券  VIDEO：视频课购买券")
        private CouponCategoryEnum couponCategory;

        @ApiModelProperty("获取途径 PLATFORM：平台，ACTIVITY:活动")
        private SendTypeEnum issueWay;

        @ApiModelProperty("使用状态 USED:已使用 USABLE：未使用 EXPIRED：过期  WITHDRAW 撤回")
        private CouponUseStateEnum useState;

        @ApiModelProperty("领取开始时间")
        private Date issueStartTime;

        @ApiModelProperty("领取结束时间")
        private Date issueEndTime;


        public SendTypeEnum getIssueWay() {
            return issueWay;
        }

        public void setIssueWay(SendTypeEnum issueWay) {
            this.issueWay = issueWay;
        }

        public CouponUseStateEnum getUseState() {
            return useState;
        }

        public void setUseState(CouponUseStateEnum useState) {
            this.useState = useState;
        }

        public Long getUserId() {
            return userId;
        }

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

        public ClientEnum getClientType() {
            return clientType;
        }

        public void setClientType(ClientEnum clientType) {
            this.clientType = clientType;
        }

        public String getCouponKeyword() {
            return couponKeyword;
        }

        public void setCouponKeyword(String couponKeyword) {
            this.couponKeyword = couponKeyword;
        }

        public CouponTypeEnum getCouponType() {
            return couponType;
        }

        public void setCouponType(CouponTypeEnum couponType) {
            this.couponType = couponType;
        }

        public CouponCategoryEnum getCouponCategory() {
            return couponCategory;
        }

        public void setCouponCategory(CouponCategoryEnum couponCategory) {
            this.couponCategory = couponCategory;
        }

        public Date getIssueStartTime() {
            return issueStartTime;
        }

        public void setIssueStartTime(Date issueStartTime) {
            this.issueStartTime = issueStartTime;
        }

        public Date getIssueEndTime() {
            return issueEndTime;
        }

        public void setIssueEndTime(Date issueEndTime) {
            this.issueEndTime = issueEndTime;
        }
        public String jsonString() {
            return JSON.toJSONString(this);
        }
    }

    @ApiModel("老师学生查看领取过的优惠券信息分页数据")
    public static class UserCouponIssuePageInfo {

        @ApiModelProperty("用户id")
        private Long userId;

        @ApiModelProperty("优惠券id")
        private Long couponId;

        @ApiModelProperty("优惠券名称")
        private String couponName;

        @ApiModelProperty("优惠券类型 ")
        private CouponTypeEnum couponType;

        @ApiModelProperty("可用品类 UNIVERSAL：全场通用 VIP：小酷Ai PIANO：云酷琴房 MALL：商场购物券 MUSIC：单曲点播券 SPARRING：陪练课购买券 LIVE：直播课购买券  VIDEO：视频课购买券")
        private CouponCategoryEnum couponCategory;

        @ApiModelProperty("使用状态 USED:已使用 USABLE：未使用 EXPIRED：过期")
        private CouponUseStateEnum useState;

        @ApiModelProperty("订单号")
        private String orderNo;

        @ApiModelProperty("有效期开始时间")
        @JSONField(format = "yyyy-MM-dd")
        private Date startTime;

        @ApiModelProperty("有效期结束时间")
        @JSONField(format = "yyyy-MM-dd")
        private Date endTime;

        @ApiModelProperty("发放时间")
        private Date issueTime;

        @ApiModelProperty("使用时间")
        private Date useTime;

        @ApiModelProperty("发放途径PLATFORM：后台发放 ACTIVITY：活动领取")
        private SendTypeEnum issueWay;

        @ApiModelProperty("发放人id")
        private Long issuer;

        @ApiModelProperty("发放人昵称")
        private String issueUsername;

        @ApiModelProperty("发放人实名")
        private String issueRealName;

        @ApiModelProperty("备注")
        private String remark;

        public BigDecimal couponAmount;

        public BigDecimal actualPrice;

        public BigDecimal expectPrice;

        @ApiModelProperty("使用类型")
        private CouponCategoryEnum useType;

        public CouponCategoryEnum getUseType() {
            return useType;
        }

        public void setUseType(CouponCategoryEnum useType) {
            this.useType = useType;
        }

        public Long getUserId() {
            return userId;
        }

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

        public Long getCouponId() {
            return couponId;
        }

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

        public String getCouponName() {
            return couponName;
        }

        public void setCouponName(String couponName) {
            this.couponName = couponName;
        }

        public CouponTypeEnum getCouponType() {
            return couponType;
        }

        public void setCouponType(CouponTypeEnum couponType) {
            this.couponType = couponType;
        }

        public CouponCategoryEnum getCouponCategory() {
            return couponCategory;
        }

        public void setCouponCategory(CouponCategoryEnum couponCategory) {
            this.couponCategory = couponCategory;
        }

        public CouponUseStateEnum getUseState() {
            return useState;
        }

        public void setUseState(CouponUseStateEnum useState) {
            this.useState = useState;
        }

        public String getOrderNo() {
            return orderNo;
        }

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

        public Date getStartTime() {
            return startTime;
        }

        public void setStartTime(Date startTime) {
            this.startTime = startTime;
        }

        public Date getEndTime() {
            return endTime;
        }

        public void setEndTime(Date endTime) {
            this.endTime = endTime;
        }

        public Date getIssueTime() {
            return issueTime;
        }

        public void setIssueTime(Date issueTime) {
            this.issueTime = issueTime;
        }

        public Date getUseTime() {
            return useTime;
        }

        public void setUseTime(Date useTime) {
            this.useTime = useTime;
        }

        public SendTypeEnum getIssueWay() {
            return issueWay;
        }

        public void setIssueWay(SendTypeEnum issueWay) {
            this.issueWay = issueWay;
        }

        public Long getIssuer() {
            return issuer;
        }

        public void setIssuer(Long issuer) {
            this.issuer = issuer;
        }

        public String getIssueUsername() {
            return issueUsername;
        }

        public void setIssueUsername(String issueUsername) {
            this.issueUsername = issueUsername;
        }

        public String getIssueRealName() {
            return issueRealName;
        }

        public void setIssueRealName(String issueRealName) {
            this.issueRealName = issueRealName;
        }

        public String getRemark() {
            return remark;
        }

        public void setRemark(String remark) {
            this.remark = remark;
        }
    }
}
