src/AtechNet/CoreBundle/Entity/Claim.php line 22

Open in your IDE?
  1. <?php
  2. namespace App\AtechNet\CoreBundle\Entity;
  3. use Doctrine\Common\Collections\ArrayCollection;
  4. use Doctrine\ORM\Mapping\Column;
  5. use Doctrine\ORM\Mapping\Entity;
  6. use Doctrine\ORM\Mapping\HasLifecycleCallbacks;
  7. use Doctrine\ORM\Mapping\JoinColumn;
  8. use Doctrine\ORM\Mapping\ManyToOne;
  9. use Doctrine\ORM\Mapping\OneToMany;
  10. use Doctrine\ORM\Mapping\OrderBy;
  11. use Doctrine\ORM\Mapping\Table as Table;
  12. /**
  13.  * Claim
  14.  *
  15.  * @Table(name="claims")
  16.  * @Entity(repositoryClass="App\AtechNet\CoreBundle\Repository\ClaimRepository")
  17.  * @HasLifecycleCallbacks
  18.  */
  19. class Claim extends AbstractSignedEntity
  20. {
  21.     public const TYPE_CLAIM = 1;
  22.     public const TYPE_WITHDRAWAL = 2;
  23.     public const TYPE_CLAIM_REMOTE = 3;
  24.     public const TYPE_COMMISSION = 4;
  25.     public const TYPE_UNCLAIMED_PACKAGE = 5;
  26.     public const STATUS_WAITING = 50;
  27.     public const RECEIVE_TYPE_NOT_SELECTED = 0;
  28.     public const RECEIVE_TYPE_CHANGE_ON_RECEIVE = 1;
  29.     public const RECEIVE_TYPE_SHIPPED_BY_PARCEL = 2;
  30.     public const RECEIVE_TYPE_PERSONALLY = 3;
  31.     public const RETURN_TYPE_NOT_SELECTED = 0;
  32.     public const RETURN_TYPE_PARCEL = 1;
  33.     public const RETURN_TYPE_PERSONALLY = 2;
  34.     public const SOLUTION_NOT_SET = 0;
  35.     public const SOLUTION_REPAIR = 1;
  36.     public const SOLUTION_CHANGE = 2;
  37.     public const SOLUTION_ITEM_CREDIT_NOTE = 3;
  38.     public const SOLUTION_RECIEVED_IN_STOCK = 6;
  39.     public const SOLUTION_REJECTED = 4;
  40.     public const SOLUTION_CANCELED = 5;
  41.     public const SOLUTION_CAUSE_NOT_SET = 0;
  42.     public const SOLUTION_CAUSE_UNKNOWN = 1;
  43.     public const SOLUTION_CAUSE_CUSTOMER_DEMAND = 2;
  44.     public const SOLUTION_CAUSE_ERROR_NOT_OCCUR = 3;
  45.     public const SOLUTION_CAUSE_REPLACEMENT = 4;
  46.     public const SOLUTION_CAUSE_REAL_ERROR = 5;
  47.     public const PRODUCT_TYPE_NOT_SET = 0;
  48.     public const PRODUCT_TYPE_COMPONENT = 1;
  49.     public const PRODUCT_TYPE_MONITOR = 2;
  50.     public const PRODUCT_TYPE_NOTEBOOK = 3;
  51.     public const PRODUCT_TYPE_PC = 4;
  52.     public const PRODUCT_TYPE_PRINTER = 5;
  53.     public const WITHDRAWAL_REASON_NOT_SELECTED = 0;
  54.     public const WITHDRAWAL_REASON_WANT_CHANGE = 1;
  55.     public const WITHDRAWAL_REASON_MALFUNCTIONING_PRODUCT = 2;
  56.     public const WITHDRAWAL_REASON_DO_NOT_LIKE_AESTHETICS = 3;
  57.     public const WITHDRAWAL_REASON_DO_NOT_NEED = 4;
  58.     public const WITHDRAWAL_REASON_ITEM_DOESNT_TURN_ON = 5;
  59.     public const WITHDRAWAL_REASON_CHARGING_POWER_PORT_CONNECTOR_ISSUE = 6;
  60.     public const WITHDRAWAL_REASON_BATTERY_LIFE_SHORTER_THAN_EXPECTED = 7;
  61.     public const WITHDRAWAL_REASON_DEVICE_GETS_HOT = 8;
  62.     public const WITHDRAWAL_REASON_OTHER_PARTS_ARENT_AS_EXPECTED = 9;
  63.     public const WITHDRAWAL_REASON_CANT_UPDATE_DEVICE = 10;
  64.     public const WITHDRAWAL_REASON_DELIVERY_ISSUES = 11;
  65.     public const WITHDRAWAL_REASON_KEYS_MISSING_BROKEN_OTHER = 12;
  66.     public const WITHDRAWAL_REASON_PERFORMANCE_ISNT_AS_EXPECTED_GRADE = 13;
  67.     public const WITHDRAWAL_REASON_SOUND_QUALITY_ISNT_AS_EXPECTED = 14;
  68.     public const WITHDRAWAL_REASON_CPU_PROBLEM = 15;
  69.     public const WITHDRAWAL_REASON_LCD_PROBLEM = 16;
  70.     public const WITHDRAWAL_REASON_ARRIVED_DIRTY = 17;
  71.     public const WITHDRAWAL_REASON_OTHER = 18;
  72.     public const WITHDRAWAL_REASON_WRONG_MODEL = 19;
  73.     public const WITHDRAWAL_REASON_CANT_LOGIN = 20;
  74.     public const WITHDRAWAL_REASON_BITLOCKER = 21;
  75.     public const WITHDRAWAL_REASON_NO_SKIN_COLOR = 22;
  76.     public const WITHDRAWAL_REASON_WRONG_STORAGE_CPU = 23;
  77.     /**
  78.      * @return array
  79.      */
  80.     public static function getTypeChoices(): array
  81.     {
  82.         return [
  83.             self::TYPE_CLAIM => 'Claim',
  84.             self::TYPE_WITHDRAWAL => 'Withdrawal',
  85.             self::TYPE_CLAIM_REMOTE => 'Claim remotely',
  86.             self::TYPE_COMMISSION => 'Commission',
  87.             self::TYPE_UNCLAIMED_PACKAGE => 'Unclaimed package',
  88.         ];
  89.     }
  90.     /**
  91.      * @return array
  92.      */
  93.     public static function getReceiveTypeChoices(): array
  94.     {
  95.         return [
  96.             self::RECEIVE_TYPE_NOT_SELECTED => 'Not selected',
  97.             self::RECEIVE_TYPE_CHANGE_ON_RECEIVE => 'Change on receive',
  98.             self::RECEIVE_TYPE_SHIPPED_BY_PARCEL => 'Shipped by parcel',
  99.             self::RECEIVE_TYPE_PERSONALLY => 'Personally',
  100.         ];
  101.     }
  102.     /**
  103.      * @return array
  104.      */
  105.     public static function getReturnTypeChoices(): array
  106.     {
  107.         return [
  108.             self::RETURN_TYPE_NOT_SELECTED => 'Not selected',
  109.             self::RETURN_TYPE_PARCEL => 'Parcel',
  110.             self::RETURN_TYPE_PERSONALLY => 'Personally',
  111.         ];
  112.     }
  113.     /**
  114.      * @return array
  115.      */
  116.     public static function getSolutionChoices(): array
  117.     {
  118.         return [
  119.             self::SOLUTION_NOT_SET => 'Not selected',
  120.             self::SOLUTION_REPAIR => 'Repair',
  121.             self::SOLUTION_CHANGE => 'Change',
  122.             self::SOLUTION_ITEM_CREDIT_NOTE => 'Credit note',
  123.             self::SOLUTION_RECIEVED_IN_STOCK => 'Received in stock',
  124.             self::SOLUTION_REJECTED => 'Rejected',
  125.             self::SOLUTION_CANCELED => 'Canceled',
  126.         ];
  127.     }
  128.     /**
  129.      * @return array
  130.      */
  131.     public static function getSolutionCauseChoices(): array
  132.     {
  133.         return [
  134.             self::SOLUTION_CAUSE_NOT_SET => 'Not selected',
  135.             self::SOLUTION_CAUSE_UNKNOWN => 'Do not known why',
  136.             self::SOLUTION_CAUSE_CUSTOMER_DEMAND => 'Does not meet customer demands',
  137.             self::SOLUTION_CAUSE_ERROR_NOT_OCCUR => 'The error does not occur with us',
  138.             self::SOLUTION_CAUSE_REPLACEMENT => 'Replacement',
  139.             self::SOLUTION_CAUSE_REAL_ERROR => 'Real error',
  140.         ];
  141.     }
  142.     /**
  143.      * @return array
  144.      */
  145.     public static function getProductTypeChoices(): array
  146.     {
  147.         return [
  148.             self::PRODUCT_TYPE_NOT_SET => 'Not selected',
  149.             self::PRODUCT_TYPE_COMPONENT => 'Component',
  150.             self::PRODUCT_TYPE_MONITOR => 'Monitor',
  151.             self::PRODUCT_TYPE_NOTEBOOK => 'Notebook',
  152.             self::PRODUCT_TYPE_PC => 'PC',
  153.             self::PRODUCT_TYPE_PRINTER => 'Printer',
  154.         ];
  155.     }
  156.     /**
  157.      * @return array
  158.      */
  159.     public static function getWithdrawalReasonChoices(): array
  160.     {
  161.         return [
  162.             self::WITHDRAWAL_REASON_WANT_CHANGE => 'I changed my mind about the item',
  163.             self::WITHDRAWAL_REASON_MALFUNCTIONING_PRODUCT => 'Defective, malfunctioning product',
  164.             self::WITHDRAWAL_REASON_DO_NOT_LIKE_AESTHETICS => 'I don\'t like the aesthetics of the product',
  165.             self::WITHDRAWAL_REASON_DO_NOT_NEED => 'I don\'t need the product',
  166.             self::WITHDRAWAL_REASON_ITEM_DOESNT_TURN_ON => 'Item doesn\'t turn on',
  167.             self::WITHDRAWAL_REASON_CHARGING_POWER_PORT_CONNECTOR_ISSUE => 'Charging/power port/connector issue',
  168.             self::WITHDRAWAL_REASON_BATTERY_LIFE_SHORTER_THAN_EXPECTED => 'Battery life is shorter than expected/ issue',
  169.             self::WITHDRAWAL_REASON_DEVICE_GETS_HOT => 'Device gets hot',
  170.             self::WITHDRAWAL_REASON_OTHER_PARTS_ARENT_AS_EXPECTED => 'Other parts of the item aren\'t as expected',
  171.             self::WITHDRAWAL_REASON_CANT_UPDATE_DEVICE => 'Can\'t update device',
  172.             self::WITHDRAWAL_REASON_DELIVERY_ISSUES => 'Delivery issues',
  173.             self::WITHDRAWAL_REASON_KEYS_MISSING_BROKEN_OTHER => 'Key(s) is missing/broken/backlight/button/switch not working',
  174.             self::WITHDRAWAL_REASON_PERFORMANCE_ISNT_AS_EXPECTED_GRADE => 'Performance isn\'t as expected/grade',
  175.             self::WITHDRAWAL_REASON_SOUND_QUALITY_ISNT_AS_EXPECTED => 'Sound quality isn\'t as expected',
  176.             self::WITHDRAWAL_REASON_CPU_PROBLEM => 'CPU problem',
  177.             self::WITHDRAWAL_REASON_LCD_PROBLEM => 'LCD problem',
  178.             self::WITHDRAWAL_REASON_ARRIVED_DIRTY => 'Arrived dirty',
  179.             self::WITHDRAWAL_REASON_WRONG_MODEL => 'Item is the wrong brand/model',
  180.             self::WITHDRAWAL_REASON_CANT_LOGIN => 'Can\'t log in to device/Can\'t update device',
  181.             self::WITHDRAWAL_REASON_BITLOCKER => 'Bitlocker/DomainLock',
  182.             self::WITHDRAWAL_REASON_NO_SKIN_COLOR => 'No skin colour',
  183.             self::WITHDRAWAL_REASON_WRONG_STORAGE_CPU => 'Item has the wrong storage capacity (GB)/ wrong central processing unit (CPU)',
  184.             self::WITHDRAWAL_REASON_OTHER => 'Other',
  185.         ];
  186.     }
  187.     /**
  188.      * @return \DateTime
  189.      */
  190.     public static function getClaimSystemSwitchDate(): \DateTime
  191.     {
  192.         return (new \DateTime())->setDate(2018, 2, 22)->setTime(0, 0);
  193.     }
  194.     /**
  195.      * @var int
  196.      *
  197.      * @Column(name="type", type="integer")
  198.      */
  199.     private $type = self::TYPE_CLAIM;
  200.     /**
  201.      * @var string
  202.      *
  203.      * @Column(name="code", type="string", length=24)
  204.      */
  205.     private $code;
  206.     /**
  207.      * @var Customer
  208.      *
  209.      * @ManyToOne(targetEntity="Customer", inversedBy="claims")
  210.      * @JoinColumn(name="customer_id", referencedColumnName="id", nullable=true)
  211.      */
  212.     private $customer;
  213.     /**
  214.      * @var Document
  215.      *
  216.      * @ManyToOne(targetEntity="Document")
  217.      * @JoinColumn(name="document_id", referencedColumnName="id", nullable=true)
  218.      */
  219.     private $document;
  220.     /**
  221.      * @var ArrayCollection
  222.      *
  223.      * @OneToMany(targetEntity="ClaimSetting", mappedBy="claim", orphanRemoval=true)
  224.      * @OrderBy({"created" = "DESC"})
  225.      **/
  226.     private $settings;
  227.     /**
  228.      * @var Document
  229.      *
  230.      * @ManyToOne(targetEntity="Document")
  231.      * @JoinColumn(name="credit_note_id", referencedColumnName="id", nullable=true)
  232.      */
  233.     private $creditNote;
  234.     /**
  235.      * @var Product
  236.      *
  237.      * @ManyToOne(targetEntity="Product")
  238.      * @JoinColumn(name="product_id", referencedColumnName="id", nullable=true)
  239.      */
  240.     private $product;
  241.     /**
  242.      * @var int
  243.      *
  244.      * @Column(name="product_type", type="integer", nullable=true)
  245.      */
  246.     private $productType;
  247.     /**
  248.      * @var string
  249.      *
  250.      * @Column(name="product_title", type="string", length=128, nullable=true)
  251.      */
  252.     private $productTitle;
  253.     /**
  254.      * @var string
  255.      *
  256.      * @Column(name="invoice_code", type="string", length=32, nullable=true)
  257.      */
  258.     private $invoiceCode;
  259.     /**
  260.      * @var string
  261.      *
  262.      * @Column(name="first_name", type="string", length=64, nullable=true)
  263.      */
  264.     private $firstName;
  265.     /**
  266.      * @var string
  267.      *
  268.      * @Column(name="last_name", type="string", length=64, nullable=true)
  269.      */
  270.     private $lastName;
  271.     /**
  272.      * @var string
  273.      *
  274.      * @Column(name="business_name", type="string", length=128, nullable=true)
  275.      */
  276.     private $businessName;
  277.     /**
  278.      * @var string
  279.      *
  280.      * @Column(name="street", type="string", length=128)
  281.      */
  282.     private $street;
  283.     /**
  284.      * @var string
  285.      *
  286.      * @Column(name="city", type="string", length=64)
  287.      */
  288.     private $city;
  289.     /**
  290.      * @var string
  291.      *
  292.      * @Column(name="zip", type="string", length=16)
  293.      */
  294.     private $zip;
  295.     /**
  296.      * @var string
  297.      *
  298.      * @Column(name="email", type="string", length=64)
  299.      */
  300.     private $email;
  301.     /**
  302.      * @var string
  303.      *
  304.      * @Column(name="phone", type="string", length=64)
  305.      */
  306.     private $phone;
  307.     /**
  308.      * @var \DateTime
  309.      *
  310.      * @Column(name="courier_arrive_at", type="datetime", nullable=true)
  311.      */
  312.     private $courierArriveAt;
  313.     /**
  314.      * @var string
  315.      *
  316.      * @Column(name="serial_number", type="string", length=128, nullable=true)
  317.      */
  318.     private $serialNumber;
  319.     /**
  320.      * @var bool
  321.      *
  322.      * @Column(name="cable", type="boolean")
  323.      */
  324.     private $cable = false;
  325.     /**
  326.      * @var \DateTime
  327.      *
  328.      * @Column(name="bought_date", type="datetime", nullable=true)
  329.      */
  330.     private $boughtDate;
  331.     /**
  332.      * @var \DateTime
  333.      *
  334.      * @Column(name="received_date", type="datetime", nullable=true)
  335.      */
  336.     private $receivedDate;
  337.     /**
  338.      * @var string
  339.      *
  340.      * @Column(name="technic_note", type="text", nullable=true)
  341.      */
  342.     private $technicNote;
  343.     /**
  344.      * @var string
  345.      *
  346.      * @Column(name="customer_note", type="text", nullable=true)
  347.      */
  348.     private $customerNote;
  349.     /**
  350.      * @var int
  351.      *
  352.      * @Column(name="receive_type", type="integer")
  353.      */
  354.     private $receiveType = 0;
  355.     /**
  356.      * @var int
  357.      *
  358.      * @Column(name="return_type", type="integer")
  359.      */
  360.     private $returnType = 0;
  361.     /**
  362.      * @var int
  363.      *
  364.      * @Column(name="last_status_id", type="integer")
  365.      */
  366.     private int $lastStatusId;
  367.     /**
  368.      * @var int
  369.      *
  370.      * @Column(name="solution", type="integer")
  371.      */
  372.     private $solution = self::SOLUTION_NOT_SET;
  373.     /**
  374.      * @var int
  375.      *
  376.      * @Column(name="solution_cause", type="integer")
  377.      */
  378.     private $solutionCause = self::SOLUTION_CAUSE_NOT_SET;
  379.     /**
  380.      * @var string
  381.      *
  382.      * @Column(name="bank_account", type="string", length=64, nullable=true)
  383.      */
  384.     private $bankAccount;
  385.     /**
  386.      * @var string
  387.      *
  388.      * @Column(name="bank_account_holder", type="string", length=128, nullable=true)
  389.      */
  390.     private $bankAccountHolder;
  391.     /**
  392.      * @var array
  393.      *
  394.      * @Column(name="withdrawal_reason", type="array")
  395.      */
  396.     private $withdrawalReason = [];
  397.     /**
  398.      * @var ArrayCollection
  399.      *
  400.      * @OneToMany(targetEntity="ClaimStatus", mappedBy="claim", orphanRemoval=true)
  401.      * @OrderBy({"created" = "DESC"})
  402.      **/
  403.     private $statuses;
  404.     /**
  405.      * @var ArrayCollection
  406.      * @OneToMany(targetEntity="ClaimComment", mappedBy="claim", orphanRemoval=true)
  407.      * @OrderBy({"created" = "DESC"})
  408.      **/
  409.     private $comments;
  410.     /**
  411.      * @var ArrayCollection
  412.      * @OneToMany(targetEntity="ClaimMedia", mappedBy="claim", orphanRemoval=true)
  413.      * @OrderBy({"created" = "DESC"})
  414.      **/
  415.     private $medias;
  416.     /**
  417.      * @var int
  418.      *
  419.      * @Column(name="incoming_packeta_branch_id", type="integer", nullable=true)
  420.      */
  421.     private $incomingPacketaBranchId;
  422.     /**
  423.      * @var string
  424.      *
  425.      * @Column(name="incoming_packeta_branch_label", type="string", length=128, nullable=true)
  426.      */
  427.     private $incomingPacketaBranchLabel;
  428.     /**
  429.      * @var bool
  430.      *
  431.      * @Column(name="test", type="boolean")
  432.      */
  433.     private $test = false;
  434.     /**
  435.      * @var ArrayCollection
  436.      *
  437.      * @OneToMany(targetEntity="ClaimTest", mappedBy="claim", orphanRemoval=true)
  438.      * @OrderBy({"created" = "DESC"})
  439.      **/
  440.     private $tests;
  441.     /**
  442.      * @var bool
  443.      *
  444.      * @Column(name="error", type="boolean")
  445.      */
  446.     private $error = false;
  447.     /**
  448.      * @var ArrayCollection
  449.      *
  450.      * @OneToMany(targetEntity="ClaimError", mappedBy="claim", orphanRemoval=true)
  451.      * @OrderBy({"created" = "DESC"})
  452.      **/
  453.     private $errors;
  454.     /**
  455.      * @var \DateTime
  456.      *
  457.      * @Column(name="refund_date", type="datetime", nullable=true)
  458.      */
  459.     private $refundDate;
  460.     /**
  461.      * @var Order
  462.      *
  463.      * @ManyToOne(targetEntity="Order", inversedBy="claims")
  464.      * @JoinColumn(name="order_id", referencedColumnName="id", nullable=true)
  465.      */
  466.     private $order;
  467.     /**
  468.      * @var Order|null
  469.      *
  470.      * @ManyToOne(targetEntity="Order")
  471.      * @JoinColumn(name="replacement_order_id", referencedColumnName="id", nullable=true)
  472.      */
  473.     private $replacementOrder = null;
  474.     /**
  475.      * @var string
  476.      *
  477.      * @Column(name="credit_note_numbers", type="text", nullable=true)
  478.      */
  479.     private $creditNoteNumbers;
  480.     /**
  481.      * @var string
  482.      *
  483.      * @Column(name="job_description", type="text", nullable=true)
  484.      */
  485.     private $jobDescription;
  486.     /**
  487.      * @var string
  488.      *
  489.      * @Column(name="parcel_import_link", type="text", nullable=true)
  490.      */
  491.     private $parcelImportLink;
  492.     /**
  493.      * @var string
  494.      *
  495.      * @Column(name="parcel_export_link", type="text", nullable=true)
  496.      */
  497.     private $parcelExportLink;
  498.     /**
  499.      * @var int
  500.      *
  501.      * @Column(name="selected_parcel", type="integer", nullable=true)
  502.      */
  503.     private $selectedParcel;
  504.     /**
  505.      * @var int
  506.      *
  507.      * @Column(name="selected_import_parcel", type="integer", nullable=true)
  508.      */
  509.     private $selectedImportParcel;
  510.     /**
  511.      * @var int
  512.      *
  513.      * @Column(name="box_count", type="integer")
  514.      */
  515.     private $boxCount = 0;
  516.     /**
  517.      * @var int
  518.      *
  519.      * @Column(name="import_box_count", type="integer")
  520.      */
  521.     private $importBoxCount = 0;
  522.     /**
  523.      * @var string
  524.      *
  525.      * @Column(name="dhlShipmentNumber", type="string", length=256, nullable=true)
  526.      */
  527.     private $dhlShipmentNumber;
  528.     /**
  529.      * @var string
  530.      *
  531.      * @Column(name="fedex_shipment_number", type="string", length=256, nullable=true)
  532.      */
  533.     private $fedexShipmentNumber;
  534.     /**
  535.      * @var string
  536.      *
  537.      * @Column(name="importDhlShipmentNumber", type="string", length=256, nullable=true)
  538.      */
  539.     private $importDhlShipmentNumber;
  540.     /**
  541.      * @var string
  542.      *
  543.      * @Column(name="importFedexShipmentNumber", type="string", length=256, nullable=true)
  544.      */
  545.     private $importFedexShipmentNumber;
  546.     /**
  547.      * @var string
  548.      *
  549.      * @Column(name="shipping_packeta_branch_id", type="string", nullable=true)
  550.      */
  551.     private $shippingPacketaBranchId;
  552.     /**
  553.      * @var string
  554.      *
  555.      * @Column(name="shipping_packeta_branch_label", type="string", length=128, nullable=true)
  556.      */
  557.     private $shippingPacketaBranchLabel;
  558.     /**
  559.      * @var PickupPoint
  560.      *
  561.      * @ManyToOne(targetEntity="PickupPoint", inversedBy="claims")
  562.      * @JoinColumn(name="pickup_point_id", referencedColumnName="id", nullable=true)
  563.      */
  564.     private $pickupPoint;
  565.     /**
  566.      * @var ArrayCollection
  567.      *
  568.      * @OneToMany(targetEntity="OrderPackage", mappedBy="claim", orphanRemoval=true)
  569.      * @OrderBy({"created" = "ASC"})
  570.      **/
  571.     private $orderPackages;
  572.     /**
  573.      * @var bool
  574.      *
  575.      * @Column(name="legitimate", type="boolean", nullable=true)
  576.      */
  577.     private $legitimate = null;
  578.     /**
  579.      * @var string
  580.      *
  581.      * @Column(name="country", type="string", length=2, nullable=true)
  582.      */
  583.     private $country;
  584.     /**
  585.      * @var float
  586.      *
  587.      * @Column(name="partial_refund", type="decimal", precision=10, scale=2, nullable=true)
  588.      */
  589.     private $partialRefund = 0;
  590.     /**
  591.      * @var \DateTime
  592.      *
  593.      * @Column(name="deadline", type="datetime", nullable=true)
  594.      */
  595.     private $deadline;
  596.     /**
  597.      * @var bool
  598.      *
  599.      * @Column(name="priority", type="boolean", nullable=false)
  600.      */
  601.     private $priority = false;
  602.     /**
  603.      * Claim constructor.
  604.      */
  605.     public function __construct()
  606.     {
  607.         parent::__construct();
  608.         $this->statuses = new ArrayCollection();
  609.         $this->comments = new ArrayCollection();
  610.         $this->tests = new ArrayCollection();
  611.         $this->errors = new ArrayCollection();
  612.     }
  613.     /**
  614.      * @return int
  615.      */
  616.     public function getType(): int
  617.     {
  618.         return $this->type;
  619.     }
  620.     /**
  621.      * @param int $type
  622.      */
  623.     public function setType(int $type)
  624.     {
  625.         $this->type = $type;
  626.     }
  627.     /**
  628.      * @return string
  629.      */
  630.     public function getCode(): string
  631.     {
  632.         return $this->code;
  633.     }
  634.     /**
  635.      * @param string $code
  636.      */
  637.     public function setCode($code)
  638.     {
  639.         $this->code = $code;
  640.     }
  641.     /**
  642.      * @return Customer
  643.      */
  644.     public function getCustomer()
  645.     {
  646.         return $this->customer;
  647.     }
  648.     /**
  649.      * @param Customer $customer
  650.      */
  651.     public function setCustomer($customer)
  652.     {
  653.         $this->customer = $customer;
  654.     }
  655.     /**
  656.      * @return Document
  657.      */
  658.     public function getDocument()
  659.     {
  660.         return $this->document;
  661.     }
  662.     /**
  663.      * @param Document $document
  664.      */
  665.     public function setDocument($document)
  666.     {
  667.         $this->document = $document;
  668.     }
  669.     /**
  670.      * @return Document
  671.      */
  672.     public function getCreditNote()
  673.     {
  674.         return $this->creditNote;
  675.     }
  676.     /**
  677.      * @param Document $document
  678.      */
  679.     public function setCreditNote($document)
  680.     {
  681.         $this->creditNote = $document;
  682.     }
  683.     /**
  684.      * @return Product
  685.      */
  686.     public function getProduct()
  687.     {
  688.         return $this->product;
  689.     }
  690.     /**
  691.      * @param Product $product
  692.      */
  693.     public function setProduct($product)
  694.     {
  695.         $this->product = $product;
  696.     }
  697.     /**
  698.      * @return string
  699.      */
  700.     public function getInvoiceCode()
  701.     {
  702.         return $this->invoiceCode;
  703.     }
  704.     /**
  705.      * @param string $invoiceCode
  706.      */
  707.     public function setInvoiceCode($invoiceCode)
  708.     {
  709.         $this->invoiceCode = $invoiceCode;
  710.     }
  711.     /**
  712.      * @return string
  713.      */
  714.     public function getFirstName()
  715.     {
  716.         return $this->firstName;
  717.     }
  718.     /**
  719.      * @param string $firstName
  720.      */
  721.     public function setFirstName($firstName)
  722.     {
  723.         $this->firstName = $firstName;
  724.     }
  725.     /**
  726.      * @return string
  727.      */
  728.     public function getLastName()
  729.     {
  730.         return $this->lastName;
  731.     }
  732.     /**
  733.      * @param string $lastName
  734.      */
  735.     public function setLastName($lastName)
  736.     {
  737.         $this->lastName = $lastName;
  738.     }
  739.     /**
  740.      * @return string
  741.      */
  742.     public function getBusinessName()
  743.     {
  744.         return $this->businessName;
  745.     }
  746.     /**
  747.      * @param string $businessName
  748.      */
  749.     public function setBusinessName($businessName)
  750.     {
  751.         $this->businessName = $businessName;
  752.     }
  753.     /**
  754.      * @return string
  755.      */
  756.     public function getStreet()
  757.     {
  758.         return $this->street;
  759.     }
  760.     /**
  761.      * @param string $street
  762.      */
  763.     public function setStreet($street)
  764.     {
  765.         $this->street = $street;
  766.     }
  767.     /**
  768.      * @return string
  769.      */
  770.     public function getCity()
  771.     {
  772.         return $this->city;
  773.     }
  774.     /**
  775.      * @param string $city
  776.      */
  777.     public function setCity($city)
  778.     {
  779.         $this->city = $city;
  780.     }
  781.     /**
  782.      * @return string
  783.      */
  784.     public function getZip()
  785.     {
  786.         return $this->zip;
  787.     }
  788.     /**
  789.      * @param string $zip
  790.      */
  791.     public function setZip($zip)
  792.     {
  793.         $this->zip = $zip;
  794.     }
  795.     /**
  796.      * @return string
  797.      */
  798.     public function getEmail()
  799.     {
  800.         return $this->email;
  801.     }
  802.     /**
  803.      * @param string $email
  804.      */
  805.     public function setEmail($email)
  806.     {
  807.         $this->email = $email;
  808.     }
  809.     /**
  810.      * @return string
  811.      */
  812.     public function getPhone()
  813.     {
  814.         return $this->phone;
  815.     }
  816.     /**
  817.      * @param string $phone
  818.      */
  819.     public function setPhone($phone)
  820.     {
  821.         $this->phone = $phone;
  822.     }
  823.     /**
  824.      * @return string
  825.      */
  826.     public function getSerialNumber()
  827.     {
  828.         return $this->serialNumber;
  829.     }
  830.     /**
  831.      * @param string $serialNumber
  832.      */
  833.     public function setSerialNumber($serialNumber)
  834.     {
  835.         $this->serialNumber = $serialNumber;
  836.     }
  837.     /**
  838.      * @return boolean
  839.      */
  840.     public function isCable()
  841.     {
  842.         return $this->cable;
  843.     }
  844.     /**
  845.      * @param boolean $cable
  846.      */
  847.     public function setCable($cable)
  848.     {
  849.         $this->cable = $cable;
  850.     }
  851.     /**
  852.      * @return \DateTime
  853.      */
  854.     public function getBoughtDate()
  855.     {
  856.         return $this->boughtDate;
  857.     }
  858.     /**
  859.      * @param \DateTime $boughtDate
  860.      */
  861.     public function setBoughtDate($boughtDate)
  862.     {
  863.         $this->boughtDate = $boughtDate;
  864.     }
  865.     /**
  866.      * @return \DateTime
  867.      */
  868.     public function getCourierArriveAt()
  869.     {
  870.         return $this->courierArriveAt;
  871.     }
  872.     /**
  873.      * @param \DateTime $courierArriveAt
  874.      */
  875.     public function setCourierArriveAt($courierArriveAt)
  876.     {
  877.         $this->courierArriveAt = $courierArriveAt;
  878.     }
  879.     /**
  880.      * @return \DateTime
  881.      */
  882.     public function getReceivedDate()
  883.     {
  884.         return $this->receivedDate;
  885.     }
  886.     /**
  887.      * @param \DateTime $receivedDate
  888.      */
  889.     public function setReceivedDate($receivedDate)
  890.     {
  891.         $this->receivedDate = $receivedDate;
  892.     }
  893.     /**
  894.      * @return string
  895.      */
  896.     public function getTechnicNote()
  897.     {
  898.         return $this->technicNote;
  899.     }
  900.     /**
  901.      * @param string $technicNote
  902.      */
  903.     public function setTechnicNote($technicNote)
  904.     {
  905.         $this->technicNote = $technicNote;
  906.     }
  907.     /**
  908.      * @return string
  909.      */
  910.     public function getCustomerNote()
  911.     {
  912.         return $this->customerNote;
  913.     }
  914.     /**
  915.      * @param string $customerNote
  916.      */
  917.     public function setCustomerNote($customerNote)
  918.     {
  919.         $this->customerNote = $customerNote;
  920.     }
  921.     /**
  922.      * @return int
  923.      */
  924.     public function getReceiveType()
  925.     {
  926.         return $this->receiveType;
  927.     }
  928.     /**
  929.      * @param int $receiveType
  930.      */
  931.     public function setReceiveType($receiveType)
  932.     {
  933.         $this->receiveType = $receiveType;
  934.     }
  935.     /**
  936.      * @return int
  937.      */
  938.     public function getReturnType()
  939.     {
  940.         return $this->returnType;
  941.     }
  942.     /**
  943.      * @param int $returnType
  944.      */
  945.     public function setReturnType($returnType)
  946.     {
  947.         $this->returnType = $returnType;
  948.     }
  949.     /**
  950.      * @return int
  951.      */
  952.     public function getSolution()
  953.     {
  954.         return $this->solution;
  955.     }
  956.     /**
  957.      * @param int $solution
  958.      */
  959.     public function setSolution($solution)
  960.     {
  961.         $this->solution = $solution;
  962.     }
  963.     /**
  964.      * @return int
  965.      */
  966.     public function getSolutionCause(): int
  967.     {
  968.         return $this->solutionCause;
  969.     }
  970.     /**
  971.      * @param int $solutionCause
  972.      */
  973.     public function setSolutionCause(int $solutionCause)
  974.     {
  975.         $this->solutionCause = $solutionCause;
  976.     }
  977.     /**
  978.      * @return string|null
  979.      */
  980.     public function getBankAccount(): ?string
  981.     {
  982.         return $this->bankAccount;
  983.     }
  984.     /**
  985.      * @param string|null $bankAccount
  986.      */
  987.     public function setBankAccount(?string $bankAccount)
  988.     {
  989.         $this->bankAccount = $bankAccount;
  990.     }
  991.     /**
  992.      * @return string|null
  993.      */
  994.     public function getBankAccountHolder(): ?string
  995.     {
  996.         return $this->bankAccountHolder;
  997.     }
  998.     /**
  999.      * @param string|null $bankAccountHolder
  1000.      */
  1001.     public function setBankAccountHolder(?string $bankAccountHolder)
  1002.     {
  1003.         $this->bankAccountHolder = $bankAccountHolder;
  1004.     }
  1005.     /**
  1006.      * @return array
  1007.      */
  1008.     public function getWithdrawalReason(): array
  1009.     {
  1010.         return $this->withdrawalReason;
  1011.     }
  1012.     /**
  1013.      * @param int $withdrawalReason
  1014.      */
  1015.     public function setWithdrawalReason(array $withdrawalReason)
  1016.     {
  1017.         $this->withdrawalReason = $withdrawalReason;
  1018.     }
  1019.     /**
  1020.      * @return ArrayCollection
  1021.      */
  1022.     public function getStatuses()
  1023.     {
  1024.         return $this->statuses;
  1025.     }
  1026.     /**
  1027.      * @return mixed
  1028.      */
  1029.     public function getOlderThan8DaysForClaimStatus()
  1030.     {
  1031.         $claimStatusItemArrived = ClaimStatus::STATUS_TYPE_ACCEPTED_ITEM_ARRIVED;
  1032.         return $this->statuses->filter(
  1033.             function (ClaimStatus $claimStatus) use ($claimStatusItemArrived) {
  1034.                 return (
  1035.                     $claimStatus->getStatusType() == $claimStatusItemArrived &&
  1036.                     in_array(
  1037.                         $this->statuses->first()->getStatusType(),
  1038.                         [
  1039.                             ClaimStatus::STATUS_TYPE_ACCEPTED_ITEM_ARRIVED,
  1040.                             ClaimStatus::STATUS_TYPE_IN_PROGRESS,
  1041.                             ClaimStatus::STATUS_TYPE_WAITING_FOR_PARTS,
  1042.                             ClaimStatus::STATUS_TYPE_WAITING_FOR_SALES,
  1043.                             ClaimStatus::STATUS_TYPE_WAITING_FOR_SERVIS,
  1044.                             ClaimStatus::STATUS_TYPE_WAITING_FOR_AIKEN,
  1045.                         ]
  1046.                     ) &&
  1047.                     $claimStatus->getUpdated() < (new \DateTime())->modify("-8 days")
  1048.                 );
  1049.             }
  1050.         );
  1051.     }
  1052.     /**
  1053.      * @return mixed
  1054.      */
  1055.     public function getLastStatus(): mixed
  1056.     {
  1057.         return $this->statuses->first();
  1058.     }
  1059.     /**
  1060.      * @return string
  1061.      */
  1062.     public function getProductTitle()
  1063.     {
  1064.         return $this->productTitle;
  1065.     }
  1066.     /**
  1067.      * @param string $productTitle
  1068.      */
  1069.     public function setProductTitle($productTitle)
  1070.     {
  1071.         $this->productTitle = $productTitle;
  1072.     }
  1073.     /**
  1074.      * @return int
  1075.      */
  1076.     public function getProductType()
  1077.     {
  1078.         return $this->productType;
  1079.     }
  1080.     /**
  1081.      * @param int $productType
  1082.      */
  1083.     public function setProductType($productType)
  1084.     {
  1085.         $this->productType = $productType;
  1086.     }
  1087.     /**
  1088.      * @return ArrayCollection
  1089.      */
  1090.     public function getComments()
  1091.     {
  1092.         return $this->comments;
  1093.     }
  1094.     /**
  1095.      * @return ArrayCollection
  1096.      */
  1097.     public function getMedias()
  1098.     {
  1099.         return $this->medias;
  1100.     }
  1101.     /**
  1102.      * @return int
  1103.      */
  1104.     public function getIncomingPacketaBranchId()
  1105.     {
  1106.         return $this->incomingPacketaBranchId;
  1107.     }
  1108.     /**
  1109.      * @param int $incomingPacketaBranchId
  1110.      */
  1111.     public function setIncomingPacketaBranchId(?int $incomingPacketaBranchId)
  1112.     {
  1113.         $this->incomingPacketaBranchId = $incomingPacketaBranchId;
  1114.     }
  1115.     /**
  1116.      * @return string
  1117.      */
  1118.     public function getIncomingPacketaBranchLabel()
  1119.     {
  1120.         return $this->incomingPacketaBranchLabel;
  1121.     }
  1122.     /**
  1123.      * @param string $incomingPacketaBranchLabel
  1124.      */
  1125.     public function setIncomingPacketaBranchLabel(?string $incomingPacketaBranchLabel)
  1126.     {
  1127.         $this->incomingPacketaBranchLabel = $incomingPacketaBranchLabel;
  1128.     }
  1129.     /**
  1130.      * @return bool
  1131.      */
  1132.     public function hasTest(): bool
  1133.     {
  1134.         return $this->test;
  1135.     }
  1136.     /**
  1137.      * @param bool $test
  1138.      */
  1139.     public function setTest(bool $test)
  1140.     {
  1141.         $this->test = $test;
  1142.     }
  1143.     /**
  1144.      * @return ArrayCollection
  1145.      */
  1146.     public function getTests()
  1147.     {
  1148.         return $this->tests;
  1149.     }
  1150.     /**
  1151.      * @param int $testType
  1152.      * @return null|ClaimTest
  1153.      */
  1154.     public function getClaimTestByTestType(int $testType): ?ClaimTest
  1155.     {
  1156.         foreach ($this->getTests() as $test) {
  1157.             if ($test->getTestType() == $testType) {
  1158.                 return $test;
  1159.             }
  1160.         }
  1161.         return null;
  1162.     }
  1163.     /**
  1164.      * @return bool
  1165.      */
  1166.     public function hasError(): bool
  1167.     {
  1168.         return $this->error;
  1169.     }
  1170.     /**
  1171.      * @param bool $error
  1172.      */
  1173.     public function setError(bool $error)
  1174.     {
  1175.         $this->error = $error;
  1176.     }
  1177.     /**
  1178.      * @return ArrayCollection
  1179.      */
  1180.     public function getErrors()
  1181.     {
  1182.         return $this->errors;
  1183.     }
  1184.     /**
  1185.      * @param int $errorType
  1186.      * @return null|ClaimError
  1187.      */
  1188.     public function getClaimErrorByErrorType(int $errorType): ?ClaimError
  1189.     {
  1190.         foreach ($this->getErrors() as $error) {
  1191.             if ($error->getErrorType() == $errorType) {
  1192.                 return $error;
  1193.             }
  1194.         }
  1195.         return null;
  1196.     }
  1197.     public function removeClaimError($productType)
  1198.     {
  1199.         $this->errors->removeElement($productType);
  1200.     }
  1201.     /**
  1202.      * @return \DateTime|null
  1203.      */
  1204.     public function getRefundDate(): ?\DateTime
  1205.     {
  1206.         return $this->refundDate;
  1207.     }
  1208.     /**
  1209.      * @param \DateTime|null $refundDate
  1210.      * @return void
  1211.      */
  1212.     public function setRefundDate(?\DateTime $refundDate): void
  1213.     {
  1214.         $this->refundDate = $refundDate;
  1215.     }
  1216.     /**
  1217.      * @return Order|null
  1218.      */
  1219.     public function getOrder(): ?Order
  1220.     {
  1221.         return $this->order;
  1222.     }
  1223.     /**
  1224.      * @param Order|null $order
  1225.      */
  1226.     public function setOrder(?Order $order)
  1227.     {
  1228.         $this->order = $order;
  1229.     }
  1230.     /**
  1231.      * @return Order|null
  1232.      */
  1233.     public function getReplacementOrder(): ?Order
  1234.     {
  1235.         return $this->replacementOrder;
  1236.     }
  1237.     /**
  1238.      * @param Order|null $replacementOrder
  1239.      */
  1240.     public function setReplacementOrder(?Order $replacementOrder)
  1241.     {
  1242.         $this->replacementOrder = $replacementOrder;
  1243.     }
  1244.     /**
  1245.      * @return string|null
  1246.      */
  1247.     public function getCreditNoteNumbers(): ?string
  1248.     {
  1249.         return $this->creditNoteNumbers;
  1250.     }
  1251.     /**
  1252.      * @param string|null $creditNoteNumbers
  1253.      * @return void
  1254.      */
  1255.     public function setCreditNoteNumbers(?string $creditNoteNumbers): void
  1256.     {
  1257.         $this->creditNoteNumbers = $creditNoteNumbers;
  1258.     }
  1259.     /**
  1260.      * @return string|null
  1261.      */
  1262.     public function getJobDescription(): ?string
  1263.     {
  1264.         return $this->jobDescription;
  1265.     }
  1266.     /**
  1267.      * @param string|null $jobDescription
  1268.      * @return void
  1269.      */
  1270.     public function setJobDescription(?string $jobDescription): void
  1271.     {
  1272.         $this->jobDescription = $jobDescription;
  1273.     }
  1274.     /**
  1275.      * @return string|null
  1276.      */
  1277.     public function getParcelImportLink(): ?string
  1278.     {
  1279.         return $this->parcelImportLink;
  1280.     }
  1281.     /**
  1282.      * @param string|null $parcelImportLink
  1283.      * @return void
  1284.      */
  1285.     public function setParcelImportLink(?string $parcelImportLink): void
  1286.     {
  1287.         $this->parcelImportLink = $parcelImportLink;
  1288.     }
  1289.     /**
  1290.      * @return string|null
  1291.      */
  1292.     public function getParcelExportLink(): ?string
  1293.     {
  1294.         return $this->parcelExportLink;
  1295.     }
  1296.     /**
  1297.      * @param string|null $parcelExportLink
  1298.      * @return void
  1299.      */
  1300.     public function setParcelExportLink(?string $parcelExportLink): void
  1301.     {
  1302.         $this->parcelExportLink = $parcelExportLink;
  1303.     }
  1304.     /**
  1305.      * @return string
  1306.      */
  1307.     public function getSelectedParcel()
  1308.     {
  1309.         return $this->selectedParcel;
  1310.     }
  1311.     /**
  1312.      * @param int|string $selectedParcel
  1313.      */
  1314.     public function setSelectedParcel($selectedParcel)
  1315.     {
  1316.         $this->selectedParcel = $selectedParcel;
  1317.     }
  1318.     /**
  1319.      * @return int
  1320.      */
  1321.     public function getBoxCount()
  1322.     {
  1323.         return $this->boxCount;
  1324.     }
  1325.     /**
  1326.      * @param int $boxCount
  1327.      */
  1328.     public function setBoxCount($boxCount)
  1329.     {
  1330.         $this->boxCount = $boxCount;
  1331.     }
  1332.     /**
  1333.      * @return string
  1334.      */
  1335.     public function getDhlShipmentNumber()
  1336.     {
  1337.         return $this->dhlShipmentNumber;
  1338.     }
  1339.     /**
  1340.      * @return string
  1341.      */
  1342.     public function getFedexShipmentNumber()
  1343.     {
  1344.         return $this->fedexShipmentNumber;
  1345.     }
  1346.     /**
  1347.      * @param string $dhlShipmentNumber
  1348.      */
  1349.     public function setDhlShipmentNumber($dhlShipmentNumber)
  1350.     {
  1351.         $this->dhlShipmentNumber = $dhlShipmentNumber;
  1352.     }
  1353.     /**
  1354.      * @param $fedexShipmentNumber
  1355.      * @return void
  1356.      */
  1357.     public function setFedexShipmentNumber($fedexShipmentNumber)
  1358.     {
  1359.         $this->fedexShipmentNumber = $fedexShipmentNumber;
  1360.     }
  1361.     /**
  1362.      * @return null|ArrayCollection
  1363.      */
  1364.     public function getPackages(): ?ArrayCollection
  1365.     {
  1366.         if ($this->getOrder() == null) {
  1367.             return null;
  1368.         }
  1369.         return $this->getOrder()->getPackages()->filter(function (OrderPackage $orderPackage) {
  1370.             return $orderPackage->getClaim() == $this
  1371.                 && $orderPackage->getClaimPackageType() == OrderPackage::CLAIM_PACKAGE_TYPE_NORMAL;
  1372.         });
  1373.     }
  1374.     /**
  1375.      * @return ArrayCollection|null
  1376.      */
  1377.     public function getImportPackages(): ?ArrayCollection
  1378.     {
  1379.         if ($this->getOrder() == null) {
  1380.             return null;
  1381.         }
  1382.         return $this->getOrder()->getPackages()->filter(function (OrderPackage $orderPackage) {
  1383.             return $orderPackage->getClaim() == $this
  1384.                 && $orderPackage->getClaimPackageType() == OrderPackage::CLAIM_PACKAGE_TYPE_RETURN;
  1385.         });
  1386.     }
  1387.     /**
  1388.      * @return bool
  1389.      */
  1390.     public function hasAnyPackage(): bool 
  1391.     {
  1392.         return $this->hasPackage() || $this->hasImportPackage();
  1393.     }
  1394.     /**
  1395.      * @return bool
  1396.      */
  1397.     public function hasPackage(): bool
  1398.     {
  1399.         $packages = $this->getPackages();
  1400.         if ( is_null($packages) ) {
  1401.             return false;
  1402.         }
  1403.         return $packages->count() > 0 ? true : false;
  1404.     }
  1405.     /**
  1406.      * @return int
  1407.      */
  1408.     public function hasImportPackage(): int
  1409.     {
  1410.         $packages = $this->getImportPackages();
  1411.         if ( is_null($packages) ) {
  1412.             return false;
  1413.         }
  1414.         return $packages->count() > 0 ? true : false;
  1415.     }
  1416.     /**
  1417.      * @return int
  1418.      */
  1419.     public function getShippingPacketaBranchId()
  1420.     {
  1421.         return $this->shippingPacketaBranchId;
  1422.     }
  1423.     /**
  1424.      * @param string $shippingPacketaBranchId
  1425.      */
  1426.     public function setShippingPacketaBranchId(?string $shippingPacketaBranchId)
  1427.     {
  1428.         $this->shippingPacketaBranchId = $shippingPacketaBranchId;
  1429.     }
  1430.     /**
  1431.      * @return string
  1432.      */
  1433.     public function getShippingPacketaBranchLabel()
  1434.     {
  1435.         return $this->shippingPacketaBranchLabel;
  1436.     }
  1437.     /**
  1438.      * @param string $shippingPacketaBranchLabel
  1439.      */
  1440.     public function setShippingPacketaBranchLabel(?string $shippingPacketaBranchLabel)
  1441.     {
  1442.         $this->shippingPacketaBranchLabel = $shippingPacketaBranchLabel;
  1443.     }
  1444.     /**
  1445.      * @return PickupPoint
  1446.      */
  1447.     public function getPickupPoint()
  1448.     {
  1449.         return $this->pickupPoint;
  1450.     }
  1451.     /**
  1452.      * @param PickupPoint|null $pickupPoint
  1453.      */
  1454.     public function setPickupPoint(?PickupPoint $pickupPoint)
  1455.     {
  1456.         $this->pickupPoint = $pickupPoint;
  1457.     }
  1458.     /**
  1459.      * @return void
  1460.      */
  1461.     public function setLegitimate(bool $legitimate): void
  1462.     {
  1463.         $this->legitimate = $legitimate;
  1464.     }
  1465.     /**
  1466.      * @return bool
  1467.      */
  1468.     public function isLegitimate(): bool
  1469.     {
  1470.         return $this->legitimate;
  1471.     }
  1472.     /**
  1473.      * @return string|null
  1474.      */
  1475.     public function getCountry(): ?string
  1476.     {
  1477.         return $this->country;
  1478.     }
  1479.     /**
  1480.      * @param string|null $country
  1481.      */
  1482.     public function setCountry(?string $country)
  1483.     {
  1484.         $this->country = $country;
  1485.     }
  1486.     /**
  1487.      * @return  float
  1488.      */
  1489.     public function getPartialRefund()
  1490.     {
  1491.         return $this->partialRefund;
  1492.     }
  1493.     /**
  1494.      * @param null|float $partialRefund
  1495.      */
  1496.     public function setPartialRefund(?float $partialRefund)
  1497.     {
  1498.         $this->partialRefund = $partialRefund;
  1499.     }
  1500.     /**
  1501.      * @return \DateTime|null
  1502.      */
  1503.     public function getDeadline(): \DateTime|null
  1504.     {
  1505.         return $this->deadline;
  1506.     }
  1507.     /**
  1508.      * @param \DateTime|null $deadline
  1509.      *
  1510.      * @return void
  1511.      */
  1512.     public function setDeadline(\DateTime|null $deadline): void
  1513.     {
  1514.         $this->deadline = $deadline;
  1515.     }
  1516.     /**
  1517.      * @param Domain $domain
  1518.      *
  1519.      * @return void
  1520.      */
  1521.     public function functionSetDeadlineBasedOnDomain(Domain $domain)
  1522.     {
  1523.         if ($this->getDeadline() != null) {
  1524.             return;
  1525.         }
  1526.         $statuses = $this->getStatuses()->filter(function (ClaimStatus $claimStatus){
  1527.             if ($claimStatus->getStatusType() == ClaimStatus::STATUS_TYPE_ACCEPTED_ITEM_ARRIVED){
  1528.                 return $claimStatus;
  1529.             }
  1530.         });
  1531.         if ($statuses->count() == 0) {
  1532.             $this->setDeadline(null);
  1533.             return;
  1534.         }
  1535.         $createdDate = $statuses->first()->getCreated();
  1536.         if ($domain->getId() == Domain::DOMAIN_ID_B2C_EU) {
  1537.             $deadline = $createdDate->modify('+2 days');
  1538.         }
  1539.         else {
  1540.             $deadline = $createdDate->modify('+8 day');
  1541.         }
  1542.         $this->setDeadline($deadline);
  1543.     }
  1544.     /**
  1545.      * @return bool
  1546.      */
  1547.     public function isPriority(): bool
  1548.     {
  1549.         return $this->priority;
  1550.     }
  1551.     /**
  1552.      * @param bool $priority
  1553.      *
  1554.      * @return void
  1555.      */
  1556.     public function setPriority(bool $priority): void
  1557.     {
  1558.         $this->priority = $priority;
  1559.     }
  1560.     /**
  1561.      * @return int
  1562.      */
  1563.     public function getSelectedImportParcel(): int|null
  1564.     {
  1565.         return $this->selectedImportParcel;
  1566.     }
  1567.     /**
  1568.      * @param int $selectedImportParcel
  1569.      *
  1570.      * @return void
  1571.      */
  1572.     public function setSelectedImportParcel(int|null $selectedImportParcel): void
  1573.     {
  1574.         $this->selectedImportParcel = $selectedImportParcel;
  1575.     }
  1576.     /**
  1577.      * @return string
  1578.      */
  1579.     public function getImportFedexShipmentNumber(): string|null
  1580.     {
  1581.         return $this->importFedexShipmentNumber;
  1582.     }
  1583.     /**
  1584.      * @param string $importFedexShipmentNumber
  1585.      *
  1586.      * @return void
  1587.      */
  1588.     public function setImportFedexShipmentNumber(string|null $importFedexShipmentNumber): void
  1589.     {
  1590.         $this->importFedexShipmentNumber = $importFedexShipmentNumber;
  1591.     }
  1592.     /**
  1593.      * @return string
  1594.      */
  1595.     public function getImportDhlShipmentNumber(): string|null
  1596.     {
  1597.         return $this->importDhlShipmentNumber;
  1598.     }
  1599.     /**
  1600.      * @param string $importDhlShipmentNumber
  1601.      *
  1602.      * @return void
  1603.      */
  1604.     public function setImportDhlShipmentNumber(string|null $importDhlShipmentNumber): void
  1605.     {
  1606.         $this->importDhlShipmentNumber = $importDhlShipmentNumber;
  1607.     }
  1608.     /**
  1609.      * @return int
  1610.      */
  1611.     public function getImportBoxCount(): int
  1612.     {
  1613.         return $this->importBoxCount;
  1614.     }
  1615.     /**
  1616.      * @param int $importBoxCount
  1617.      *
  1618.      * @return void
  1619.      */
  1620.     public function setImportBoxCount(int $importBoxCount): void
  1621.     {
  1622.         $this->importBoxCount = $importBoxCount;
  1623.     }
  1624.     /**
  1625.      * @return int
  1626.      */
  1627.     public function getLastStatusId(): int
  1628.     {
  1629.         return $this->lastStatusId;
  1630.     }
  1631.     /**
  1632.      * @param int $lastStatusId
  1633.      * @return void
  1634.      */
  1635.     public function setLastStatusId(int $lastStatusId): void
  1636.     {
  1637.         $this->lastStatusId = $lastStatusId;
  1638.     }
  1639.     /**
  1640.      * @return string|null
  1641.      */
  1642.     public function getClaimFedexShipmentNumber(): ?string
  1643.     {
  1644.         return $this->getSetting(ClaimSetting::TYPE_CLAIM_FEDEX_TRACKING_NUMBER)?->getValue();
  1645.     }
  1646.     /**
  1647.      * @return string|null
  1648.      */
  1649.     public function getClaimImportFedexShipmentNumber(): ?string
  1650.     {
  1651.         return $this->getSetting(ClaimSetting::TYPE_CLAIM_IMPORT_FEDEX_TRACKING_NUMBER)?->getValue();
  1652.     }
  1653.     /**
  1654.      * @param int $settingCode
  1655.      *
  1656.      * @return ClaimSetting|null
  1657.      */
  1658.     private function getSetting(int $settingCode): ?ClaimSetting
  1659.     {
  1660.         foreach ($this->settings as $setting) {
  1661.             if ($setting->getType() == $settingCode) {
  1662.                 return $setting;
  1663.             }
  1664.         }
  1665.         return null;
  1666.     }
  1667. }