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;
import java.util.List;

/**
 * nsx防火墙
 * 
 * @author wangyu
 * @version 1.0
 * @since 2020年2月29日
 *
 */
@NoArgsConstructor
@AllArgsConstructor
@Table("nsx_firewall_section")
public class NsxFirewallSection extends GenericEntity {

	// id
	@Setter
	@Getter
	@PK(PKStrategy.AUTO)
	private Long id;
	// 防火墙id
	@Setter
	@Getter
	@Column("firewall_id")
	private String firewallId;
	// 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("applied_tos")
	private String appliedTos;
	// 是否为默认
	@Setter
	@Getter
	@Column("is_default")
	private Boolean isDefault;
	// 规则总数
	@Setter
	@Getter
	@Column("rule_count")
	private Long ruleCount;
	// 防火墙类型
	@Setter
	@Getter
	@Column("section_type")
	private String sectionType;
	// teful
	@Setter
	@Getter
	@Column("teful")
	private Boolean teful;
	// 是否自动插入
	@Setter
	@Getter
	@Column("autoplumbed")
	private Boolean autoplumbed;
	// 防火墙锁定/解锁
	@Setter
	@Getter
	@Column("comments")
	private String comments;
	// 防火墙所生效对象
	@Setter
	@Getter
	@Column("enforced_on")
	private String enforcedOn;
	// 锁定用户
	@Setter
	@Getter
	@Column("lock_modified_by")
	private String lockModifiedBy;
	// 锁定时间
	@Setter
	@Getter
	@JsonSerialize(using = DateSerializer.class)
	@JsonDeserialize(using = DateDeserializer.class)
	@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
	@Column("lock_modified_time")
	private Date lockModifiedTime;
	// 是否已锁定
	@Setter
	@Getter
	@Column("locked")
	private Boolean locked;
	// 优先级
	@Setter
	@Getter
	@Column("priority")
	private Long priority;
	// tcp配置
	@Setter
	@Getter
	@Column("tcp_strict")
	private Boolean tcpStrict;
	// 规则状态
	@Setter
	@Getter
	@Column("stateful")
	private Boolean stateful;
	// 云平台id
	@Setter
	@Getter
	@Column("vendor_id")
	private Long vendorId;
	// 数据库实例id
	@Setter
	@Getter
	@Column("target")
	private Long target;
	// 数据库类型
	@Setter
	@Getter
	@Column("category")
	private String category;
	// 云平台名称
	@Setter
	@Getter
	@IgnoreAll
	private String vendorName;
	// 前一个防火墙section
	@Setter
	@Getter
	@IgnoreAll
	private String createBefore;
	// 防火墙规则
	@Setter
	@Getter
	@IgnoreAll
	private List<NsxFirewallRule> rules;
}
