package com.bocloud.ims.entity.resource;

import com.bocloud.common.model.RequestContext;
import com.bocloud.common.utils.DateDeserializer;
import com.bocloud.common.utils.DateSerializer;
import com.bocloud.entity.annotations.*;
import com.bocloud.entity.bean.Generic;
import com.bocloud.entity.meta.PKStrategy;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
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;

@Data
@EqualsAndHashCode(callSuper = true)
@NoArgsConstructor
@AllArgsConstructor
@Table("lb_target_group")
public class LbTargetGroup extends Generic {
    @PK(value = PKStrategy.AUTO)
    private Long id;
    @Column("uuid")
    private String uuid;
    @Column("name")
    private String name;
    @Column("protocol")
    private String protocol;
    @Column("protocol_version")
    private String protocolVersion;
    @Column("port")
    private Integer port;
    @Column("vpc_uuid")
    private String vpcUuid;
    @Column("health_check_protocol")
    private String healthCheckProtocol;
    @Column("health_check_port")
    private String healthCheckPort;
    @Column("health_check_enabled")
    private Boolean healthCheckEnabled;
    @Column("health_check_interval_seconds")
    private Integer healthCheckIntervalSeconds;
    @Column("health_check_timeout_seconds")
    private Integer healthCheckTimeoutSeconds;
    @Column("healthy_threshold_count")
    private Integer healthyThresholdCount;
    @Column("unhealthy_threshold_count")
    private Integer unhealthyThresholdCount;
    @Column("health_check_path")
    private String healthCheckPath;
    @Column("load_balancer_uuids")
    private String loadBalancerUuids;
    @Column("type")
    private String type;
    @Column("http_code")
    private String httpCode; //matcher
    @Column("grpc_code")
    private String grpcCode; //matcher
    @Column("vendor_id")
    private Long vendorId;
    @Column("region_id")
    private String regionId;// 所属域
    @Column("is_deleted")
    private Boolean deleted;
    @Column("creator_id")
    private Long creatorId;
    @Column("mender_id")
    private Long menderId;
    @Column("owner_id")
    private Long ownerId;
    @Column("tenant_id")
    private Long tenantId;// 租户ID
    @Column("project_id")
    private Long projectId;// 项目ID
    @Column("business_id")
    private Long businessId;
    @Column("catalog")
    private RequestContext.Catalog catalog;// 账号类别
    @IgnoreUpdate
    @Column(value = "gmt_create", nullable = false)
    @JsonSerialize(using = DateSerializer.class)
    @JsonDeserialize(using = DateDeserializer.class)
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date gmtCreate;
    @Column("gmt_modify")
    @JsonSerialize(using = DateSerializer.class)
    @JsonDeserialize(using = DateDeserializer.class)
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date gmtModify;
    @IgnoreAll
    private String regionName;
    @IgnoreAll
    private Long vpcId;
    @IgnoreAll
    private String userName;// 用户名称
    @IgnoreAll
    private String businessName;// 业务
    @IgnoreAll
    private String creatorName;// 创建者名称
    @IgnoreAll
    private String ownerName;// 所属人名称
    @IgnoreAll
    private String menderName;// 维护人名称
    @IgnoreAll
    private String projectName;// 所属项目
    @IgnoreAll
    private String tenantName;
}