package com.bocloud.ims.entity.resource;

import com.bocloud.common.utils.DateDeserializer;
import com.bocloud.common.utils.DateSerializer;
import com.bocloud.entity.annotations.Column;
import com.bocloud.entity.annotations.IgnoreUpdate;
import com.bocloud.entity.annotations.PK;
import com.bocloud.entity.annotations.Table;
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("cidr_block")
public class CidrBlock extends Generic {
	@PK(value = PKStrategy.AUTO)
	private Long id;
	@Column("uuid")
	private String uuid;
	@Column("type")
	private String type;
	@Column("target_id")
	private String targetId;
	@Column("cidr_block")
	private String cidrBlock;
	@Column("cidr_block_state")
	private String cidrBlockState;
	@Column("ipv6_pool")
	private String ipv6Pool;
	@Column("network_border_group")
	private String networkBorderGroup;
	@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;
}