package com.bocloud.ims.entity.middleware;

import com.bocloud.common.utils.DaySerializer;
import com.bocloud.entity.annotations.Column;
import com.bocloud.entity.annotations.IgnoreAll;
import com.bocloud.entity.annotations.PK;
import com.bocloud.entity.annotations.Table;
import com.bocloud.entity.bean.GenericEntity;
import com.bocloud.entity.meta.PKStrategy;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import org.springframework.format.annotation.DateTimeFormat;

import java.util.Date;

/**
 * @author: liuyuanyuan
 * @date: 2021-05-12 9:42
 * @fileName: RdsPublicCloudInstance
 * @description: 公有云RDS
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
@EqualsAndHashCode(callSuper = true)
@Table("rds_pc_instance")
public class RdsPublicCloudInstance extends GenericEntity {

    @PK(PKStrategy.AUTO)
    private Long id;
    @Column("instance_id")
    private String instanceId;//公有云rdsId
    @Column("hostname")
    private String hostname;// 主机地址
    /**
     * 实例类型，取值为“Single”，“Ha”
     * 或“Replica”, "Enterprise"，分别对应
     * 于单机实例、主备实例、只读实例、分
     * 布式实例（企业版）。(华为)
     */
    /**
     * 实例类型，取值：
     * 阿里
     * Primary：主实例
     * Readonly：只读实例
     * Guard：灾备实例
     * Temp：临时实例
     */
    @Column("type")
    private String type;// RDS类型
    @Column("region")
    private String region;// RDS所在区域
    @Column("avail_zone")
    private String availZone;// RDS可用区域
    @Column("vpc_id")
    private String vpcId;// 关联VPC的UUID
    @Column("flavor_id")
    private String flavorId;// 数据库规格ID
    /**
     * local_ssd/ephemeral_ssd：本地SSD盘
     * cloud_ssd：SSD云盘
     * cloud_essd：ESSD云盘
     */
    @Column("volume_type")
    private String volType;// 存储类型
    @Column("volume_size")
    private Integer volSize;// 数据库存储容量
    @Column("data_store_type")
    private String dataStoreType;//数据库类型
    @Column("data_store_version")
    private String dataStoreVersion;//数据库版本
    @Column("db_port")
    private Integer dbPort;//RDS数据库服务的端口
    @Column("bkstart_time")
    private String bkStartTime;//启动备份的时间（通常Time类型）
    @Column("keep_days")
    private Integer keepDays;//保存备份的天数

    @Column("pay_type")
    private String payType;//实例付费类型 Postpaid 按量付费
    @Column("period")
    private String period;
    @Column("used_time")
    private String usedTime;
    @Column("resource_id")
    private String resourceId;
    @Column("auto_renew")
    private String autoRenew;//是否自动续费
    @Column("param_group_id")
    private String paramGroupId;
    @Column("time_zone")
    private String timeZone;//时区
    @Column("ignore_case")
    private String IgnoreCase;//是否忽略大小写
    @Column("instance_network_type")
    private String instanceNetworkType;//实例的网络类型
    @Column("connection_mode")
    private String connectionMode;//实例的访问模式  Standard 标准访问模式
    @Column("expire_time")
    private String expireTime; //包年包月实例到期时间，按量付费实例无到期时间
    @Column("dbInstance_net_type")
    private String dbInstanceNetType;//实例的网络连接类型 Internet外网连接；Intranet内网连接。
    @Column("lock_mode")
    private String lockMode;//实例的锁定状态
    @Column("lock_reason")
    private String lockReason;//实例被锁定的原因
    @Column("master_instance_id")
    private String masterInstanceId;//主实例的ID，如果没有返回此参数（即为null）则表示该实例是主实例
    @Column("guard_dbInstance_id")
    private String guardDbInstanceId;//主实例如果有灾备实例，该参数即为备实例的ID
    @Column("temp_dbInstance_id")
    private String tempDbInstanceId;//主实例如果有临时实例，该参数即为临时实例的ID
    @Column("read_only_dbInstance_id")
    private String readOnlyDbInstanceId;//主实例下如果有只读实例，该参数为只读实例的ID列表
    /**
     * Basic：基础版
     * HighAvailability：高可用版
     * AlwaysOn：集群版
     * Finance：三节点企业版
     */
    @Column("category")
    private String category;
    @Column("vswitch_id")
    private String vswitchId;
    @Column("vpc_cloud_instance_id")
    private String vpcCloudInstanceId;
    @Column("nics")
    private String nics;// 实例内网IP地址列表。
    @Column("security_group")
    private String securityGroup;// 实例外网IP地址列表。
    @Column("vendor_id")
    private Long vendorId;
    @Column("memory")
    private Long memory;
    @Column("cpu")
    private Integer cpu;
    @Column("max_connection")
    private Integer maxConnection;
    @Column("max_account")
    private Integer maxAccount;
    @Column("max_db")
    private Integer maxDb;
    @Column("max_iops")
    private Integer maxIops;
    @Column("project_id")
    private Long projectId;
    @Column("tenant_id")
    private Long tenantId;
    @Column("vendor_type")
    private String vendorType;
    @Column("is_recycle")
    private Boolean recycle;
    @Column("slave_id")
    private String slaveId;//仅HA实例时返回
    @Column("replica_of")
    private String replicaOf;//仅获取只读副本时返回
    @Column("replication_mode")
    private String replicationMode;//备机同步参数
    @Column("project_uuid")
    private String projectUuid;
    @Column("create_date")
    private String createDate;
    @Column("sepc_code")
    private String sepcCode;
    @Column("maintain_time")
    private String maintainTime;
    @Column("availability_value")
    private String availabilityValue;
    @Column("auto_upgrade_minor_version")
    private String autoUpgradeMinorVersion;
    @Column("dB_instance_class_type")
    private String dBInstanceClassType;
    /**
     * 内网IP
     */
    @Column("private_ip")
    private String privateIp;
    /**
     * 域名
     */
    @Column("dns_name")
    private String dnsName;
    /**
     * 公网IP
     */
    @Column("public_ip")
    private String publicIp;
    @IgnoreAll
    private String vendorName;
    @IgnoreAll
    private String tenantName;
    @IgnoreAll
    @JsonSerialize(using = DaySerializer.class)
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    /**
     *  过期时间
     */
    private Date expiredTime;
    @IgnoreAll
    private Long target;
    @IgnoreAll
    private String targetName;
    @IgnoreAll
    private String projectName;
    @IgnoreAll
    private String departmentName;
    private String spec;
}
