package io.synor.compute;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;

/**
 * Pricing information for a processor type.
 */
@JsonIgnoreProperties(ignoreUnknown = true)
public class PricingInfo {
    @JsonProperty("processor")
    private String processor;

    @JsonProperty("price_per_second")
    private Double pricePerSecond;

    @JsonProperty("available_units")
    private Integer availableUnits;

    @JsonProperty("utilization_percent")
    private Double utilizationPercent;

    @JsonProperty("aws_equivalent_price")
    private Double awsEquivalentPrice;

    @JsonProperty("savings_percent")
    private Double savingsPercent;

    public PricingInfo() {}

    public String getProcessor() {
        return processor;
    }

    public ProcessorType getProcessorType() {
        return ProcessorType.fromValue(processor);
    }

    public Double getPricePerSecond() {
        return pricePerSecond;
    }

    public Integer getAvailableUnits() {
        return availableUnits;
    }

    public Double getUtilizationPercent() {
        return utilizationPercent;
    }

    public Double getAwsEquivalentPrice() {
        return awsEquivalentPrice;
    }

    public Double getSavingsPercent() {
        return savingsPercent;
    }

    @Override
    public String toString() {
        return "PricingInfo{" +
               "processor='" + processor + '\'' +
               ", pricePerSecond=" + pricePerSecond +
               ", availableUnits=" + availableUnits +
               ", savingsPercent=" + savingsPercent +
               '}';
    }
}
