AbstractUser.php
1 year ago
Admin.php
7 years ago
Customer.php
1 year ago
Manager.php
7 years ago
Provider.php
2 years ago
Provider.php
314 lines
| 1 | <?php |
| 2 | |
| 3 | namespace AmeliaBooking\Domain\Entity\User; |
| 4 | |
| 5 | use AmeliaBooking\Domain\Collection\Collection; |
| 6 | use AmeliaBooking\Domain\Entity\Google\GoogleCalendar; |
| 7 | use AmeliaBooking\Domain\Entity\Outlook\OutlookCalendar; |
| 8 | use AmeliaBooking\Domain\Entity\Stripe\StripeConnect; |
| 9 | use AmeliaBooking\Domain\ValueObjects\Number\Integer\Id; |
| 10 | use AmeliaBooking\Domain\ValueObjects\String\Description; |
| 11 | use AmeliaBooking\Domain\ValueObjects\String\Email; |
| 12 | use AmeliaBooking\Domain\ValueObjects\String\Name; |
| 13 | use AmeliaBooking\Domain\ValueObjects\String\Phone; |
| 14 | |
| 15 | /** |
| 16 | * Class Provider |
| 17 | * |
| 18 | * @package AmeliaBooking\Domain\Entity\User |
| 19 | */ |
| 20 | class Provider extends AbstractUser |
| 21 | { |
| 22 | /** @var Collection */ |
| 23 | private $weekDayList; |
| 24 | |
| 25 | /** @var Collection */ |
| 26 | private $serviceList; |
| 27 | |
| 28 | /** @var Collection */ |
| 29 | private $dayOffList; |
| 30 | |
| 31 | /** @var Collection */ |
| 32 | private $specialDayList; |
| 33 | |
| 34 | /** @var Collection */ |
| 35 | private $appointmentList; |
| 36 | |
| 37 | /** @var Id */ |
| 38 | private $locationId; |
| 39 | |
| 40 | /** @var GoogleCalendar */ |
| 41 | private $googleCalendar; |
| 42 | |
| 43 | /** @var OutlookCalendar */ |
| 44 | private $outlookCalendar; |
| 45 | |
| 46 | /** @var Name */ |
| 47 | private $timeZone; |
| 48 | |
| 49 | /** @var Description */ |
| 50 | private $description; |
| 51 | |
| 52 | /** @var Id */ |
| 53 | private $badgeId; |
| 54 | |
| 55 | /** @var StripeConnect */ |
| 56 | private $stripeConnect; |
| 57 | |
| 58 | /** |
| 59 | * @param Name $firstName |
| 60 | * @param Name $lastName |
| 61 | * @param Email $email |
| 62 | * @param Phone $phone |
| 63 | * @param Collection $weekDayList |
| 64 | * @param Collection $serviceList |
| 65 | * @param Collection $dayOffList |
| 66 | * @param Collection $specialDayList |
| 67 | * @param Collection $appointmentList |
| 68 | */ |
| 69 | public function __construct( |
| 70 | Name $firstName, |
| 71 | Name $lastName, |
| 72 | Email $email, |
| 73 | Phone $phone, |
| 74 | Collection $weekDayList, |
| 75 | Collection $serviceList, |
| 76 | Collection $dayOffList, |
| 77 | Collection $specialDayList, |
| 78 | Collection $appointmentList |
| 79 | ) { |
| 80 | parent::__construct($firstName, $lastName, $email); |
| 81 | $this->phone = $phone; |
| 82 | $this->weekDayList = $weekDayList; |
| 83 | $this->serviceList = $serviceList; |
| 84 | $this->dayOffList = $dayOffList; |
| 85 | $this->specialDayList = $specialDayList; |
| 86 | $this->appointmentList = $appointmentList; |
| 87 | } |
| 88 | |
| 89 | /** |
| 90 | * Get the user type in a string form |
| 91 | */ |
| 92 | public function getType() |
| 93 | { |
| 94 | return self::USER_ROLE_PROVIDER; |
| 95 | } |
| 96 | |
| 97 | /** |
| 98 | * @return Collection |
| 99 | */ |
| 100 | public function getWeekDayList() |
| 101 | { |
| 102 | return $this->weekDayList; |
| 103 | } |
| 104 | |
| 105 | /** |
| 106 | * @param Collection $weekDayList |
| 107 | */ |
| 108 | public function setWeekDayList(Collection $weekDayList) |
| 109 | { |
| 110 | $this->weekDayList = $weekDayList; |
| 111 | } |
| 112 | |
| 113 | /** |
| 114 | * @return Collection |
| 115 | */ |
| 116 | public function getServiceList() |
| 117 | { |
| 118 | return $this->serviceList; |
| 119 | } |
| 120 | |
| 121 | /** |
| 122 | * @param Collection $serviceList |
| 123 | */ |
| 124 | public function setServiceList(Collection $serviceList) |
| 125 | { |
| 126 | $this->serviceList = $serviceList; |
| 127 | } |
| 128 | |
| 129 | /** |
| 130 | * @return Collection |
| 131 | */ |
| 132 | public function getDayOffList() |
| 133 | { |
| 134 | return $this->dayOffList; |
| 135 | } |
| 136 | |
| 137 | /** |
| 138 | * @param Collection $dayOffList |
| 139 | */ |
| 140 | public function setDayOffList(Collection $dayOffList) |
| 141 | { |
| 142 | $this->dayOffList = $dayOffList; |
| 143 | } |
| 144 | |
| 145 | /** |
| 146 | * @return Collection |
| 147 | */ |
| 148 | public function getSpecialDayList() |
| 149 | { |
| 150 | return $this->specialDayList; |
| 151 | } |
| 152 | |
| 153 | /** |
| 154 | * @param Collection $specialDayList |
| 155 | */ |
| 156 | public function setSpecialDayList(Collection $specialDayList) |
| 157 | { |
| 158 | $this->specialDayList = $specialDayList; |
| 159 | } |
| 160 | |
| 161 | /** |
| 162 | * @return Collection |
| 163 | */ |
| 164 | public function getAppointmentList() |
| 165 | { |
| 166 | return $this->appointmentList; |
| 167 | } |
| 168 | |
| 169 | /** |
| 170 | * @param Collection $appointmentList |
| 171 | */ |
| 172 | public function setAppointmentList(Collection $appointmentList) |
| 173 | { |
| 174 | $this->appointmentList = $appointmentList; |
| 175 | } |
| 176 | |
| 177 | /** |
| 178 | * @return Id |
| 179 | */ |
| 180 | public function getLocationId() |
| 181 | { |
| 182 | return $this->locationId; |
| 183 | } |
| 184 | |
| 185 | /** |
| 186 | * @param Id $locationId |
| 187 | */ |
| 188 | public function setLocationId(Id $locationId) |
| 189 | { |
| 190 | $this->locationId = $locationId; |
| 191 | } |
| 192 | |
| 193 | /** |
| 194 | * @return GoogleCalendar mixed |
| 195 | */ |
| 196 | public function getGoogleCalendar() |
| 197 | { |
| 198 | return $this->googleCalendar; |
| 199 | } |
| 200 | |
| 201 | /** |
| 202 | * @param mixed $googleCalendar |
| 203 | */ |
| 204 | public function setGoogleCalendar($googleCalendar) |
| 205 | { |
| 206 | $this->googleCalendar = $googleCalendar; |
| 207 | } |
| 208 | |
| 209 | /** |
| 210 | * @return OutlookCalendar mixed |
| 211 | */ |
| 212 | public function getOutlookCalendar() |
| 213 | { |
| 214 | return $this->outlookCalendar; |
| 215 | } |
| 216 | |
| 217 | /** |
| 218 | * @param mixed $outlookCalendar |
| 219 | */ |
| 220 | public function setOutlookCalendar($outlookCalendar) |
| 221 | { |
| 222 | $this->outlookCalendar = $outlookCalendar; |
| 223 | } |
| 224 | |
| 225 | /** |
| 226 | * @return Name |
| 227 | */ |
| 228 | public function getTimeZone() |
| 229 | { |
| 230 | return $this->timeZone; |
| 231 | } |
| 232 | |
| 233 | /** |
| 234 | * @param Name $timeZone |
| 235 | */ |
| 236 | public function setTimeZone($timeZone) |
| 237 | { |
| 238 | $this->timeZone = $timeZone; |
| 239 | } |
| 240 | |
| 241 | /** |
| 242 | * @return Description |
| 243 | */ |
| 244 | public function getDescription() |
| 245 | { |
| 246 | return $this->description; |
| 247 | } |
| 248 | |
| 249 | /** |
| 250 | * @param Description $description |
| 251 | */ |
| 252 | public function setDescription($description) |
| 253 | { |
| 254 | $this->description = $description; |
| 255 | } |
| 256 | |
| 257 | /** |
| 258 | * @return Id |
| 259 | */ |
| 260 | public function getBadgeId() |
| 261 | { |
| 262 | return $this->badgeId; |
| 263 | } |
| 264 | |
| 265 | /** |
| 266 | * @param Id $badgeId |
| 267 | */ |
| 268 | public function setBadgeId(Id $badgeId) |
| 269 | { |
| 270 | $this->badgeId = $badgeId; |
| 271 | } |
| 272 | |
| 273 | /** |
| 274 | * @return StripeConnect |
| 275 | */ |
| 276 | public function getStripeConnect() |
| 277 | { |
| 278 | return $this->stripeConnect; |
| 279 | } |
| 280 | |
| 281 | /** |
| 282 | * @param StripeConnect $stripeConnect |
| 283 | */ |
| 284 | public function setStripeConnect($stripeConnect) |
| 285 | { |
| 286 | $this->stripeConnect = $stripeConnect; |
| 287 | } |
| 288 | |
| 289 | |
| 290 | /** |
| 291 | * Returns the Provider entity fields in an array form |
| 292 | */ |
| 293 | public function toArray() |
| 294 | { |
| 295 | return array_merge( |
| 296 | parent::toArray(), |
| 297 | [ |
| 298 | 'phone' => $this->phone->getValue(), |
| 299 | 'weekDayList' => $this->weekDayList->toArray(), |
| 300 | 'serviceList' => $this->serviceList->toArray(), |
| 301 | 'dayOffList' => $this->dayOffList->toArray(), |
| 302 | 'specialDayList' => $this->specialDayList->toArray(), |
| 303 | 'locationId' => $this->getLocationId() ? $this->getLocationId()->getValue() : null, |
| 304 | 'googleCalendar' => $this->getGoogleCalendar() ? $this->getGoogleCalendar()->toArray() : null, |
| 305 | 'outlookCalendar' => $this->getOutlookCalendar() ? $this->getOutlookCalendar()->toArray() : null, |
| 306 | 'timeZone' => $this->getTimeZone() ? $this->getTimeZone()->getValue() : null, |
| 307 | 'description' => $this->getDescription() ? $this->getDescription()->getValue() : null, |
| 308 | 'badgeId' => $this->getBadgeId() ? $this->getBadgeId()->getValue() : null, |
| 309 | 'stripeConnect' => $this->getStripeConnect() ? $this->getStripeConnect()->toArray() : null, |
| 310 | ] |
| 311 | ); |
| 312 | } |
| 313 | } |
| 314 |