- Implement automated synchronization of employees via Arcadia API (EmployeeSyncService, SynchronizeEmployeesWithArcadiaApi, FetchAndUpsertArcadiaEmployees) - Add Back-Office application settings for employee sites (Setting singleton, GetSettingsQuery, UpdateSettings, SettingsController, EmployeeSitesInputComponent.vue) - Strongly type Employee attributes using Domain Value Objects (ShopperEstablishmentCode, ShopperSiteCode, ShopperServiceCode) and Eloquent Casts - Migrate pagination from Domain to Shared\Pagination namespace across queries and inputs - Remove legacy and dead CSV employee import/export code - Restore Domain\Ports\Services\CsvGenerator interface for Regate order generation - Add comprehensive Pest unit, integration, and feature test coverage
32 lines
720 B
PHP
32 lines
720 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace Domain\Models\ValueObjects;
|
|
|
|
use Shared\DDD\Equatable;
|
|
|
|
final readonly class ShopperSiteCode implements \Stringable, Equatable
|
|
{
|
|
private const PATTERN = '/^[A-Z]{2,}$/';
|
|
|
|
public function __construct(
|
|
public readonly string $value
|
|
) {
|
|
if (! preg_match(self::PATTERN, $value)) {
|
|
throw new \DomainException(
|
|
"Invalid value '{$value}' does not match pattern " . self::PATTERN
|
|
);
|
|
}
|
|
}
|
|
|
|
public function __toString(): string
|
|
{
|
|
return $this->value;
|
|
}
|
|
|
|
public function equals(mixed $other): bool
|
|
{
|
|
return $other instanceof self && $this->value === $other->value;
|
|
}
|
|
}
|