package subscribesvc

import (
	subscribedomain "legalgo-BE-go/internal/domain/subscribe"
	userdomain "legalgo-BE-go/internal/domain/user"
	timeutils "legalgo-BE-go/internal/utilities/time_utils"
)

func (i *impl) Update(spec userdomain.UserSubsUpdate) error {
	newSpec := subscribedomain.Subscribe{
		ID:              spec.ID,
		AutoRenew:       spec.AutoRenew,
		StartDate:       timeutils.Now(),
		EndDate:         spec.EndDate,
		Status:          spec.Status,
		SubscribePlanID: spec.SubscribePlanID,
		UpdatedAt:       timeutils.Now(),
	}
	return i.subsRepo.Update(newSpec)
}
