package com.qiaoba.module.tenant.entity;

import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.qiaoba.common.base.entity.BaseEntity;
import com.qiaoba.common.base.validate.AddGroup;
import com.qiaoba.common.base.validate.EditGroup;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;

import java.util.Date;

/**
 * 租户 sys_tenant
 *
 * @author ailanyin
 * @version 1.0
 * @since 2023/5/30 10:20
 */
@Data
@EqualsAndHashCode(callSuper = false)
@TableName("sys_tenant")
@NoArgsConstructor
public class SysTenant extends BaseEntity {

    private static final long serialVersionUID = 1L;

    /**
     * 字段模式
     */
    public static final String COLUMN_MODE = "1";

    /**
     * 数据库模式
     */
    public static final String SCHEMA_MODE = "2";

    /**
     * 数据源模式
     */
    public static final String DATASOURCE_MODE = "3";

    @TableId
    @NotNull(message = "id不能为空", groups = {EditGroup.class})
    private String tenantId;

    @NotBlank(message = "企业名称不能为空", groups = {AddGroup.class, EditGroup.class})
    @Schema(description = "企业名称")
    private String companyName;

    @Schema(description = "联系人")
    private String contactName;

    @Schema(description = "联系电话")
    private String contactPhone;

    @Schema(description = "地址")
    private String address;

    @Schema(description = "企业简介")
    private String profile;

    @Schema(description = "统一社会信用代码")
    private String licenseNumber;

    @Schema(description = "域名")
    private String domain;

    @Schema(description = "备注")
    private String remark;

    @NotNull(message = "过期时间不能为空", groups = {AddGroup.class, EditGroup.class})
    @Schema(description = "过期时间")
    private Date expireTime;

    @NotNull(message = "用户数量不能为空", groups = {AddGroup.class, EditGroup.class})
    @Schema(description = "用户数量")
    private Long accountCount;

    @NotNull(message = "状态不能为空", groups = {AddGroup.class, EditGroup.class})
    @Schema(description = "状态")
    private String status;

    private String mode;

    private String initialized;

    public SysTenant(String tenantId, String status) {
        this.tenantId = tenantId;
        this.status = status;
    }
}
