package com.bocloud.ims.entity.resource;

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")
public class LbTarget extends Generic {
    @PK(value = PKStrategy.AUTO)
    private Long id;
    @Column("uuid")
    private String uuid;
    @Column("tg_id")
    private Long tgId;
    @Column("tg_uuid")
    private String tgUuid;
    @Column("port")
    private Integer port;
    @Column("availability_zone")
    private String availabilityZone;
    @Column("health_check_port")
    private String healthCheckPort;
    @Column("state")
    private String state;
    @Column("reason")
    private String reason;
    @Column("description")
    private String description;
    @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;
    @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;
}