package adminrefertimeservice

import (
	"context"
	param "git.gocasts.ir/ebhomengo/niki/param/admin/refer_time"
	richerror "git.gocasts.ir/ebhomengo/niki/pkg/rich_error"
)

func (s Service) GetReferTimeByID(ctx context.Context, req param.GetReferTimeRequest) (param.GetReferTimeResponse, error) {
	const op = richerror.Op("refertimeservice.GetReferTimeByID")
	referTime, gErr := s.repo.Get(ctx, req.ReferTimeID)
	if gErr != nil {
		return param.GetReferTimeResponse{}, richerror.New(op).WithErr(gErr).WithKind(richerror.KindUnexpected)
	}
	return param.GetReferTimeResponse{ReferTime: referTime}, nil
}