package com.bocloud.cmp.model.hmc;

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

public class HmdServerSharedProcessorPoolModel extends HmdGenericModel {
    private String name; // 共享存储池的名称
    private Integer poolId; // 共享处理器池id
    private Double currentReservedProcessingUnits; // 当前保留的处理单元数
    private Double pendingReservedProcessingUnits; // 下一个保留的处理单元数
    private Double availableProcessorUnits; // 可用的处理单元数
    private Double maximumProcessorUnits; // 最大处理单元数
    private HmdServerModel server; // 所属服务器
    private List<HmdPartitionModel> assignedPartitions = new ArrayList<>();

    public String getName() {
        return name;
    }

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

    public Integer getPoolId() {
        return poolId;
    }

    public void setPoolId(Integer poolId) {
        this.poolId = poolId;
    }

    public Double getCurrentReservedProcessingUnits() {
        return currentReservedProcessingUnits;
    }

    public void setCurrentReservedProcessingUnits(Double currentReservedProcessingUnits) {
        this.currentReservedProcessingUnits = currentReservedProcessingUnits;
    }

    public Double getPendingReservedProcessingUnits() {
        return pendingReservedProcessingUnits;
    }

    public void setPendingReservedProcessingUnits(Double pendingReservedProcessingUnits) {
        this.pendingReservedProcessingUnits = pendingReservedProcessingUnits;
    }

    public Double getAvailableProcessorUnits() {
        return availableProcessorUnits;
    }

    public void setAvailableProcessorUnits(Double availableProcessorUnits) {
        this.availableProcessorUnits = availableProcessorUnits;
    }

    public Double getMaximumProcessorUnits() {
        return maximumProcessorUnits;
    }

    public void setMaximumProcessorUnits(Double maximumProcessorUnits) {
        this.maximumProcessorUnits = maximumProcessorUnits;
    }

    public List<HmdPartitionModel> getAssignedPartitions() {
        return assignedPartitions;
    }

    public void setAssignedPartitions(List<HmdPartitionModel> assignedPartitions) {
        this.assignedPartitions = assignedPartitions;
    }

    public void setAssignedPartitionUrls(List<String> urls) {
        this.assignedPartitions = urls.stream().map(url -> {
            HmdPartitionModel partition = new HmdPartitionModel();
            partition.setUrl(url);
            return partition;
        }).collect(Collectors.toList());
    }

    public HmdServerModel getServer() {
        return server;
    }

    public void setServer(HmdServerModel server) {
        this.server = server;
    }
}
