1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/* |
4
|
|
|
* This file is part of the Neutrino package. |
5
|
|
|
* |
6
|
|
|
* (c) Vasil Dakov <[email protected]> |
7
|
|
|
* |
8
|
|
|
* For the full copyright and license information, please view the LICENSE |
9
|
|
|
* file that was distributed with this source code. |
10
|
|
|
*/ |
11
|
|
|
|
12
|
|
|
declare(strict_types=1); |
13
|
|
|
|
14
|
|
|
namespace VasilDakov\Speedy\Model; |
15
|
|
|
|
16
|
|
|
use DateTime; |
17
|
|
|
use VasilDakov\Speedy\Error; |
18
|
|
|
use VasilDakov\Speedy\Shipment\ShipmentAdditionalServices; |
19
|
|
|
use VasilDakov\Speedy\Shipment\ShipmentPrice; |
20
|
|
|
use JMS\Serializer\Annotation as Serializer; |
21
|
|
|
|
22
|
|
|
/** |
23
|
|
|
* Class CalculationResult |
24
|
|
|
* |
25
|
|
|
* @author Vasil Dakov <[email protected]> |
26
|
|
|
* @copyright 2009-2023 Neutrino.bg |
27
|
|
|
* @version 1.0 |
28
|
|
|
* @Serializer\AccessType("public_method") |
29
|
|
|
*/ |
30
|
|
|
class CalculationResult |
31
|
|
|
{ |
32
|
|
|
/** |
33
|
|
|
* @var int |
34
|
|
|
* @Serializer\Type("integer") |
35
|
|
|
*/ |
36
|
|
|
private int $serviceId; |
37
|
|
|
|
38
|
|
|
/** |
39
|
|
|
* @var ShipmentAdditionalServices|null |
40
|
|
|
* @Serializer\Type("VasilDakov\Speedy\Shipment\ShipmentAdditionalServices") |
41
|
|
|
*/ |
42
|
|
|
private ?ShipmentAdditionalServices $additionalServices = null; |
43
|
|
|
|
44
|
|
|
/** |
45
|
|
|
* @var ShipmentPrice |
46
|
|
|
* @Serializer\Type("VasilDakov\Speedy\Shipment\ShipmentPrice") |
47
|
|
|
*/ |
48
|
|
|
private ShipmentPrice $price; |
49
|
|
|
|
50
|
|
|
/** |
51
|
|
|
* @var DateTime |
52
|
|
|
* @Serializer\Type("DateTime<'Y-m-d'>") |
53
|
|
|
*/ |
54
|
|
|
private DateTime $pickupDate; |
55
|
|
|
|
56
|
|
|
/** |
57
|
|
|
* @var DateTime |
58
|
|
|
* @Serializer\Type("DateTime<'Y-m-d\TH:i:sP'>") |
59
|
|
|
*/ |
60
|
|
|
private DateTime $deliveryDeadline; |
61
|
|
|
|
62
|
|
|
/** |
63
|
|
|
* @var ?Error |
64
|
|
|
* @Serializer\Type("VasilDakov\Speedy\Error") |
65
|
|
|
*/ |
66
|
|
|
private ?Error $error = null; |
67
|
|
|
|
68
|
|
|
/** |
69
|
|
|
* @return int |
70
|
|
|
*/ |
71
|
1 |
|
public function getServiceId(): int |
72
|
|
|
{ |
73
|
1 |
|
return $this->serviceId; |
74
|
|
|
} |
75
|
|
|
|
76
|
|
|
/** |
77
|
|
|
* @param int $serviceId |
78
|
|
|
*/ |
79
|
1 |
|
public function setServiceId(int $serviceId): void |
80
|
|
|
{ |
81
|
1 |
|
$this->serviceId = $serviceId; |
82
|
|
|
} |
83
|
|
|
|
84
|
|
|
/** |
85
|
|
|
* @param ?ShipmentAdditionalServices $additionalServices |
86
|
|
|
*/ |
87
|
|
|
public function setAdditionalServices(?ShipmentAdditionalServices $additionalServices): void |
88
|
|
|
{ |
89
|
|
|
$this->additionalServices = $additionalServices; |
90
|
|
|
} |
91
|
|
|
|
92
|
|
|
/** |
93
|
|
|
* @return ?ShipmentAdditionalServices |
94
|
|
|
*/ |
95
|
1 |
|
public function getAdditionalServices(): ?ShipmentAdditionalServices |
96
|
|
|
{ |
97
|
1 |
|
return $this->additionalServices; |
98
|
|
|
} |
99
|
|
|
|
100
|
|
|
/** |
101
|
|
|
* @param ShipmentPrice $price |
102
|
|
|
*/ |
103
|
1 |
|
public function setPrice(ShipmentPrice $price): void |
104
|
|
|
{ |
105
|
1 |
|
$this->price = $price; |
106
|
|
|
} |
107
|
|
|
|
108
|
|
|
/** |
109
|
|
|
* @return ShipmentPrice |
110
|
|
|
*/ |
111
|
1 |
|
public function getPrice(): ShipmentPrice |
112
|
|
|
{ |
113
|
1 |
|
return $this->price; |
114
|
|
|
} |
115
|
|
|
|
116
|
|
|
/** |
117
|
|
|
* @param DateTime $pickupDate |
118
|
|
|
*/ |
119
|
1 |
|
public function setPickupDate(DateTime $pickupDate): void |
120
|
|
|
{ |
121
|
1 |
|
$this->pickupDate = $pickupDate; |
122
|
|
|
} |
123
|
|
|
|
124
|
|
|
/** |
125
|
|
|
* @return DateTime |
126
|
|
|
*/ |
127
|
1 |
|
public function getPickupDate(): DateTime |
128
|
|
|
{ |
129
|
1 |
|
return $this->pickupDate; |
130
|
|
|
} |
131
|
|
|
|
132
|
|
|
/** |
133
|
|
|
* @param DateTime $deliveryDeadline |
134
|
|
|
*/ |
135
|
1 |
|
public function setDeliveryDeadline(DateTime $deliveryDeadline): void |
136
|
|
|
{ |
137
|
1 |
|
$this->deliveryDeadline = $deliveryDeadline; |
138
|
|
|
} |
139
|
|
|
|
140
|
|
|
/** |
141
|
|
|
* @return DateTime |
142
|
|
|
*/ |
143
|
1 |
|
public function getDeliveryDeadline(): DateTime |
144
|
|
|
{ |
145
|
1 |
|
return $this->deliveryDeadline; |
146
|
|
|
} |
147
|
|
|
|
148
|
|
|
/** |
149
|
|
|
* @param Error|null $error |
150
|
|
|
*/ |
151
|
|
|
public function setError(?Error $error): void |
152
|
|
|
{ |
153
|
|
|
$this->error = $error; |
154
|
|
|
} |
155
|
|
|
|
156
|
|
|
/** |
157
|
|
|
* @return Error|null |
158
|
|
|
*/ |
159
|
1 |
|
public function getError(): ?Error |
160
|
|
|
{ |
161
|
1 |
|
return $this->error; |
162
|
|
|
} |
163
|
|
|
} |
164
|
|
|
|