<?php

namespace KupShop\ReclamationsBundle\Entity;

use KupShop\KupShopBundle\Template\ArrayAccess;

class ReclamationEntity extends ArrayAccess
{
    protected $id;
    protected $id_language;
    protected $id_currency;
    protected $code;
    protected $date_created;
    protected $date_accepted;
    protected $date_handle;
    protected $status;
    protected $status_name;
    protected $handle_type;
    protected $handle_type_name;
    protected $preferred_handle_type;
    protected $preferred_handle_type_name;
    protected $bank_account;
    protected $history;
    protected $package_id;
    protected $id_balikonos;

    protected $email;
    protected $address = [];
    protected $descr;
    protected $user_note;

    protected $id_order;
    protected $order_no;

    protected $data;

    protected $id_item;
    protected $item;

    protected int $pieces;

    public function getId()
    {
        return $this->id;
    }

    public function setId($id)
    {
        $this->id = $id;

        return $this;
    }

    public function getIdLanguage()
    {
        return $this->id_language;
    }

    public function setIdLanguage($id_language)
    {
        $this->id_language = $id_language;

        return $this;
    }

    public function getIdCurrency()
    {
        return $this->id_currency;
    }

    public function setIdCurrency($id_currency)
    {
        $this->id_currency = $id_currency;

        return $this;
    }

    public function getCode()
    {
        return $this->code;
    }

    public function setCode($code)
    {
        $this->code = $code;

        return $this;
    }

    public function getDateCreated()
    {
        return $this->date_created;
    }

    public function setDateCreated($date_created)
    {
        $this->date_created = $date_created;

        return $this;
    }

    public function getDateAccepted()
    {
        return $this->date_accepted;
    }

    public function setDateAccepted($date_accepted)
    {
        $this->date_accepted = $date_accepted;

        return $this;
    }

    public function getDateHandle()
    {
        return $this->date_handle;
    }

    public function setDateHandle($date_handle)
    {
        $this->date_handle = $date_handle;

        return $this;
    }

    public function getStatus()
    {
        return $this->status;
    }

    public function setStatus($status)
    {
        $this->status = $status;

        return $this;
    }

    public function getStatusName()
    {
        return $this->status_name;
    }

    public function setStatusName($status_name)
    {
        $this->status_name = $status_name;

        return $this;
    }

    public function getHandleType()
    {
        return $this->handle_type;
    }

    public function setHandleType($handle_type)
    {
        $this->handle_type = $handle_type;

        return $this;
    }

    public function getPrefHandleType()
    {
        return $this->preferred_handle_type;
    }

    public function setPrefHandleType($preferred_handle_type)
    {
        $this->preferred_handle_type = $preferred_handle_type;

        return $this;
    }

    public function getHandleTypeName()
    {
        return $this->handle_type_name;
    }

    public function setHandleTypeName($handle_type_name)
    {
        $this->handle_type_name = $handle_type_name;

        return $this;
    }

    public function getPrefHandleTypeName()
    {
        return $this->preferred_handle_type_name;
    }

    public function setPrefHandleTypeName($preferred_handle_type_name)
    {
        $this->preferred_handle_type_name = $preferred_handle_type_name;

        return $this;
    }

    public function getBankAccount()
    {
        return $this->bank_account;
    }

    public function setBankAccount($bank_account)
    {
        $this->bank_account = $bank_account;

        return $this;
    }

    public function getDescr()
    {
        return $this->descr;
    }

    public function setDescr($descr)
    {
        $this->descr = $descr;

        return $this;
    }

    public function getUserNote()
    {
        return $this->user_note;
    }

    public function setUserNote($user_note)
    {
        $this->user_note = $user_note;

        return $this;
    }

    public function getHistory()
    {
        return $this->history;
    }

    public function setHistory($history)
    {
        $this->history = $history;

        return $this;
    }

    public function getEmail()
    {
        return $this->email;
    }

    public function setEmail($email)
    {
        $this->email = $email;

        return $this;
    }

    public function getDelivery(): array
    {
        return $this->address;
    }

    public function getAddress(): array
    {
        return $this->address;
    }

    public function setAddress(array $address)
    {
        $this->address = $address;

        return $this;
    }

    public function getIdItem()
    {
        return $this->id_item;
    }

    public function setIdItem($id_item)
    {
        $this->id_item = $id_item;

        return $this;
    }

    public function getItem()
    {
        return $this->item;
    }

    public function setItem($item)
    {
        $this->item = $item;

        return $this;
    }

    public function getPieces(): int
    {
        return $this->pieces;
    }

    public function setPieces($pieces)
    {
        $this->pieces = $pieces;

        return $this;
    }

    public function getIdOrder()
    {
        return $this->id_order;
    }

    public function setIdOrder($id_order)
    {
        $this->id_order = $id_order;

        return $this;
    }

    public function getOrderNumber()
    {
        return $this->order_no;
    }

    public function setOrderNumber($order_no)
    {
        $this->order_no = $order_no;

        return $this;
    }

    public function getPackageId()
    {
        return $this->package_id;
    }

    public function setPackageId($package_id)
    {
        $this->package_id = $package_id;

        return $this;
    }

    public function getIdBalikonos()
    {
        return $this->id_balikonos;
    }

    public function setIdBalikonos($id_balikonos)
    {
        $this->id_balikonos = $id_balikonos;

        return $this;
    }

    public function getData()
    {
        return $this->data;
    }

    public function setData($data)
    {
        $this->data = $data;

        return $this;
    }

    public function isClosed(): bool
    {
        return (bool) ($this->status > 1);
    }

    public function getIdReturnDelivery(): ?int
    {
        if ($data = $this->getData()) {
            return empty($data['id_return_delivery']) ? null : $data['id_return_delivery'];
        }

        return null;
    }
}
