package com.qiaoba.api.tenant.entity.param;

import com.qiaoba.common.base.enums.BaseEnum;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;

import java.io.Serializable;
import java.util.Date;

/**
 * 租户查询条件
 *
 * @author ailanyin
 * @version 1.0
 * @since 2023/5/30 11:02
 */
@Data
public class SysTenantParam implements Serializable {

    private static final long serialVersionUID = 1L;

    /**
     * 未过期
     */
    public static final String TYPE_NOT_EXPIRED = "1";

    /**
     * 已过期
     */
    public static final String TYPE_EXPIRED = "2";

    private String companyName;

    private String contactName;

    @Schema(description = "帐号状态(1正常 0停用)")
    private String status;

    private Date time;

    @Schema(description = "类型(1正常 2过期)")
    private String type;

    @Schema(description = "是否初始化(1是 0否)")
    private String initialized;

    /**
     * 是否是登陆接口
     */
    private Boolean isLogin = false;

    public static SysTenantParam buildNormalSelectParam() {
        return buildNormalSelectParam(null);
    }

    public static SysTenantParam buildNormalSelectParam(String companyName) {
        SysTenantParam param = new SysTenantParam();
        param.setCompanyName(companyName);
        param.setTime(new Date());
        param.setStatus(BaseEnum.NORMAL.getCode());
        param.setType(SysTenantParam.TYPE_NOT_EXPIRED);
        param.setIsLogin(true);
        param.setInitialized(BaseEnum.YES.getCode());
        return param;
    }
}
