package com.bocloud.ims.entity.resource.nsx;

import com.bocloud.common.utils.DateDeserializer;
import com.bocloud.common.utils.DateSerializer;
import com.bocloud.entity.annotations.Column;
import com.bocloud.entity.annotations.IgnoreAll;
import com.bocloud.entity.annotations.PK;
import com.bocloud.entity.annotations.Table;
import com.bocloud.entity.bean.GenericEntity;
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.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import org.springframework.format.annotation.DateTimeFormat;

import java.util.Date;

/**
 * nsx nat转换
 * 
 * @author wangyu
 * @version 1.0
 * @since 2020年3月17日
 *
 */
@NoArgsConstructor
@AllArgsConstructor
@Table("nsx_nat_rule")
public class NsxNatRule extends GenericEntity {

	// id
	@Setter
	@Getter
	@PK(PKStrategy.AUTO)
	private Long id;
	@Setter
	@Getter
	@Column("rule_id")
	private String natId;
	// References related to this resource
	@Setter
	@Getter
	@Column("links")
	private String links;
	// Schema for this resource
	@Setter
	@Getter
	@Column("resource_schema")
	private String resourceSchema;
	// Link to this resource
	@Setter
	@Getter
	@Column("self")
	private String self;
	// Generation of this resource config
	@Setter
	@Getter
	@Column("revision")
	private Long revision;
	// 创建时间
	@Setter
	@Getter
	@JsonSerialize(using = DateSerializer.class)
	@JsonDeserialize(using = DateDeserializer.class)
	@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
	@Column("create_time")
	private Date createTime;
	// 创建用户
	@Setter
	@Getter
	@Column("create_user")
	private String createUser;
	// 最后一次修改时间
	@Setter
	@Getter
	@JsonSerialize(using = DateSerializer.class)
	@JsonDeserialize(using = DateDeserializer.class)
	@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
	@Column("last_modified_time")
	private Date lastModifiedTime;
	// 最后一次修改用户
	@Setter
	@Getter
	@Column("last_modified_user")
	private String lastModifiedUser;
	// Indicates protection status of this resource
	@Setter
	@Getter
	@Column("protection")
	private String protection;
	// 是否为系统资源
	@Setter
	@Getter
	@Column("system_owned")
	private Boolean systemOwned;
	// 资源类型
	@Setter
	@Getter
	@Column("resource_type")
	private String resourceType;
	// 资源标签
	@Setter
	@Getter
	@Column("tags")
	private String tags;
	// 操作
	@Setter
	@Getter
	@Column("action")
	private String action;
	// 应用对象
	@Setter
	@Getter
	@Column("applied_tos")
	private String appliedTos;
	// 状态
	@Setter
	@Getter
	@Column("enabled")
	private Boolean enabled;
	// 防火墙匹配
	@Setter
	@Getter
	@Column("firewall_match")
	private String firewallMatch;
	// 内部nat id
	@Setter
	@Getter
	@Column("internal_rule_id")
	private String internalRuleId;
	// 日志记录
	@Setter
	@Getter
	@Column("logging")
	private Boolean logging;
	// 路由器
	@Setter
	@Getter
	@Column("logical_router_id")
	private String logicalRouterId;
	// 目标ip
	@Setter
	@Getter
	@Column("match_destination_network")
	private String matchDestinationNetwork;
	// 匹配的服务
	@Setter
	@Getter
	@Column("match_service")
	private String matchService;
	// 源IP
	@Setter
	@Getter
	@Column("match_source_network")
	private String matchSourceNetwork;
	// 防火墙绕过
	@Setter
	@Getter
	@Column("nat_pass")
	private Boolean natPass;
	// 优先级
	@Setter
	@Getter
	@Column("rule_priority")
	private Long rulePriority;
	// 转换的网络
	@Setter
	@Getter
	@Column("translated_network")
	private String translatedNetwork;
	// 转换的端口
	@Setter
	@Getter
	@Column("translated_ports")
	private String translatedPorts;
	// 路由器id
	@Setter
	@Getter
	@Column("router_id")
	private Long routerId;
	// 云平台id
	@Setter
	@Getter
	@Column("vendor_id")
	private Long vendorId;
	// 路由名称
	@Setter
	@Getter
	@IgnoreAll
	private String routerName;
	// 云平台名称
	@Setter
	@Getter
	@IgnoreAll
	private String vendorName;
}
