package com.yonge.cooleshow.biz.dal.wrapper;

import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.microsvc.toolkit.common.response.paging.QueryInfo;
import com.yonge.cooleshow.common.enums.ETenantUnBindAuditStatus;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;

import java.util.Date;
import java.util.Optional;

import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.apache.commons.lang3.StringUtils;
import org.springframework.format.annotation.DateTimeFormat;

/**
 * 机构解绑历史表
 * 2023-08-18 18:00:10
 */
@ApiModel(value = "TenantUnbindHistoryWrapper对象", description = "机构解绑历史表查询对象")
public class TenantUnbindHistoryWrapper {

    @Data
    @Builder
    @NoArgsConstructor
    @AllArgsConstructor
    @ApiModel(" TenantUnbindHistoryQuery-机构解绑历史表")
    public static class TenantUnbindHistoryQuery implements QueryInfo {

        @ApiModelProperty("当前页")
        private Integer page;

        @ApiModelProperty("分页行数")
        private Integer rows;

        @ApiModelProperty("关键字匹配")
        private String keyword;

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

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

        public String getKeyword() {
            return Optional.ofNullable(keyword).filter(StringUtils::isNotBlank).orElse(null);
        }

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

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

    @Data
    @ApiModel(" TenantUnbindHistory-机构解绑历史表")
    public static class TenantUnbindHistory {

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

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

        @ApiModelProperty("机构名称")
        private String tenantName;

        @ApiModelProperty("机构员工")
        private String tenantUserName;

        @ApiModelProperty("机构员工手机号")
        private String tenantPhone;

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

        @ApiModelProperty("用户名称")
        private String userName;

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

        @ApiModelProperty("用户类型")
        private String userType;

        @ApiModelProperty("解绑理由")
        private String unbindReason;

        @ApiModelProperty("审核状态 CANCEL、撤销 PASS、通过 UNPASS、不通过")
        private ETenantUnBindAuditStatus status;

        @ApiModelProperty("审核人")
        private Long verifyUserId;

        @ApiModelProperty("审核人姓名")
        private String verifyUserName;

        @ApiModelProperty("审核理由")
        private String reason;

        @ApiModelProperty("后台介入时间")
        @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
        @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
        private Date interveneTime;

        @ApiModelProperty("创建时间")
        @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
        @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
        private Date createTime;

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

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

}