package com.vctgo.system.api.domain;

import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import com.vctgo.common.core.annotation.Excel;
import com.vctgo.common.core.web.domain.BaseEntity;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * 租户管理对象 sys_tenant
 *
 * @author vctgo
 * @date 2022-04-11
 */
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@TableName("sys_tenant")
public class SysTenant implements Serializable {
    private static final long serialVersionUID = 1L;

    /**
     * 租户编码
     */
    @Excel(name = "租户编码")
    @TableId(type = IdType.AUTO)
    private Long id;

    /**
     * 租户名称
     */
    @Excel(name = "租户名称")
    private String tenantName;

    /**
     * 租户名称
     */
    @Excel(name = "租户类型（1：集团，2：幼儿园有集团 3:幼儿园无集团）")
    private Integer tenantType;

    /**
     * 集团Id
     */
    @JsonSerialize(using = ToStringSerializer.class)
    private Long gardenId;

    /**
     * 幼儿园Id
     */
    @JsonSerialize(using = ToStringSerializer.class)
    private Long branchId;

    /**
     * 管理员账号
     */
    @Excel(name = "管理员账号")
    private String userName;

    /**
     * 账号密码
     */
    @TableField(exist = false)
    private String password;

    /**
     * 手机号码
     */
    @Excel(name = "手机号码")
    private String userPhone;

    /**
     * 邮箱地址
     */
    @Excel(name = "邮箱地址")
    private String userEmail;

    /**
     * 租户套餐
     */
    @Excel(name = "租户套餐")
    private Long tenantPackage;

    /**
     * 租户状态（0正常 1停用）
     */
    @Excel(name = "租户状态", readConverterExp = "0=启用,1=禁用")
    private Integer status;

    /**
     * 删除标志（0代表存在 1代表删除）
     */
    private String delFlag;

    /**
     * 创建者id
     */
    @TableField(fill = FieldFill.INSERT)
    @JsonSerialize(using = ToStringSerializer.class)
    private Long createById;

    /**
     * 更新者id
     */
    @TableField(fill = FieldFill.INSERT_UPDATE)
    @JsonSerialize(using = ToStringSerializer.class)
    private Long updateById;

    /**
     * 父id
     */
    @TableField(exist = false)
    @JsonSerialize(using = ToStringSerializer.class)
    private Long parentId;

    /**
     * 搜索值
     */
    @TableField(exist = false)
    @JsonIgnore
    private String searchValue;

    /**
     * 创建者
     */
    @TableField(fill = FieldFill.INSERT)
    private String createBy;

    /**
     * 创建时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @TableField(fill = FieldFill.INSERT)
    private Date createTime;

    /**
     * 更新者
     */
    @TableField(fill = FieldFill.INSERT_UPDATE)
    private String updateBy;

    /**
     * 更新时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @TableField(fill = FieldFill.INSERT_UPDATE)
    private Date updateTime;

    /**
     * 备注
     */
    private String remark;


    /**
     * 请求参数
     */
    @ApiModelProperty(hidden = true)
    @TableField(exist = false)
    @JsonInclude(JsonInclude.Include.NON_EMPTY)
    private Map<String, Object> params = new HashMap<>();

    @TableField(exist = false)
    private List<SysService> sysServiceList;

    @TableField(exist = false)
    private String createNickName;

    @TableField(exist = false)
    private String sysService;

    @TableField(exist = false)
    private List<SysTenant> sysTenantList;

    @TableField(exist = false)
    private List<SysTenant> children;

    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
//    @Excel(name = "租赁开始时间", width = 30, dateFormat = "yyyy-MM-dd")
    private Date tenantStartTime;

    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
//    @Excel(name = "租赁结束时间", width = 30, dateFormat = "yyyy-MM-dd")
    private Date tenantEndTime;

    private String longTerm;

    @TableField(exist = false)
    private String logoUrl;

    @TableField(exist = false)
    private String gardenName;

    @TableField(exist = false)
    private String kindergartenName;

    @TableField(exist = false)
    private String phonenumber;

    @TableField(exist = false)
    private String accountStatus;

    /**
     *  数据来源1 系统 2 评选小程序
     */
    private Integer sourceType;
}
