package benefactor

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

func (s Service) AddressExistByID(ctx context.Context, req param.GetAddressByIDRequest) (param.GetAddressByIDResponse, error) {
	const op = "adminaddressservice.BenefactorExistByID"

	address, err := s.repo.GetAddressByID(ctx, req.ID)
	if err != nil {
		return param.GetAddressByIDResponse{}, richerror.New(op).WithErr(err).WithKind(richerror.KindUnexpected)
	}

	return param.GetAddressByIDResponse{Address: address}, nil
}
