package com.gxwebsoft.common.system.entity;

import cn.hutool.core.util.DesensitizedUtil;
import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;

import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;

/**
 * 企业信息
 *
 * @author 科技小王子
 * @since 2023-05-27 14:57:34
 */
@Data
@EqualsAndHashCode(callSuper = false)
@Schema(name = "Company对象", description = "企业信息")
@TableName("sys_company")
public class Company implements Serializable {
    private static final long serialVersionUID = 1L;

    @Schema(description = "企业id")
    @TableId(value = "company_id", type = IdType.AUTO)
    private Integer companyId;

    @Schema(description = "应用类型")
    private Integer type;

    @Schema(description = "企业简称")
    private String shortName;

    @Schema(description = "企业全称")
    @TableField(exist = false)
    private String companyName;

    @Schema(description = "企业标识")
    private String companyCode;

    @Schema(description = "企业类型")
    private String companyType;

    @Schema(description = "是否官方")
    private Boolean official;

    @Schema(description = "企业类型 多选")
    private String companyTypeMultiple;

    @Schema(description = "应用标识")
    private String companyLogo;

    @Schema(description = "封面图")
    private String image;

    @Schema(description = "应用详情")
    @TableField(exist = false)
    private String content;

    @Schema(description = "栏目分类")
    private Integer categoryId;

    @Schema(description = "栏目名称")
    @TableField(exist = false)
    private String categoryName;

    @Schema(description = "应用截图")
    private String files;

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

    @Schema(description = "免费域名")
    private String freeDomain;

    @Schema(description = "销售价格")
    private BigDecimal price;

    @Schema(description = "计费方式")
    private Integer chargingMethod;

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

    @Schema(description = "公司座机")
    private String tel;

    @Schema(description = "电子邮箱")
    private String email;

    @Schema(description = "企业法人")
    private String businessEntity;

    @Schema(description = "发票抬头")
    @TableField("Invoice_header")
    private String invoiceHeader;

    @Schema(description = "服务开始时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date startTime;

    @Schema(description = "服务到期时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date expirationTime;

    @Schema(description = "即将过期")
    private Integer soon;

    @Schema(description = "应用版本 10体验版 20授权版 30旗舰版")
    private Integer version;

    @Schema(description = "版本名称")
    private String versionName;

    @Schema(description = "版本号")
    private String versionCode;

    @Schema(description = "评分")
    private BigDecimal rate;

    @Schema(description = "企业成员(当前)")
    private Integer users;

    @Schema(description = "成员数量(上限)")
    private Integer members;

    @Schema(description = "浏览数量")
    private Long clicks;

    @Schema(description = "点赞数量")
    private Long likes;

    @Schema(description = "购买数量")
    private Long buys;

    @Schema(description = "存储空间")
    private Long storage;

    @Schema(description = "存储空间(上限)")
    private Long storageMax;

    @Schema(description = "行业类型(父级)")
    private String industryParent;

    @Schema(description = "行业类型(子级)")
    private String industryChild;

    @Schema(description = "部门数量")
    private Integer departments;

    @Schema(description = "所在国家")
    private String country;

    @Schema(description = "所在省份")
    private String province;

    @Schema(description = "所在城市")
    private String city;

    @Schema(description = "所在辖区")
    private String region;

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

    @Schema(description = "经度")
    private String longitude;

    @Schema(description = "纬度")
    private String latitude;

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

    @Schema(description = "是否实名认证")
    private Integer authentication;

    @Schema(description = "主控端节点")
    private String serverUrl;

    @Schema(description = "模块节点")
    private String modulesUrl;

    @Schema(description = "重定向节点")
    private String redirectUrl;

    @Schema(description = "request合法域名")
    private String requestUrl;

    @Schema(description = "socket合法域名")
    private String socketUrl;

    @Schema(description = "总后台管理入口")
    private String adminUrl;

    @Schema(description = "商户端管理入口")
    private String merchantUrl;

    @Schema(description = "默认网站URL")
    private String websiteUrl;

    @Schema(description = "微信小程序二维码")
    private String mpWeixinCode;

    @Schema(description = "支付宝小程序二维码")
    private String mpAlipayCode;

    @Schema(description = "H5端应用二维码")
    private String h5Code;

    @Schema(description = "安卓APP二维码")
    private String androidUrl;

    @Schema(description = "苹果APP二维码")
    private String iosUrl;

    @Schema(description = "应用类型")
    private String appType;

    @Schema(description = "状态")
    private Integer status;

    @Schema(description = "排序")
    private Integer sortNumber;

    @Schema(description = "插件ID(菜单根节点)")
    private Integer menuId;

    @Schema(description = "当前使用的租户模板")
    private Integer planId;

    @Schema(description = "是否开启网站")
    private Boolean websiteStatus;

    @Schema(description = "用户ID")
    private Integer userId;

    @Schema(description = "是否含税")
    private Boolean isTax;

    @Schema(description = "是否删除, 0否, 1是")
    @TableLogic
    private Integer deleted;

    @Schema(description = "创建时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date createTime;

    @Schema(description = "修改时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date updateTime;

    @Schema(description = "是否默认企业主体")
    private Boolean authoritative;

    @Schema(description = "是否推荐")
    private Boolean recommend;

    @Schema(description = "商户ID")
    private Long merchantId;

    @Schema(description = "租户ID")
    private Integer tid;

    @Schema(description = "租户id")
    private Integer tenantId;

    @Schema(description = "租户名称")
    @TableField(exist = false)
    private String tenantName;

    @Schema(description = "租户编号")
    @TableField(exist = false)
    private String tenantCode;

    @Schema(description = "昵称")
    @TableField(exist = false)
    private String nickname;

    @Schema(description = "配置信息")
    @TableField(exist = false)
    private Object config;

    @Schema(description = "是否已收藏")
    @TableField(exist = false)
    private Boolean collection;

    @Schema(description = "新注册的密码")
    @TableField(exist = false)
    private String password;

    @Schema(description = "手机号(脱敏)")
    @TableField(exist = false)
    private String mobile;

    @Schema(description = "是否已购买")
    @TableField(exist = false)
    private Boolean isBuy;

    @Schema(description = "用户是否已安装了该插件")
    @TableField(exist = false)
    private Boolean installed;

    @Schema(description = "产品参数")
    @TableField(exist = false)
    private List<CompanyParameter> parameters;

    @Schema(description = "产品按钮及链接")
    @TableField(exist = false)
    private List<CompanyUrl> links;

    @Schema(description = "购买数量")
    @TableField(exist = false)
    private Integer num;

    @Schema(description = "角色列表")
    @TableField(exist = false)
    private List<Role> roles;

    @Schema(description = "权限列表")
    @TableField(exist = false)
    private List<Menu> authorities;

    @Schema(description = "记录克隆的模板ID")
    @TableField(exist = false)
    private Integer templateId;

    public String getMobile() {
      return DesensitizedUtil.mobilePhone(this.phone);
    }

}
