package adminservice

import (
	"context"

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

func (s Service) AdminExistByID(ctx context.Context, req param.AdminExistByIDRequest) (param.AdminExistByIDResponse, error) {
	const op = "adminservice.AdminExistByID"

	admin, err := s.repo.GetAdminByID(ctx, req.AdminID)
	if err != nil {
		return param.AdminExistByIDResponse{}, richerror.New(op).WithErr(err).WithKind(richerror.KindUnexpected)
	}

	return param.AdminExistByIDResponse{Admin: admin}, nil
}
