<?php
namespace Fifa\ConnectId\Sdk\ApiClient\Facility;

use Fifa\ConnectId\Sdk\Api\Model\FacilityLocalType;
use Fifa\ConnectId\Sdk\Api\Model\FindFacilitiesRequestType;
use Fifa\ConnectId\Sdk\Api\Model\FindFacilitiesResponseType;
use Fifa\ConnectId\Sdk\Api\Model\RegisterResponseType;
use Fifa\ConnectId\Sdk\Exception\FifaConnectIdException;
use Fifa\ConnectId\Sdk\Exception\FifaDuplicatedFacilityFoundException;
use Fifa\ConnectId\Sdk\Exception\FifaEntityNotFoundException;
use Fifa\ConnectId\Sdk\Exception\InvalidClientDataException;
use Fifa\ConnectId\Sdk\Exception\TooManyRequestsException;
use Fifa\ConnectId\Sdk\Registration\ValidationException;
use Fifa\ConnectServiceBus\Sdk\Exception\AuthenticationException;
use Fifa\ConnectServiceBus\Sdk\Exception\UnauthorizedException;

/**
 * Interface FacilityApiInterface
 * @package Fifa\ConnectId\Sdk\ApiClient\Facility
 */
interface FacilityApiInterface
{
    /**
     * Registers a new facility and assigns FIFA Unique Identifier.
     * Uses facility data as defined in FIFA Data Standard.
     *
     * @param FacilityLocalType $facility
     * @param bool $force - registers facility even if possible duplicates are detected
     * @return RegisterResponseType
     *
     * @throws InvalidClientDataException
     * @throws FifaConnectIdException
     * @throws UnauthorizedException
     * @throws FifaDuplicatedFacilityFoundException
     * @throws AuthenticationException
     * @throws ValidationException
     * @throws TooManyRequestsException
     */
    public function registerFacility(FacilityLocalType $facility, bool $force = false): RegisterResponseType;

    /**
     * Gets facility data associated with the specified FIFA Unique Identifier.
     *
     * @param string $facilityId
     * @return FacilityLocalType
     *
     * @throws InvalidClientDataException
     * @throws FifaConnectIdException
     * @throws UnauthorizedException
     * @throws FifaEntityNotFoundException
     * @throws AuthenticationException
     * @throws ValidationException
     * @throws TooManyRequestsException
     */
    public function getFacility(string $facilityId): FacilityLocalType;

    /**
     * Updates the facility.
     *
     * @param FacilityLocalType $facility - Object containing information about the facility to update
     * @param bool $force - updates facility even if possible duplicates are detected
     * @return FacilityLocalType
     *
     * @throws InvalidClientDataException
     * @throws FifaConnectIdException
     * @throws UnauthorizedException
     * @throws FifaEntityNotFoundException
     * @throws FifaDuplicatedFacilityFoundException
     * @throws AuthenticationException
     * @throws ValidationException
     * @throws TooManyRequestsException
     */
    public function update(FacilityLocalType $facility, bool $force = false): FacilityLocalType;

    /**
     * Searches for facilities.
     *
     * @param FindFacilitiesRequestType $request
     * @return FindFacilitiesResponseType
     *
     * @throws FifaConnectIdException
     * @throws UnauthorizedException
     * @throws AuthenticationException
     * @throws ValidationException
     * @throws TooManyRequestsException
     */
    public function findFacilities(FindFacilitiesRequestType $request): FindFacilitiesResponseType;

    /**
     * Gets a list of facilities this facility may be duplicated with.
     * Uses facility data as defined in FIFA Data Standard.
     *
     * @param FacilityLocalType $facility - Object containing information about the organisation
     * @return array
     *
     * @throws InvalidClientDataException
     * @throws FifaConnectIdException
     * @throws UnauthorizedException
     * @throws AuthenticationException
     * @throws ValidationException
     * @throws TooManyRequestsException
     */
    public function getDuplicates(FacilityLocalType $facility): array;
}