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.Data;
import org.springframework.format.annotation.DateTimeFormat;

import java.util.Date;

@Data
@Table("lb_listener_rule")
public class LbListenerRule extends Generic {

    @PK(value = PKStrategy.AUTO)
    private Long id; // ID

    @Column("rule_uuid")
    private String ruleUuid;

    @Column("policy_id")
    private Long policyId;

    @Column("policy_uuid")
    private String policyUuid;

    @Column("provisioning_status")
    private String provisioningStatus;

    @Column("admin_state_up")
    private Boolean adminStateUp;

    @Column("tenant_uuid")
    private String tenantUuid;

    @Column("type")
    private String type;

    @Column("compare_type")
    private String compareType;

    @Column("invert")
    private Boolean invert;

    @Column("rule_key")
    private String ruleKey;

    @Column("rule_value")
    private String ruleValue;

    @Column("vendor_id")
    private Long vendorId;

    @Column("region_id")
    private String regionId;// 所属域

    @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;
    @IgnoreUpdate
    @Column("creator_id")
    private Long creatorId;
    @Column("owner_id")
    private Long ownerId;
    @Column("mender_id")
    private Long menderId;
    @Column("is_deleted")
    private Boolean deleted;
    //火山云
    @Column("url")
    private String url; //路径
    @Column("listener_id")
    private Long listenerId;  //监听器id
    @Column("listener_uuid")
    private String listenerUuid; //监听器Uuid
    @Column("pool_uuid")
    private String poolUuid; //后端服务器组Uuid
    @IgnoreAll
    private String poolName; //后端服务器组名称
}
