module Atlas
  class MeritOrderDetails
    include ValueObject
    include ActiveModel::Validations

    values do
      attribute :type,           Symbol
      attribute :group,          Symbol
      attribute :level,          Symbol, default: :hv
      attribute :target,         Symbol
      attribute :demand_source,  Symbol
      attribute :demand_profile, Symbol
    end

    validates :type, inclusion: %i[consumer dispatchable flex must_run volatile]
    validates :level, inclusion: %i[lv mv hv omit]
  end # MeritOrderDetails
end # Atlas

module Atlas
  class MeritOrderDetails
    include ValueObject
    include ActiveModel::Validations

    values do
      attribute :type,           Symbol
      attribute :group,          Symbol
      attribute :level,          Symbol, default: :hv
      attribute :delegate,       Symbol
      attribute :demand_source,  Symbol
      attribute :demand_profile, Symbol
    end

    validates :type, inclusion: %i[consumer dispatchable flex must_run volatile]
    validates :level, inclusion: %i[lv mv hv omit]
  end # MeritOrderDetails
end # Atlas

Change MeritOrderDetails "target" to "delegate"
Change MeritOrderDetails "target" to "delegate"

Link points in the other direction, from the target to the delegate,
rather than from the delegate to the target.

Will remove the unusual situation where the EV node is used in the merit
order to control flexibility, rather than the actual use of electricity
for vehicles.
