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

import com.alibaba.fastjson.JSONObject;
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.bocloud.ims.entity.resource.CloudServer;
import com.bocloud.ims.entity.resource.DataStore;
import com.bocloud.ims.entity.resource.Network;
import com.bocloud.ims.entity.resource.NetworkCard;
import com.bocloud.ims.entity.resource.ServerAssets;
import com.bocloud.ims.entity.resource.ServerConfig;
import com.bocloud.ims.entity.resource.Switcher;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import org.springframework.format.annotation.DateTimeFormat;

import java.util.Date;
import java.util.List;

/**
 * XenServer服务器实体类
 * <p>
 * 新增XenServer实体类的目的是避免对Server增加很多@IgnoreAll字段。<br>
 * 该实体类仅用来作为查询的包装类。
 * </p>
 * 
 * @author sxp
 * @since Dec 21, 2018
 */
@Table("server")
public class XenServer extends GenericEntity {
    @PK(value = PKStrategy.AUTO)
    private Long id; // ID
    @Column("expired_time")
    @JsonSerialize(using = DateSerializer.class)
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date expiredTime;// 过期时间
    @Column("asset_category")
    private String assetCategory;// 资产类别
    @Column("category")
    private String category; // 类别
    @Column("catalog")
    private String catalog;
    @Column("uuid")
    private String uuid; // UUID
    @Column("manage_ip")
    private String manageIp; // 管理IP
    @Column("rack_id")
    private Long rackId; // 机柜ID
    @Column("hostname")
    private String hostname;
    @Column("service_ip")
    private String serviceIp;
    @Column("tenant_id")
    private Long tenantId;
    @Column("vendor_id")
    private Long vendorId;
    @Column("is_connected")
    private Boolean connected; // 连接状态
    @Column("is_maintained")
    private Boolean maintained; // 维护模式
    @Column("power_state")
    private String powerState; // 电源状态
    @Column("cluster_id")
    private Long clusterId;
    @Column("vdc_id")
    private Long vdcId;
    @Column("resource_id")
    private String resourceId; // 资源ID
    @Column("is_accurated")
    private boolean accurated;
    @Column("os_category")
    private String osCategory;// 系统类别
    @Column("resource_group")
    private String resourceGroup;// 资源分组
    @IgnoreAll
    private String resourceGroupName;
    @IgnoreAll
    private String GroupName; // 所属资源池
    @IgnoreAll
    private String vendorName; // 云供应商名称
    @IgnoreAll
    private String roomname;
    @IgnoreAll
    private String rackname;
    @IgnoreAll
    private String dcname;
    @IgnoreAll
    private Long dcId;
    @IgnoreAll
    private Long roomId;
    @IgnoreAll
    private String clusterName;
    @IgnoreAll
    private String vdcName;
    @IgnoreAll
    private List<String> stores;
    @IgnoreAll
    private List<NetworkCard> netcards;
    @IgnoreAll
    private List<Network> networks;
    @IgnoreAll
    private List<CloudServer> servers;// 虚拟机
    @IgnoreAll
    private List<DataStore> dataStores;
    @IgnoreAll
    private Integer vmNum;// 宿主机（物理机）上的虚拟机数量
    @IgnoreAll
    private Integer templateNum;// 宿主机（物理机）上的模板数量
    @IgnoreAll
    private Integer datastoreNum;// 数据存储数量
    @IgnoreAll
    private ServerConfig config;
    @IgnoreAll
    private ServerAssets assets;
    @IgnoreAll
    private List<Switcher> switchers;
    @Column("guid")
    private String guid;// 全局唯一标识
    @Column("instance")
    private String instance;
    /**
     * 该节点在rackhd里面的id
     */
    @Column("rackhd_node_id")
    private String rackhdNodeId;
    @Column("image_id")
    private Long imageId;
    @IgnoreAll
    private String imageName;
    @IgnoreAll
    private String imageOsName;
    @IgnoreAll
    private JSONObject detail;
    /**
     * 发现任务开始的时间
     */
    @JsonSerialize(using = DateSerializer.class)
    @JsonDeserialize(using = DateDeserializer.class)
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @Column("discover_time")
    private Date discoverTime;
    /**
     * 该节点是否是被rackhd发现的
     */
    @Column("discovered")
    private Boolean discovered;
    @Column("identifier")
    private String identifier;
    @IgnoreAll
    private Integer cpuDistributable;// CPU可分配
    @IgnoreAll
    private Integer memDistributable;// 内存可分配

    // XenServer版本
    @IgnoreAll
    private String version;

    // CPU核数
    @IgnoreAll
    private Integer cpuCore;

    // CPU供应商
    @IgnoreAll
    private String cpuVendor;

    // CPU型号
    @IgnoreAll
    private String cpuMode;

    // CPU频率(单位：MHz)
    @IgnoreAll
    private Long cpuHz;

    // 资源池名称
    @IgnoreAll
    private String resPoolName;

    // 是否为主服务器
    @IgnoreAll
    private Boolean master;

    // 总内存(单位：MB)
    @IgnoreAll
    private Long memoryCapacity;

    // 可用内存(单位：MB)
    @IgnoreAll
    private Long memFree;

    // 总内存(单位：GB)
    @IgnoreAll
    private Double memoryCapacityG;

    // 可用内存(单位：GB)
    @IgnoreAll
    private Double memFreeG;

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

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

    /**
     * @return the expiredTime
     */
    public Date getExpiredTime() {
        return expiredTime;
    }

    /**
     * @param expiredTime the expiredTime to set
     */
    public void setExpiredTime(Date expiredTime) {
        this.expiredTime = expiredTime;
    }

    /**
     * @return the assetCategory
     */
    public String getAssetCategory() {
        return assetCategory;
    }

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

    /**
     * @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 uuid
     */
    public String getUuid() {
        return uuid;
    }

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

    /**
     * @return the manageIp
     */
    public String getManageIp() {
        return manageIp;
    }

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

    /**
     * @return the rackId
     */
    public Long getRackId() {
        return rackId;
    }

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

    /**
     * @return the hostname
     */
    public String getHostname() {
        return hostname;
    }

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

    /**
     * @return the serviceIp
     */
    public String getServiceIp() {
        return serviceIp;
    }

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

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

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

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

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

    /**
     * @return the connected
     */
    public Boolean getConnected() {
        return connected;
    }

    /**
     * @param connected the connected to set
     */
    public void setConnected(Boolean connected) {
        this.connected = connected;
    }

    /**
     * @return the maintained
     */
    public Boolean getMaintained() {
        return maintained;
    }

    /**
     * @param maintained the maintained to set
     */
    public void setMaintained(Boolean maintained) {
        this.maintained = maintained;
    }

    /**
     * @return the powerState
     */
    public String getPowerState() {
        return powerState;
    }

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

    /**
     * @return the clusterId
     */
    public Long getClusterId() {
        return clusterId;
    }

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

    /**
     * @return the vdcId
     */
    public Long getVdcId() {
        return vdcId;
    }

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

    /**
     * @return the resourceId
     */
    public String getResourceId() {
        return resourceId;
    }

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

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

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

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

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

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

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

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

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

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

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

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

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

    /**
     * @return the roomname
     */
    public String getRoomname() {
        return roomname;
    }

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

    /**
     * @return the rackname
     */
    public String getRackname() {
        return rackname;
    }

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

    /**
     * @return the dcname
     */
    public String getDcname() {
        return dcname;
    }

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

    /**
     * @return the dcId
     */
    public Long getDcId() {
        return dcId;
    }

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

    /**
     * @return the roomId
     */
    public Long getRoomId() {
        return roomId;
    }

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

    /**
     * @return the clusterName
     */
    public String getClusterName() {
        return clusterName;
    }

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

    /**
     * @return the vdcName
     */
    public String getVdcName() {
        return vdcName;
    }

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

    /**
     * @return the stores
     */
    public List<String> getStores() {
        return stores;
    }

    /**
     * @param stores the stores to set
     */
    public void setStores(List<String> stores) {
        this.stores = stores;
    }

    /**
     * @return the netcards
     */
    public List<NetworkCard> getNetcards() {
        return netcards;
    }

    /**
     * @param netcards the netcards to set
     */
    public void setNetcards(List<NetworkCard> netcards) {
        this.netcards = netcards;
    }

    /**
     * @return the networks
     */
    public List<Network> getNetworks() {
        return networks;
    }

    /**
     * @param networks the networks to set
     */
    public void setNetworks(List<Network> networks) {
        this.networks = networks;
    }

    /**
     * @return the servers
     */
    public List<CloudServer> getServers() {
        return servers;
    }

    /**
     * @param servers the servers to set
     */
    public void setServers(List<CloudServer> servers) {
        this.servers = servers;
    }

    /**
     * @return the dataStores
     */
    public List<DataStore> getDataStores() {
        return dataStores;
    }

    /**
     * @param dataStores the dataStores to set
     */
    public void setDataStores(List<DataStore> dataStores) {
        this.dataStores = dataStores;
    }

    /**
     * @return the vmNum
     */
    public Integer getVmNum() {
        return vmNum;
    }

    /**
     * @param vmNum the vmNum to set
     */
    public void setVmNum(Integer vmNum) {
        this.vmNum = vmNum;
    }

    /**
     * @return the templateNum
     */
    public Integer getTemplateNum() {
        return templateNum;
    }

    /**
     * @param templateNum the templateNum to set
     */
    public void setTemplateNum(Integer templateNum) {
        this.templateNum = templateNum;
    }

    /**
     * @return the datastoreNum
     */
    public Integer getDatastoreNum() {
        return datastoreNum;
    }

    /**
     * @param datastoreNum the datastoreNum to set
     */
    public void setDatastoreNum(Integer datastoreNum) {
        this.datastoreNum = datastoreNum;
    }

    /**
     * @return the config
     */
    public ServerConfig getConfig() {
        return config;
    }

    /**
     * @param config the config to set
     */
    public void setConfig(ServerConfig config) {
        this.config = config;
    }

    /**
     * @return the assets
     */
    public ServerAssets getAssets() {
        return assets;
    }

    /**
     * @param assets the assets to set
     */
    public void setAssets(ServerAssets assets) {
        this.assets = assets;
    }

    /**
     * @return the switchers
     */
    public List<Switcher> getSwitchers() {
        return switchers;
    }

    /**
     * @param switchers the switchers to set
     */
    public void setSwitchers(List<Switcher> switchers) {
        this.switchers = switchers;
    }

    /**
     * @return the guid
     */
    public String getGuid() {
        return guid;
    }

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

    /**
     * @return the instance
     */
    public String getInstance() {
        return instance;
    }

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

    /**
     * @return the rackhdNodeId
     */
    public String getRackhdNodeId() {
        return rackhdNodeId;
    }

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

    /**
     * @return the imageId
     */
    public Long getImageId() {
        return imageId;
    }

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

    /**
     * @return the imageName
     */
    public String getImageName() {
        return imageName;
    }

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

    /**
     * @return the imageOsName
     */
    public String getImageOsName() {
        return imageOsName;
    }

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

    /**
     * @return the detail
     */
    public JSONObject getDetail() {
        return detail;
    }

    /**
     * @param detail the detail to set
     */
    public void setDetail(JSONObject detail) {
        this.detail = detail;
    }

    /**
     * @return the discoverTime
     */
    public Date getDiscoverTime() {
        return discoverTime;
    }

    /**
     * @param discoverTime the discoverTime to set
     */
    public void setDiscoverTime(Date discoverTime) {
        this.discoverTime = discoverTime;
    }

    /**
     * @return the discovered
     */
    public Boolean getDiscovered() {
        return discovered;
    }

    /**
     * @param discovered the discovered to set
     */
    public void setDiscovered(Boolean discovered) {
        this.discovered = discovered;
    }

    /**
     * @return the identifier
     */
    public String getIdentifier() {
        return identifier;
    }

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

    public Integer getCpuDistributable() {
        return cpuDistributable;
    }

    public void setCpuDistributable(Integer cpuDistributable) {
        this.cpuDistributable = cpuDistributable;
    }

    public Integer getMemDistributable() {
        return memDistributable;
    }

    public void setMemDistributable(Integer memDistributable) {
        this.memDistributable = memDistributable;
    }

    public String getVersion() {
        return version;
    }

    public void setVersion(String version) {
        this.version = version;
    }

    public String getCpuVendor() {
        return cpuVendor;
    }

    public void setCpuVendor(String cpuVendor) {
        this.cpuVendor = cpuVendor;
    }

    public String getCpuMode() {
        return cpuMode;
    }

    public void setCpuMode(String cpuMode) {
        this.cpuMode = cpuMode;
    }

    public String getResPoolName() {
        return resPoolName;
    }

    public void setResPoolName(String resPoolName) {
        this.resPoolName = resPoolName;
    }

    public Boolean getMaster() {
        return master;
    }

    public void setMaster(Boolean master) {
        this.master = master;
    }

    public Integer getCpuCore() {
        return cpuCore;
    }

    public void setCpuCore(Integer cpuCore) {
        this.cpuCore = cpuCore;
    }

    public Long getCpuHz() {
        return cpuHz;
    }

    public void setCpuHz(Long cpuHz) {
        this.cpuHz = cpuHz;
    }

    public Long getMemoryCapacity() {
        return memoryCapacity;
    }

    public void setMemoryCapacity(Long memoryCapacity) {
        this.memoryCapacity = memoryCapacity;
    }

    public Long getMemFree() {
        return memFree;
    }

    public void setMemFree(Long memFree) {
        this.memFree = memFree;
    }

    public Double getMemoryCapacityG() {
        return memoryCapacityG;
    }

    public void setMemoryCapacityG(Double memoryCapacityG) {
        this.memoryCapacityG = memoryCapacityG;
    }

    public Double getMemFreeG() {
        return memFreeG;
    }

    public void setMemFreeG(Double memFreeG) {
        this.memFreeG = memFreeG;
    }

}
