package benefactoraddressservice

import (
	"context"

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

func (s Service) ProvinceExistByID(ctx context.Context, req addressparam.ProvinceExistByIDRequest) (addressparam.ProvinceExistByIDResponse, error) {
	const op = "benefactoraddressservice.ProvinceExistByID"

	isExisted, err := s.repo.IsExistProvinceByID(ctx, req.ID)
	if err != nil {
		return addressparam.ProvinceExistByIDResponse{}, richerror.New(op).WithErr(err).WithKind(richerror.KindUnexpected)
	}

	return addressparam.ProvinceExistByIDResponse{Existed: isExisted}, nil
}