package com.yonge.cooleshow.tenant.vo;

import com.alibaba.fastjson.JSON;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

/**
 * 机构激活码
 * 2023-07-25 11:45:04
 */
@ApiModel(value = "TenantActivationCodeVo对象", description = "机构激活码查询视图对象")
public class TenantActivationCodeVo {

    @Data
    @ApiModel(" TenantActivationCodeSend-机构激活码发放")
    public static class TenantActivationCodeSend {

        @ApiModelProperty("专辑购买记录的ID")
        @NotNull(message = "专辑购买记录的ID不能为空")
        private Long tenantAlbumPurchaseId;

        @ApiModelProperty("机构ID")
        private Long tenantId;

        @ApiModelProperty("激活码列表，批量发送时为空")
        private List<String> activationCodeList = new ArrayList<>();

        @ApiModelProperty("学生ID列表")
        @Size(min = 1, message = "未选择学生")
        private List<Long> studentIdList = new ArrayList<>();
    }


    @Data
    @ApiModel(" TenantActivationCodeSend-机构激活码重发")
    public static class TenantActivationCodeResend {


        @ApiModelProperty("专辑购买记录的ID")
        @NotNull(message = "专辑购买记录的ID不能为空")
        private Long tenantAlbumPurchaseId;

        @ApiModelProperty("结构ID")
        private Long tenantId;

        @ApiModelProperty("激活码")
        @NotBlank(message = "激活码不能为空")
        private String code;

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


    @Data
    @ApiModel(" TenantActivationCode-机构激活码")
    public static class TenantActivationCode {


        @ApiModelProperty("主键ID")
        private Long id;


        @ApiModelProperty("机构ID")
        private Long tenantId;


        @ApiModelProperty("机构专辑ID")
        private Long tenantAlbumId;


        @ApiModelProperty("机构专辑采购ID")
        private Long tenantAlbumPurchaseId;


        @ApiModelProperty("激活码")
        private String activationCode;


        @ApiModelProperty("发送状态(WAIT,SEND)")
        private String sendStatus;


        @ApiModelProperty("激活状态")
        private Boolean activationStatus;


        @ApiModelProperty("激活手机号")
        private String activationPhone;


        @ApiModelProperty("激活时间")
        private Date activationTime;


        @ApiModelProperty("激活用户ID")
        private Long activationUserId;


        @ApiModelProperty("更新时间")
        private Date updateTime;


        @ApiModelProperty("创建时间")
        private Date createTime;

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


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

        public static TenantActivationCode from(String json) {
            return JSON.parseObject(json, TenantActivationCode.class);
        }
    }

    @Data
    @ApiModel("激活码发放")
    public static class CodeSend {

        @ApiModelProperty("机构ID")
        @NotNull
        private Long tenantId;

        @ApiModelProperty("激活码ID")
        @NotNull
        private Long id;

    }

}