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("route_table_association")
public class RouteTableAssociation extends Generic {
    @PK(value = PKStrategy.AUTO)
    private Long id;
    /**
     * 是否主路由表.
     */
    @Column("main")
    private Boolean main;
    @Column("uuid")
    private String uuid;
    @Column("route_table_id")
    private Long routeTableId;
    @Column("route_table_uuid")
    private String routeTableUuid;
    @IgnoreAll
    private Long subnetId;
    @Column("subnet_uuid")
    private String subnetUuid;
    @IgnoreAll
    private Long gatewayId;
    @Column("gateway_uuid")
    private String gatewayUuid;
    @Column("association_state")
    private String associationState;
    @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;
}