package com.bocloud.ims.entity.resource;

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;

/**
 * 资源实体类
 *
 * @author dongkai
 */
@Table("resource")
public class Resource extends GenericEntity {

	@PK(value = PKStrategy.AUTO)
	private Long id; // ID
	@Column("category")
	private String category; // 类型（大类）
	@Column("catalog")
	private String catalog; // 类型（小类）
	@Column("target")
	private Long target; // 目标机器ID
	@Column("private_ips")
	private String privateIps; // 私有IP
	@Column("vendor_id")
	private Long vendorId;// 云供应商Id
	@Column("username")
	private String username;// 用户名
	@Column("password")
	private String password;// 密码
	@Column("inventory")
	private String inventory;//
	@Column("is_accurated")
	private boolean accurated;
	@Column("is_authed")
	private boolean authed;
	@Column("resource_group")
	private String resourceGroup;
	@Column("os_category")
	private String osCategory; // 操作系统类型
	@Column("tenant_id")
	private Long tenantId;// 租户ID
	@Column("group_id")
	private Long groupId; // 资源池分组
	@Column("group_ids")
	private String groupIds;
	@Column("type_id")
	private Long typeId; // 资源类型
	@Column("project_id")
	private Long projectId;
	@Column("uuid")
	private String uuid;
	@IgnoreAll
	private String resourceGroupName;
	@IgnoreAll
	private String vendorName;
	@IgnoreAll
	private String rootVolumeUuid;
	@IgnoreAll
	private String tenantName;
	@IgnoreAll
	private String ownerName; // 根据ownerId查询
	@IgnoreAll
	private String groupName;
	@IgnoreAll
	private String groupsName;
	@Column("region_id")
	private String regionId;

	public Resource() {
		super();
	}

	public Resource(String category, String catalog, Long target, String privateIps, String osCategory, Long vendorId) {
		this.category = category;
		this.catalog = catalog;
		this.target = target;
		this.privateIps = privateIps;
		this.osCategory = osCategory;
		this.vendorId = vendorId;
	}

	public void preSave(String name, String status, Long userId, Long tenantId) {
		this.setName(name);
		this.setStatus(status);
		this.setCreatorId(userId);
		this.setMenderId(userId);
		this.setOwnerId(userId);
		this.setTenantId(tenantId);
	}

	/**
	 * @return the id
	 */
	public Long getId() {
		return id;
	}

	/**
	 * @param id
	 *            the id to set
	 */
	public void setId(Long id) {
		this.id = id;
	}

	/**
	 * @return the category
	 */
	public String getCategory() {
		return category;
	}

	/**
	 * @param category
	 *            the category to set
	 */
	public void setCategory(String category) {
		this.category = category;
	}

	/**
	 * @return the catalog
	 */
	public String getCatalog() {
		return catalog;
	}

	/**
	 * @param catalog
	 *            the catalog to set
	 */
	public void setCatalog(String catalog) {
		this.catalog = catalog;
	}

	/**
	 * @return the target
	 */
	public Long getTarget() {
		return target;
	}

	/**
	 * @param target
	 *            the target to set
	 */
	public void setTarget(Long target) {
		this.target = target;
	}

	/**
	 * @return the privateIps
	 */
	public String getPrivateIps() {
		return privateIps;
	}

	/**
	 * @param privateIps
	 *            the privateIps to set
	 */
	public void setPrivateIps(String privateIps) {
		this.privateIps = privateIps;
	}

	/**
	 * @return the vendorId
	 */
	public Long getVendorId() {
		return vendorId;
	}

	/**
	 * @param vendorId
	 *            the vendorId to set
	 */
	public void setVendorId(Long vendorId) {
		this.vendorId = vendorId;
	}

	/**
	 * @return the username
	 */
	public String getUsername() {
		return username;
	}

	/**
	 * @param username
	 *            the username to set
	 */
	public void setUsername(String username) {
		this.username = username;
	}

	/**
	 * @return the password
	 */
	public String getPassword() {
		return password;
	}

	/**
	 * @param password
	 *            the password to set
	 */
	public void setPassword(String password) {
		this.password = password;
	}

	/**
	 * @return the inventory
	 */
	public String getInventory() {
		return inventory;
	}

	/**
	 * @param inventory
	 *            the inventory to set
	 */
	public void setInventory(String inventory) {
		this.inventory = inventory;
	}

	/**
	 * @return the accurated
	 */
	public boolean isAccurated() {
		return accurated;
	}

	/**
	 * @param accurated
	 *            the accurated to set
	 */
	public void setAccurated(boolean accurated) {
		this.accurated = accurated;
	}

	/**
	 * @return the authed
	 */
	public boolean isAuthed() {
		return authed;
	}

	/**
	 * @param authed
	 *            the authed to set
	 */
	public void setAuthed(boolean authed) {
		this.authed = authed;
	}

	/**
	 * @return the resourceGroup
	 */
	public String getResourceGroup() {
		return resourceGroup;
	}

	/**
	 * @param resourceGroup
	 *            the resourceGroup to set
	 */
	public void setResourceGroup(String resourceGroup) {
		this.resourceGroup = resourceGroup;
	}

	/**
	 * @return the osCategory
	 */
	public String getOsCategory() {
		return osCategory;
	}

	/**
	 * @param osCategory
	 *            the osCategory to set
	 */
	public void setOsCategory(String osCategory) {
		this.osCategory = osCategory;
	}

	/**
	 * @return the resourceGroupName
	 */
	public String getResourceGroupName() {
		return resourceGroupName;
	}

	/**
	 * @param resourceGroupName
	 *            the resourceGroupName to set
	 */
	public void setResourceGroupName(String resourceGroupName) {
		this.resourceGroupName = resourceGroupName;
	}

	/**
	 * @return the vendorName
	 */
	public String getVendorName() {
		return vendorName;
	}

	/**
	 * @param vendorName
	 *            the vendorName to set
	 */
	public void setVendorName(String vendorName) {
		this.vendorName = vendorName;
	}

	/**
	 * @return the rootVolumeUuid
	 */
	public String getRootVolumeUuid() {
		return rootVolumeUuid;
	}

	/**
	 * @param rootVolumeUuid
	 *            the rootVolumeUuid to set
	 */
	public void setRootVolumeUuid(String rootVolumeUuid) {
		this.rootVolumeUuid = rootVolumeUuid;
	}

	/**
	 * @return the tenantId
	 */
	public Long getTenantId() {
		return tenantId;
	}

	/**
	 * @param tenantId
	 *            the tenantId to set
	 */
	public void setTenantId(Long tenantId) {
		this.tenantId = tenantId;
	}

	/**
	 * @return the tenantName
	 */
	public String getTenantName() {
		return tenantName;
	}

	/**
	 * @param tenantName
	 *            the tenantName to set
	 */
	public void setTenantName(String tenantName) {
		this.tenantName = tenantName;
	}

	public Long getGroupId() {
		return groupId;
	}

	public void setGroupId(Long groupId) {
		this.groupId = groupId;
	}

	public String getGroupIds() {
		return groupIds;
	}

	public void setGroupIds(String groupIds) {
		this.groupIds = groupIds;
	}

	/**
	 * @return the groupName
	 */
	public String getGroupName() {
		return groupName;
	}

	/**
	 * @param groupName
	 *            the groupName to set
	 */
	public void setGroupName(String groupName) {
		this.groupName = groupName;
	}

	public String getRegionId() {
		return regionId;
	}

	public void setRegionId(String regionId) {
		this.regionId = regionId;
	}

	public void preSave(String name, String status, Long userId, Long tenantId, Long projectId) {
		this.setName(name);
		this.setStatus(status);
		this.setCreatorId(userId);
		this.setMenderId(userId);
		this.setOwnerId(userId);
		this.setTenantId(tenantId);
		this.setProjectId(projectId);
	}

	public Long getProjectId() {
		return projectId;
	}

	public void setProjectId(Long projectId) {
		this.projectId = projectId;
	}

	public String getOwnerName() {
		return ownerName;
	}

	public void setOwnerName(String ownerName) {
		this.ownerName = ownerName;
	}

	public Long getTypeId() {
		return typeId;
	}

	public void setTypeId(Long typeId) {
		this.typeId = typeId;
	}

	public String getGroupsName() {
		return groupsName;
	}

	public void setGroupsName(String groupsName) {
		this.groupsName = groupsName;
	}

	public String getUuid() {
		return uuid;
	}

	public void setUuid(String uuid) {
		this.uuid = uuid;
	}
}
