<?php
namespace Fifa\ConnectId\Sdk\Exception;

use Fifa\ConnectId\Sdk\Api\ApiException;
use Fifa\ConnectId\Sdk\Api\Model\PersonType;

/**
 * Class FifaPersonMergedException
 * @package Fifa\ConnectId\Sdk\Exception
 */
class FifaPersonMergedException extends FifaConnectIdException
{
    /**
     * @var string
     */
    private $primaryPersonId;

    /**
     * @var PersonType
     */
    private $requestedPerson;

    /**
     * Constructor
     *
     * @param ApiException $apiException
     * @param string $message
     * @param string $primaryPersonId
     * @param PersonType $requestedPerson
     */
    public function __construct(ApiException $apiException, $message, $primaryPersonId, PersonType $requestedPerson)
    {
        parent::__construct($apiException, $message, $apiException->getCode());
        $this->primaryPersonId = $primaryPersonId;
        $this->requestedPerson = $requestedPerson;
    }

    /**
     * Gets primary person ID
     *
     * @return string
     */
    public function getPrimaryPersonId(): string
    {
        return $this->primaryPersonId;
    }

    /**
     * Sets primary person ID
     *
     * @param string $primaryPersonId
     * @return FifaPersonMergedException
     */
    public function setPrimaryPersonId(string $primaryPersonId): FifaPersonMergedException
    {
        $this->primaryPersonId = $primaryPersonId;
        return $this;
    }

    /**
     * Gets requested person
     *
     * @return PersonType
     */
    public function getRequestedPerson(): PersonType
    {
        return $this->requestedPerson;
    }

    /**
     * Sets requester person
     *
     * @param PersonType $requestedPerson
     * @return FifaPersonMergedException
     */
    public function setRequestedPerson(PersonType $requestedPerson): FifaPersonMergedException
    {
        $this->requestedPerson = $requestedPerson;
        return $this;
    }
}