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

import com.bocloud.entity.annotations.Column;
import com.bocloud.entity.annotations.Table;

import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors;

@Table("hmd_server")
public class HmdServer extends HmdGenericEntity {
    @Column("vendor_id")
    private Long vendorId; // 所属平台id，对应cloud_vendor表的id字段
    @Column("name")
    private String name; // 名称
    @Column("status")
    private String status; // 状态
    @Column("uuid")
    private String uuid; // 唯一标识
    @Column("reference_code")
    private String referenceCode; // 参考码
    @Column("system_firmware")
    private String systemFirmware; // 防火墙
    @Column("activated_level")
    private String activatedLevel; // 活动级别
    @Column("machine_type")
    private String machineType; // 机器类型
    @Column("model")
    private String model; // 型号
    @Column("serial_number")
    private String serialNumber; // 序列号
    @Column("maximum_partitions")
    private Integer maximumPartitions; // 最大分区数
    @Column("physical_system_attention_led_state")
    private String physicalSystemAttentionLedState; // 提醒指示灯
    @Column("primary_ip_address")
    private String primaryIpAddress; // IP地址
    @Column("hostname")
    private String hostname; // 主机名
    @Column("service_processor_version")
    private String serviceProcessorVersion; // 服务处理器版本
    @Column("manufacturing_default_configuration_enabled")
    private String manufacturingDefaultConfigurationEnabled; // 出厂缺省配置
    @Column("current_available_system_processor_units")
    private Double currentAvailableSystemProcessorUnits; // 可用的CPU
    @Column("configurable_system_processor_units")
    private Double configurableSystemProcessorUnits; // 可配置的CPU
    @Column("installed_system_processor_units")
    private Double installedSystemProcessorUnits; // 已安装CPU
    @Column("supported_partition_processor_compatibility_modes")
    private String supportedPartitionProcessorCompatibilityModes; // 支持的处理器兼容模式
    @Column("current_available_system_memory")
    private Integer currentAvailableSystemMemory; // 可用的内存
    @Column("memory_used_by_hypervisor")
    private Integer memoryUsedByHypervisor; // 保留的内存
    @Column("configurable_system_memory")
    private Integer configurableSystemMemory; // 可配置的内存
    @Column("installed_system_memory")
    private Integer installedSystemMemory; // 已安装内存
    @Column("memory_region_size")
    private Integer memoryRegionSize; // 内存区域大小
    @Column("huge_page_size")
    private Integer hugePageSize; // 页面大小
    @Column("current_available_huge_pages")
    private Integer currentAvailableHugePages; // 可用的超大页面内存量(页数)
    @Column("configurable_huge_pages")
    private Integer configurableHugePages; // 可配置的超大页面内存量(页数)
    @Column("maximum_huge_pages")
    private Integer maximumHugePages; // 最大超大页面内存量(页数)
    @Column("requested_huge_pages")
    private Integer requestedHugePages; // 请求的超大页面内存量(页数)
    @Column("total_barrier_synchronization_register_arrays")
    private Integer totalBarrierSynchronizationRegisterArrays; // 屏障同步寄存器阵列数
    @Column("barrier_synchronization_register_array_size")
    private Integer barrierSynchronizationRegisterArraySize; // 每个屏障同步寄存器阵列的字节数
    @Column("available_barrier_synchronization_register_arrays")
    private Integer availableBarrierSynchronizationRegisterArrays; // 可用的屏障同步寄存器阵列数
    @Column("poweroff_all_lpar_shutdown")
    private Boolean poweroffAllLparShutdown; // 是否在所有逻辑分区断电后对系统断电
    @Column("poweron_lpar_start_policy")
    private String poweronLparStartPolicy; // 分区启动策略当前的值
    @Column("pending_poweron_lpar_start_policy")
    private String pendingPoweronLparStartPolicy; // 分区启动策略下一个值
    @Column("current_poweron_side")
    private String currentPoweronSide; // 供电端当前的值
    @Column("pending_poweron_side")
    private String pendingPoweronSide; // 供电端下一个值
    @Column("poweron_speed")
    private String poweronSpeed; // 供电速度
    @Column("poweron_speed_override")
    private String poweronSpeedOverride; // 供电速度覆盖
    @Column("current_system_keylock")
    private String currentSystemKeylock; // 键锁位置当前的值
    @Column("pending_system_keylock")
    private String pendingSystemKeylock; // 键锁位置下一个值
    @Column("current_boot_mode")
    private String currentBootMode; // AIX/Linux引导方式当前的值
    @Column("pending_boot_mode")
    private String pendingBootMode; // AIX/Linux引导方式下一个值
    @Column("poweron_source")
    private String poweronSource; // 供电源

    private List<HmdServerIoAdapter> ioAdapters = new ArrayList<>();
    private List<HmdServerSharedProcessorPool> sharedProcessorPools = new ArrayList<>();
    private List<HmdServerCapability> capabilities = new ArrayList<>();
    private List<HmdServerVirtualBridge> virtualBridges = new ArrayList<>();
    private List<HmdServerVirtualNetwork> virtualNetworks = new ArrayList<>();
    private List<HmdServerVirtualSwitch> virtualSwitches = new ArrayList<>();
    private List<HmdServerHea> heas = new ArrayList<>();
    private List<HmdPartition> lpars = new ArrayList<>();
    private List<HmdPartition> vioses = new ArrayList<>();

    public Long getVendorId() {
        return vendorId;
    }

    public void setVendorId(Long vendorId) {
        this.vendorId = vendorId;
    }

    public String getUuid() {
        return uuid;
    }

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

    public String getReferenceCode() {
        return referenceCode;
    }

    public void setReferenceCode(String referenceCode) {
        this.referenceCode = referenceCode;
    }

    public String getSystemFirmware() {
        return systemFirmware;
    }

    public void setSystemFirmware(String systemFirmware) {
        this.systemFirmware = systemFirmware;
    }

    public String getActivatedLevel() {
        return activatedLevel;
    }

    public void setActivatedLevel(String activatedLevel) {
        this.activatedLevel = activatedLevel;
    }

    public String getMachineType() {
        return machineType;
    }

    public void setMachineType(String machineType) {
        this.machineType = machineType;
    }

    public String getModel() {
        return model;
    }

    public void setModel(String model) {
        this.model = model;
    }

    public String getSerialNumber() {
        return serialNumber;
    }

    public void setSerialNumber(String serialNumber) {
        this.serialNumber = serialNumber;
    }

    public Integer getMaximumPartitions() {
        return maximumPartitions;
    }

    public void setMaximumPartitions(Integer maximumPartitions) {
        this.maximumPartitions = maximumPartitions;
    }

    public String getPhysicalSystemAttentionLedState() {
        return physicalSystemAttentionLedState;
    }

    public void setPhysicalSystemAttentionLedState(String physicalSystemAttentionLedState) {
        this.physicalSystemAttentionLedState = physicalSystemAttentionLedState;
    }

    public String getPrimaryIpAddress() {
        return primaryIpAddress;
    }

    public void setPrimaryIpAddress(String primaryIpAddress) {
        this.primaryIpAddress = primaryIpAddress;
    }

    public String getHostname() {
        return hostname;
    }

    public void setHostname(String hostname) {
        this.hostname = hostname;
    }

    public String getServiceProcessorVersion() {
        return serviceProcessorVersion;
    }

    public void setServiceProcessorVersion(String serviceProcessorVersion) {
        this.serviceProcessorVersion = serviceProcessorVersion;
    }

    public String getManufacturingDefaultConfigurationEnabled() {
        return manufacturingDefaultConfigurationEnabled;
    }

    public void setManufacturingDefaultConfigurationEnabled(String manufacturingDefaultConfigurationEnabled) {
        this.manufacturingDefaultConfigurationEnabled = manufacturingDefaultConfigurationEnabled;
    }

    public Double getCurrentAvailableSystemProcessorUnits() {
        return currentAvailableSystemProcessorUnits;
    }

    public void setCurrentAvailableSystemProcessorUnits(Double currentAvailableSystemProcessorUnits) {
        this.currentAvailableSystemProcessorUnits = currentAvailableSystemProcessorUnits;
    }

    public Double getConfigurableSystemProcessorUnits() {
        return configurableSystemProcessorUnits;
    }

    public void setConfigurableSystemProcessorUnits(Double configurableSystemProcessorUnits) {
        this.configurableSystemProcessorUnits = configurableSystemProcessorUnits;
    }

    public Double getInstalledSystemProcessorUnits() {
        return installedSystemProcessorUnits;
    }

    public void setInstalledSystemProcessorUnits(Double installedSystemProcessorUnits) {
        this.installedSystemProcessorUnits = installedSystemProcessorUnits;
    }

    public String getSupportedPartitionProcessorCompatibilityModes() {
        return supportedPartitionProcessorCompatibilityModes;
    }

    public void setSupportedPartitionProcessorCompatibilityModes(String supportedPartitionProcessorCompatibilityModes) {
        this.supportedPartitionProcessorCompatibilityModes = supportedPartitionProcessorCompatibilityModes;
    }

    public Integer getCurrentAvailableSystemMemory() {
        return currentAvailableSystemMemory;
    }

    public void setCurrentAvailableSystemMemory(Integer currentAvailableSystemMemory) {
        this.currentAvailableSystemMemory = currentAvailableSystemMemory;
    }

    public Integer getMemoryUsedByHypervisor() {
        return memoryUsedByHypervisor;
    }

    public void setMemoryUsedByHypervisor(Integer memoryUsedByHypervisor) {
        this.memoryUsedByHypervisor = memoryUsedByHypervisor;
    }

    public Integer getConfigurableSystemMemory() {
        return configurableSystemMemory;
    }

    public void setConfigurableSystemMemory(Integer configurableSystemMemory) {
        this.configurableSystemMemory = configurableSystemMemory;
    }

    public Integer getInstalledSystemMemory() {
        return installedSystemMemory;
    }

    public void setInstalledSystemMemory(Integer installedSystemMemory) {
        this.installedSystemMemory = installedSystemMemory;
    }

    public Integer getMemoryRegionSize() {
        return memoryRegionSize;
    }

    public void setMemoryRegionSize(Integer memoryRegionSize) {
        this.memoryRegionSize = memoryRegionSize;
    }

    public Integer getHugePageSize() {
        return hugePageSize;
    }

    public void setHugePageSize(Integer hugePageSize) {
        this.hugePageSize = hugePageSize;
    }

    public Integer getCurrentAvailableHugePages() {
        return currentAvailableHugePages;
    }

    public void setCurrentAvailableHugePages(Integer currentAvailableHugePages) {
        this.currentAvailableHugePages = currentAvailableHugePages;
    }

    public Integer getConfigurableHugePages() {
        return configurableHugePages;
    }

    public void setConfigurableHugePages(Integer configurableHugePages) {
        this.configurableHugePages = configurableHugePages;
    }

    public Integer getMaximumHugePages() {
        return maximumHugePages;
    }

    public void setMaximumHugePages(Integer maximumHugePages) {
        this.maximumHugePages = maximumHugePages;
    }

    public Integer getRequestedHugePages() {
        return requestedHugePages;
    }

    public void setRequestedHugePages(Integer requestedHugePages) {
        this.requestedHugePages = requestedHugePages;
    }

    public Integer getTotalBarrierSynchronizationRegisterArrays() {
        return totalBarrierSynchronizationRegisterArrays;
    }

    public void setTotalBarrierSynchronizationRegisterArrays(Integer totalBarrierSynchronizationRegisterArrays) {
        this.totalBarrierSynchronizationRegisterArrays = totalBarrierSynchronizationRegisterArrays;
    }

    public Integer getBarrierSynchronizationRegisterArraySize() {
        return barrierSynchronizationRegisterArraySize;
    }

    public void setBarrierSynchronizationRegisterArraySize(Integer barrierSynchronizationRegisterArraySize) {
        this.barrierSynchronizationRegisterArraySize = barrierSynchronizationRegisterArraySize;
    }

    public Integer getAvailableBarrierSynchronizationRegisterArrays() {
        return availableBarrierSynchronizationRegisterArrays;
    }

    public void setAvailableBarrierSynchronizationRegisterArrays(Integer availableBarrierSynchronizationRegisterArrays) {
        this.availableBarrierSynchronizationRegisterArrays = availableBarrierSynchronizationRegisterArrays;
    }

    public Boolean getPoweroffAllLparShutdown() {
        return poweroffAllLparShutdown;
    }

    public void setPoweroffAllLparShutdown(Boolean poweroffAllLparShutdown) {
        this.poweroffAllLparShutdown = poweroffAllLparShutdown;
    }

    public String getPoweronLparStartPolicy() {
        return poweronLparStartPolicy;
    }

    public void setPoweronLparStartPolicy(String poweronLparStartPolicy) {
        this.poweronLparStartPolicy = poweronLparStartPolicy;
    }

    public String getPendingPoweronLparStartPolicy() {
        return pendingPoweronLparStartPolicy;
    }

    public void setPendingPoweronLparStartPolicy(String pendingPoweronLparStartPolicy) {
        this.pendingPoweronLparStartPolicy = pendingPoweronLparStartPolicy;
    }

    public String getCurrentPoweronSide() {
        return currentPoweronSide;
    }

    public void setCurrentPoweronSide(String currentPoweronSide) {
        this.currentPoweronSide = currentPoweronSide;
    }

    public String getPendingPoweronSide() {
        return pendingPoweronSide;
    }

    public void setPendingPoweronSide(String pendingPoweronSide) {
        this.pendingPoweronSide = pendingPoweronSide;
    }

    public String getPoweronSpeed() {
        return poweronSpeed;
    }

    public void setPoweronSpeed(String poweronSpeed) {
        this.poweronSpeed = poweronSpeed;
    }

    public String getPoweronSpeedOverride() {
        return poweronSpeedOverride;
    }

    public void setPoweronSpeedOverride(String poweronSpeedOverride) {
        this.poweronSpeedOverride = poweronSpeedOverride;
    }

    public String getCurrentSystemKeylock() {
        return currentSystemKeylock;
    }

    public void setCurrentSystemKeylock(String currentSystemKeylock) {
        this.currentSystemKeylock = currentSystemKeylock;
    }

    public String getPendingSystemKeylock() {
        return pendingSystemKeylock;
    }

    public void setPendingSystemKeylock(String pendingSystemKeylock) {
        this.pendingSystemKeylock = pendingSystemKeylock;
    }

    public String getCurrentBootMode() {
        return currentBootMode;
    }

    public void setCurrentBootMode(String currentBootMode) {
        this.currentBootMode = currentBootMode;
    }

    public String getPendingBootMode() {
        return pendingBootMode;
    }

    public void setPendingBootMode(String pendingBootMode) {
        this.pendingBootMode = pendingBootMode;
    }

    public String getPoweronSource() {
        return poweronSource;
    }

    public void setPoweronSource(String poweronSource) {
        this.poweronSource = poweronSource;
    }

    public List<HmdServerIoAdapter> getIoAdapters() {
        return ioAdapters;
    }

    public void setIoAdapters(List<HmdServerIoAdapter> ioAdapters) {
        this.ioAdapters = ioAdapters;
    }

    public List<HmdServerSharedProcessorPool> getSharedProcessorPools() {
        return sharedProcessorPools;
    }

    public void setSharedProcessorPools(List<HmdServerSharedProcessorPool> sharedProcessorPools) {
        this.sharedProcessorPools = sharedProcessorPools;
    }

    public void setSharedProcessorPoolUrls(List<String> urls) {
        this.sharedProcessorPools = urls.stream().map(url -> {
            HmdServerSharedProcessorPool pool = new HmdServerSharedProcessorPool();
            pool.setUrl(url);
            return pool;
        }).collect(Collectors.toList());
    }

    public List<HmdServerCapability> getCapabilities() {
        return capabilities;
    }

    public void setCapabilities(List<HmdServerCapability> capabilities) {
        this.capabilities = capabilities;
    }

    public List<HmdServerVirtualBridge> getVirtualBridges() {
        return virtualBridges;
    }

    public void setVirtualBridges(List<HmdServerVirtualBridge> virtualBridges) {
        this.virtualBridges = virtualBridges;
    }

    public void setVirtualBridgeUrls(List<String> urls) {
        this.virtualBridges = urls.stream().map(url -> {
            HmdServerVirtualBridge bridge = new HmdServerVirtualBridge();
            bridge.setUrl(url);
            return bridge;
        }).collect(Collectors.toList());
    }

    public List<HmdServerVirtualNetwork> getVirtualNetworks() {
        return virtualNetworks;
    }

    public void setVirtualNetworks(List<HmdServerVirtualNetwork> virtualNetworks) {
        this.virtualNetworks = virtualNetworks;
    }

    public void setVirtualNetworkUrls(List<String> urls) {
        this.virtualNetworks = urls.stream().map(url -> {
            HmdServerVirtualNetwork network = new HmdServerVirtualNetwork();
            network.setUrl(url);
            return network;
        }).collect(Collectors.toList());
    }

    public List<HmdServerVirtualSwitch> getVirtualSwitches() {
        return virtualSwitches;
    }

    public void setVirtualSwitches(List<HmdServerVirtualSwitch> virtualSwitches) {
        this.virtualSwitches = virtualSwitches;
    }

    public void setVirtualSwitcheUrls(List<String> urls) {
        this.virtualSwitches = urls.stream().map(url -> {
            HmdServerVirtualSwitch virtualSwitch = new HmdServerVirtualSwitch();
            virtualSwitch.setUrl(url);
            return virtualSwitch;
        }).collect(Collectors.toList());
    }

    public List<HmdServerHea> getHeas() {
        return heas;
    }

    public void setHeas(List<HmdServerHea> heas) {
        this.heas = heas;
    }

    public void setHeaUrls(List<String> urls) {
        this.heas = urls.stream().map(url -> {
            HmdServerHea hea = new HmdServerHea();
            hea.setUrl(url);
            return hea;
        }).collect(Collectors.toList());
    }

    public List<HmdPartition> getLpars() {
        return lpars;
    }

    public void setLpars(List<HmdPartition> lpars) {
        this.lpars = lpars;
    }

    public void setLparUrls(List<String> urls) {
        this.lpars = urls.stream().map(url -> {
            HmdPartition lpar = new HmdPartition();
            lpar.setUrl(url);
            return lpar;
        }).collect(Collectors.toList());
    }

    public List<HmdPartition> getVioses() {
        return vioses;
    }

    public void setVioses(List<HmdPartition> vioses) {
        this.vioses = vioses;
    }

    public void setVioseUrls(List<String> urls) {
        this.vioses = urls.stream().map(url -> {
            HmdPartition vios = new HmdPartition();
            vios.setUrl(url);
            return vios;
        }).collect(Collectors.toList());
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getStatus() {
        return status;
    }

    public void setStatus(String status) {
        this.status = status;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }
        if (o == null || getClass() != o.getClass()) {
            return false;
        }
        if (!super.equals(o)) {
            return false;
        }
        HmdServer hmdServer = (HmdServer) o;
        return Objects.equals(uuid, hmdServer.uuid);
    }

    @Override
    public int hashCode() {
        return Objects.hash(super.hashCode(), uuid);
    }
}

