<?php

namespace App\Request\Order;

use DateTime;
use App\Entity\Category;
use OpenApi\Annotations as OA;
use App\Traits\TranslatorTrait;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Validator\Constraints as Assert;
use Symfony\Component\Validator\Context\ExecutionContextInterface;

/**
 * @OA\Schema(
 *      title="RequestAddOrder"
 * )
 */
class RequestAddOrder
{
    public function __construct(Request $request)
    {
        $now = new \DateTime();
        $this->setSendNow($request->get('sendNow'));
        $this->setDeliveryDate(is_null($request->get('deliveryDate')) ? $now->format('Y-m-d H:i:s') : $request->get('deliveryDate'));
        $this->setSubtotal($request->get('subtotal'));
        $this->setFee($request->get('fee'));
        $this->setTotal($request->get('total'));
        $this->setPaymentType($request->get('paymentType'));
        $this->setMobileNumber($request->get('mobileNumber'));
        $this->setRestauranteId($request->get('restauranteId'));
        $this->setUserId($request->get('userId'));
        $this->setItem($request->get('item'));
    }

    /**
     * @Assert\Choice({"1","0"})
     * @OA\Property(type="bool", description="Possible values: 1 or 0")
     */
    private $sendNow;

    /**
     * @Assert\DateTime
     * @var string A "Y-m-d H:i:s" formatted value
     * @OA\Property(type="DateTime", description="Format yyyy-mm-dd hh:ii:ss")
     * */
    private $deliveryDate;

    /**
     * @Assert\NotBlank()
     * @Assert\Positive
     * @OA\Property(type="decimal")
    */
    private $subtotal;

    /**
     * @Assert\NotBlank()
     * @Assert\Positive
     * @OA\Property(type="decimal")
    */
    private $fee;

    /**
     * @Assert\NotBlank()
     * @Assert\Positive
     * @OA\Property(type="decimal")
    */
    private $total;

    /**
     * @Assert\NotBlank()
     * @OA\Property(type="string", maxLength=2, description="Possible values: MB or WA")
     */
    private $paymentType;

    /**
     * @OA\Property(type="string", maxLength=10, description="When payment type is WA mobile number is mandatory")
     */
    private $mobileNumber;

    /**
     * @Assert\NotBlank()
     * @OA\Property(type="integer")
     */
    private $restauranteId;

    /**
     * @Assert\NotBlank()
     * @OA\Property(type="integer")
     */
    private $userId;

    /**
     * @Assert\NotBlank()
     * @OA\Property(type="array")
     */
    private $item;

    /**
     * Get the value of sendNow
     */
    public function getSendNow()
    {
        return $this->sendNow;
    }

    /**
     * Set the value of sendNow
     *
     * @return  self
     */
    public function setSendNow($sendNow)
    {
        $this->sendNow = $sendNow;

        return $this;
    }

    /**
     * Get a "Y-m-d" formatted value
     *
     * @return  string
     */
    public function getDeliveryDate()
    {
        return $this->deliveryDate;
    }

    /**
     * Set a "Y-m-d" formatted value
     *
     * @param  string  $deliveryDate  A "Y-m-d" formatted value
     *
     * @return  self
     */
    public function setDeliveryDate(string $deliveryDate)
    {
        $this->deliveryDate = $deliveryDate;

        return $this;
    }

    /**
     * Get the value of subtotal
     */
    public function getSubtotal()
    {
        return $this->subtotal;
    }

    /**
     * Set the value of subtotal
     *
     * @return  self
     */
    public function setSubtotal($subtotal)
    {
        $this->subtotal = $subtotal;

        return $this;
    }

    /**
     * Get the value of fee
     */
    public function getFee()
    {
        return $this->fee;
    }

    /**
     * Set the value of fee
     *
     * @return  self
     */
    public function setFee($fee)
    {
        $this->fee = $fee;

        return $this;
    }

    /**
     * Get the value of total
     */
    public function getTotal()
    {
        return $this->total;
    }

    /**
     * Set the value of total
     *
     * @return  self
     */
    public function setTotal($total)
    {
        $this->total = $total;

        return $this;
    }

    /**
     * Get the value of paymentType
     */
    public function getPaymentType()
    {
        return $this->paymentType;
    }

    /**
     * Set the value of paymentType
     *
     * @return  self
     */
    public function setPaymentType($paymentType)
    {
        $this->paymentType = $paymentType;

        return $this;
    }

    /**
     * Get the value of restauranteId
     */
    public function getRestauranteId()
    {
        return $this->restauranteId;
    }

    /**
     * Set the value of restauranteId
     *
     * @return  self
     */
    public function setRestauranteId($restauranteId)
    {
        $this->restauranteId = $restauranteId;

        return $this;
    }

    /**
     * Get the value of userId
     */
    public function getUserId()
    {
        return $this->userId;
    }

    /**
     * Set the value of userId
     *
     * @return  self
     */
    public function setUserId($userId)
    {
        $this->userId = $userId;

        return $this;
    }

    /**
     * Get the value of item
     */
    public function getItem()
    {
        return $this->item;
    }

    /**
     * Set the value of item
     *
     * @return  self
     */
    public function setItem($item)
    {
        $this->item = $item;

        return $this;
    }

    /**
     * Get the value of mobileNumber
     */
    public function getMobileNumber()
    {
        return $this->mobileNumber;
    }

    /**
     * Set the value of mobileNumber
     *
     * @return  self
     */
    public function setMobileNumber($mobileNumber)
    {
        $this->mobileNumber = $mobileNumber;

        return $this;
    }
}
