<?php

namespace App\Representation\Service;

use App\Location\Entity\City;
use App\Representation\Entity\Representation;

/** نتیجه‌ی نگاشت دامنه‌ی درخواست به زمینه‌ی سایت (شهر یا نماینده). */
final class DomainContext
{
    public function __construct(
        public readonly ?Representation $representation,
        public readonly ?City $city,
        public readonly bool $isGlobalRepresentation,
    ) {}

    public static function empty(): self
    {
        return new self(null, null, false);
    }

    public function representationId(): ?int
    {
        return $this->representation?->getId();
    }
}
