package benefactoraddressservice

import (
	"context"

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

func (s Service) GetAllProvinces(ctx context.Context, _ param.GetAllProvincesRequest) (param.GetAllProvincesResponse, error) {
	const op = "benefactoraddressservice.GetAllProvinces"

	provinces, err := s.repo.GetAllProvinces(ctx)
	if err != nil {
		return param.GetAllProvincesResponse{}, richerror.New(op).WithErr(err).WithKind(richerror.KindUnexpected)
	}

	return param.GetAllProvincesResponse{Data: provinces}, nil
}
