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

/**
 * Class PersonName
 * @package Fifa\ConnectId\Sdk\Model
 */
class PersonName
{
    /**
     * @var string
     */
    private $firstName;

    /**
     * @var string
     */
    private $lastName;

    /**
     * Constructor
     *
     * @param string|null $firstName
     * @param string|null $lastName
     */
    public function __construct(?string $firstName, ?string $lastName)
    {
        $firstName = trim((string) $firstName);
        $lastName = trim((string) $lastName);

        $this->lastName = $lastName;
        $this->firstName = empty($firstName) ? null : $firstName;
    }

    /**
     * String representation of the object
     *
     * @return string
     */
    public function __toString()
    {
        return $this->firstName . ' ' . $this->lastName;
    }

    /**
     * Gets a first name
     *
     * @return string|null
     */
    public function getFirstName(): ?string
    {
        return $this->firstName;
    }

    /**
     * Gets a last name
     *
     * @return string
     */
    public function getLastName(): string
    {
        return $this->lastName;
    }
}