package com.yh.saas.plugin.operation.entity;

import com.baomidou.mybatisplus.annotations.TableField;
import com.baomidou.mybatisplus.annotations.TableId;
import com.baomidou.mybatisplus.enums.IdType;
import com.winsea.svc.base.plugin.entity.ParameterPluginAttribute;
import com.winsea.svc.base.plugin.entity.TenantService;
import com.yh.saas.common.support.entity.BaseModel;
import com.yh.saas.common.support.util.uniqueness.Unique;
import lombok.Getter;
import lombok.Setter;

import javax.validation.constraints.NotBlank;
import java.io.Serializable;
import java.util.List;

/**
 * 租户
 *
 * @author SunTianjun
 */
@Getter
@Setter
public class CommonTenant extends BaseModel<CommonTenant> {

    private static final long serialVersionUID = 1L;

    /**
     * 租户ID
     */
    @TableId(type = IdType.INPUT)
    private String tenantId;

    /**
     * 租户名
     */
    @NotBlank
    @Unique(value = "OPERATION-003")
    private String tenantName;

    /**
     * 租户英文名
     */
    @NotBlank
    @Unique(value = "OPERATION-003")
    private String tenantEnName;

    /**
     * 联系人姓名
     */
    @NotBlank
    private String linkmanName;

    /**
     * 联系人电话
     */
    @NotBlank
    @Unique(value = "OPERATION-002")
    private String linkmanPhone;

    /**
     * 联系人邮箱
     */
    private String linkmanEmail;

    /**
     * 联系人密码
     */
    private String linkmanPassword;

    /**
     * 船舶数量
     */
    private String shipNumber;

    /**
     * 专属客服ID
     */
    private String customerServiceStaffId;
    
    /**
     * 租户状态标识
     */
    private String statusFlag;

    /**
     * 租户状态
     */
    private String status;

    /**
     * 租户状态En
     */
    private String statusEn;

    /**
     * 租户来源
     */
    private String tenantSource;

    /**
     * 停用原因
     */
    private String reason;

    /**
     * 附件id
     */
    private String appendixPath;

    /**
     * 合同开始日期
     */
    private String contractStartDate;

    /**
     * 合同结束日期
     */
    private String contractEndDate;

    /**
     * 是否是启用状态 0:否 1:是
     */
    private Integer enabled;

    /**
     * 服务类型
     */
    private SERVICE_TYPE_STATUS serviceType;

    /**
     * 企业简称
     */
    @Unique(value = "COMPANY-001")
    private String compSimpleNameEn;

    /**
     * 公司云盘大小(G)
     */
    private String cloudDiskSize;

    private String customerServiceStaffName;

    /**
     * 客服电话
     */
    private String customerServiceStaffPhone;

    /**
     * 开通模块
     */
    @TableField(exist = false)
    private String openingmodule;

    /**
     * 剩余天数
     */
    @TableField(exist = false)
    private int daysRemaining;

    @TableField(exist = false)
    private String compId;

    @TableField(exist = false)
    private String compDomainName;

    @TableField(exist = false)
    private String veriCode;

    @TableField(exist = false)
    private String password;

    /**
     * 租户激活的服务列表
     */
    @TableField(exist = false)
    private List<TenantService> activatedServices;

    /**
     * 插件属性服务
     */
    @TableField(exist = false)
    private List<ParameterPluginAttribute> pluginAttributes;

    @Override
    protected Serializable pkVal() {
        return tenantId;
    }

    /**
     * 查询用字段
     */
    public static class QueryFields {

        public static final String TENANT_ID = "tenant_id";

        public static final String TENANT_NAME = "tenant_name";

        public static final String TENANT_NAME_EN = "tenant_en_name";

        public static final String COMP_SIMPLE_NAME_EN = "comp_simple_name_en";

        public static final String LINKMAN_PHONE = "linkman_phone";

        public static final String LINKMAN_NAME = "linkman_name";

        public static final String STATUS_FLAG = "status_flag";

        private QueryFields() {
        }
    }

    /**
     * 服务类型标识
     */
    public enum SERVICE_TYPE_STATUS {
        //船端
        SHIP_CLIENT,

        //岸端
        COAST_CLIENT,

        //船端+岸端
        SHIP_COAST_CLIENT,

        ;
    }
    
    /**
     * 租户来源
     */
    public enum TENANT_SOURCE {
    	//winsea平台
    	WINSEA_PLATFORM,
    	
    	//winsea官网
    	WINSEA_WEBSITE,
    	
    	//海大航运视界（app）
    	WINSEA_APP,
    	
    	;
    }
}
