module Atlas
  # Describes optional information for setting up the node within a Fever
  # calculation.
  class FeverDetails
    include ValueObject

    values do
      attribute :type,      Symbol
      attribute :group,     Symbol
      attribute :curve,     String

      # Deferrable demands.
      attribute :defer_for, Integer

      # Variable efficiency.
      attribute :efficiency_based_on,      Symbol
      attribute :efficiency_balanced_with, Symbol

      # Use a producer defined on another node.
      attribute :alias_of, Symbol

      # Custom capacities for producers which have multiple components.
      attribute :capacity, Hash[Symbol => Float]
    end

    def to_hash
      hash = super
      hash.delete(:capacity) if hash[:capacity].empty?

      hash
    end
  end
end

module Atlas
  # Describes optional information for setting up the node within a Fever
  # calculation.
  class FeverDetails
    include ValueObject

    values do
      attribute :type,      Symbol
      attribute :group,     Symbol
      attribute :curve,     String

      # Deferrable demands.
      attribute :defer_for, Integer

      # Variable efficiency.
      attribute :efficiency_based_on,      Symbol
      attribute :efficiency_balanced_with, Symbol

      # The base coefficient of performance, and the COP change per degree of
      # ambient temperature.
      attribute :base_cop,       Float
      attribute :cop_per_degree, Float
      attribute :cop_cutoff,     Float

      # Use a producer defined on another node.
      attribute :alias_of, Symbol

      # Custom capacities for producers which have multiple components.
      attribute :capacity, Hash[Symbol => Float]
    end

    def to_hash
      hash = super
      hash.delete(:capacity) if hash[:capacity].empty?

      hash
    end
  end
end

Add COP constant attributes to FeverDetails
Add COP constant attributes to FeverDetails
