<?php
/**
 * @author Ulrich Hecht <ulrich.hecht@hecht-software.de>
 * @date 12/16/2016
 */

namespace AppBundle\Entity;

use Symfony\Component\Validator\Constraints as Assert;
use AppBundle\Validator\Constraints as AppBundleAssert;
use Symfony\Component\Validator\Context\ExecutionContextInterface;

/**
 * Class BookingRequest
 * @package AppBundle\Entity
 * @AppBundleAssert\BookingRequest
 */
class BookingRequest
{
    // Used in SternToursCrmBookingExports, expected to be equivalent to sex (as defined in Traveler)
    const MR = 1;
    const MRS = 2;

    /**
     * @var TravelDeparturePoint $departure
     */
    private $departure;

    private $travelerCount;

    /**
     * @var TravelInsurance $insurance
     */
    private $insurance;

    private $comfort = false;

    private $travelOptions = [];

    private $salutation;

    /**
     * @Assert\NotBlank()
     */
    private $firstName;

    /**
     * @Assert\NotBlank()
     */
    private $lastName;

    /**
     * @Assert\NotBlank()
     */
    private $streetAddress;

    /**
     * @Assert\NotBlank()
     */
    private $zipCode;

    /**
     * @Assert\NotBlank()
     */
    private $city;

    private $nation;

    /**
     * @Assert\NotBlank()
     */
    private $phone;

    private $fax;

    /**
     * @Assert\NotBlank()
     */
    private $email;

    private $travelers = [];

    private $notes;

    /**
     * @Assert\IsTrue()
     */
    private $acceptTerms = false;

    /**
     * BookingRequest constructor.
     */
    public function __construct()
    {
        for ($i = 0; $i < 4; ++$i)
        {
            $this->travelers[] = new Traveler();
        }
    }

    /**
     * @return TravelDeparturePoint
     */
    public function getDeparture()
    {
        return $this->departure;
    }

    /**
     * @param TravelDeparturePoint $departure
     */
    public function setDeparture(TravelDeparturePoint $departure)
    {
        $this->departure = $departure;
    }

    /**
     * @return mixed
     */
    public function getTravelerCount()
    {
        return $this->travelerCount;
    }

    /**
     * @param mixed $travelerCount
     */
    public function setTravelerCount($travelerCount)
    {
        $this->travelerCount = $travelerCount;
    }

    /**
     * @return TravelInsurance
     */
    public function getInsurance()
    {
        return $this->insurance;
    }

    /**
     * @param TravelInsurance $insurance
     */
    public function setInsurance(TravelInsurance $insurance)
    {
        $this->insurance = $insurance;
    }

    /**
     * @return mixed
     */
    public function getComfort()
    {
        return $this->comfort;
    }

    /**
     * @param mixed $comfort
     */
    public function setComfort($comfort)
    {
        $this->comfort = $comfort;
    }

    /**
     * @return TravelOption[]
     */
    public function getTravelOptions()
    {
        return $this->travelOptions;
    }

    /**
     * @param mixed $travelOptions
     */
    public function setTravelOptions($travelOptions)
    {
        $this->travelOptions = $travelOptions;
    }

    /**
     * @return int
     */
    public function getSalutation()
    {
        return $this->salutation;
    }

    /**
     * @param int $salutation
     */
    public function setSalutation($salutation)
    {
        $this->salutation = $salutation;
    }

    /**
     * @return string
     */
    public function getFirstName()
    {
        return $this->firstName;
    }

    /**
     * @param string $firstName
     */
    public function setFirstName($firstName)
    {
        $this->firstName = $firstName;
    }

    /**
     * @return string
     */
    public function getLastName()
    {
        return $this->lastName;
    }

    /**
     * @param string $lastName
     */
    public function setLastName($lastName)
    {
        $this->lastName = $lastName;
    }

    /**
     * @return string
     */
    public function getStreetAddress()
    {
        return $this->streetAddress;
    }

    /**
     * @param string $streetAddress
     */
    public function setStreetAddress($streetAddress)
    {
        $this->streetAddress = $streetAddress;
    }

    /**
     * @return string
     */
    public function getZipCode()
    {
        return $this->zipCode;
    }

    /**
     * @param string $zipCode
     */
    public function setZipCode($zipCode)
    {
        $this->zipCode = $zipCode;
    }

    /**
     * @return string
     */
    public function getCity()
    {
        return $this->city;
    }

    /**
     * @param string $city
     */
    public function setCity($city)
    {
        $this->city = $city;
    }

    /**
     * @return int
     */
    public function getNation()
    {
        return $this->nation;
    }

    /**
     * @param int $nation
     */
    public function setNation($nation)
    {
        $this->nation = $nation;
    }

    /**
     * @return string
     */
    public function getPhone()
    {
        return $this->phone;
    }

    /**
     * @param string $phone
     */
    public function setPhone($phone)
    {
        $this->phone = $phone;
    }

    /**
     * @return string
     */
    public function getFax()
    {
        return $this->fax;
    }

    /**
     * @param string $fax
     */
    public function setFax($fax)
    {
        $this->fax = $fax;
    }

    /**
     * @return string
     */
    public function getEmail()
    {
        return $this->email;
    }

    /**
     * @param string $email
     */
    public function setEmail($email)
    {
        $this->email = $email;
    }

    /**
     * @return Traveler[]
     */
    public function getTravelers()
    {
        return $this->travelers;
    }

    /**
     * @param Traveler[] $travelers
     */
    public function setTravelers($travelers)
    {
        $this->travelers = $travelers;
    }

    /*
    public function addTraveler(Traveler $traveler)
    {
        $this->travelers[] = $traveler;
    }
    */

    /**
     * @return string
     */
    public function getNotes()
    {
        return $this->notes;
    }

    /**
     * @param string $notes
     */
    public function setNotes($notes)
    {
        $this->notes = $notes;
    }

    /**
     * @return bool
     */
    public function isAcceptTerms()
    {
        return $this->acceptTerms;
    }

    /**
     * @param bool $acceptTerms
     */
    public function setAcceptTerms($acceptTerms)
    {
        $this->acceptTerms = $acceptTerms;
    }

    /**
     * @Assert\Callback
     */
    public function validate(ExecutionContextInterface $context, $payload)
    {
        //$context->
    }
}