package benefactorrefertimeservice

import (
	"context"

	"git.gocasts.ir/ebhomengo/niki/entity"
	param "git.gocasts.ir/ebhomengo/niki/param/benefactor/refer_time"
	richerror "git.gocasts.ir/ebhomengo/niki/pkg/rich_error"
)

func (s Service) GetAll(ctx context.Context, _ param.GetAllReferTimeRequest) (param.GetAllReferTimeResponse, error) {
	const op = "benefactorrefertimeservice.GetAllReferTime"
	status := entity.ReferTimeActiveStatus

	referTimes, err := s.repo.GetAll(ctx, status)
	if err != nil {
		return param.GetAllReferTimeResponse{}, richerror.New(op).WithErr(err).WithKind(richerror.KindUnexpected)
	}

	return param.GetAllReferTimeResponse{Data: referTimes}, nil
}
