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")
public class Route extends Generic {
	@PK(value = PKStrategy.AUTO)
	private Long id;
	@Column("route_table_id")
	private Long routeTableId;
	@Column("route_table_uuid")
	private String routeTableUuid;
	/**
	 * 目标地址类型.
	 */
	@Column("destination_type")
	private String destinationType;
	/**
	 * 目标地址.
	 */
	@Column("destination")
	private String destination;
	/**
	 * 目标类型.
	 */
	@Column("target_type")
	private String targetType;
	/**
	 * 目标uuid.
	 */
	@Column("target_uuid")
	private String targetUuid;
	/**
	 * 来源.
	 */
	@Column("origin")
	private String origin;
	@Column("state")
	private String state;
	@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;
	@Column("uuid")
	private String uuid;
	@Column("name")
	private String name;
	@Column("type")
	private String type;

	/**
	 * 关系uuid
	 */
	@Column("relation_uuid")
	private String relationUuid;
}