package handler

import (
	"time"

	"github.com/denisovdennis/autohero/internal/model"
)

// consumeFreeBuffCharge consumes one per-buff-type charge (F2P and subscribers).
// Returns an error if no charges remain for the given buff type.
func consumeFreeBuffCharge(hero *model.Hero, bt model.BuffType, now time.Time) error {
	hero.EnsureBuffChargesPopulated(now)
	return hero.ConsumeBuffCharge(bt, now)
}

// refundFreeBuffCharge restores a charge after a failed activation.
func refundFreeBuffCharge(hero *model.Hero, bt model.BuffType) {
	hero.RefundBuffCharge(bt)
}
