<?php

declare(strict_types=1);

namespace App\Support\Tenants;

use App\Models\ManagedEnvironment;
use App\Models\ManagedEnvironmentOnboardingSession;
use App\Models\User;
use App\Support\Navigation\AdminSurfaceScope;

final readonly class TenantOperabilityContext
{
    public function __construct(
        public ManagedEnvironment $tenant,
        public ?User $actor,
        public ?int $workspaceId,
        public TenantInteractionLane $lane,
        public ?AdminSurfaceScope $pageCategory = null,
        public ?string $linkedRecordType = null,
        public ?int $linkedRecordId = null,
        public ?ManagedEnvironmentOnboardingSession $onboardingDraft = null,
        public ?string $requiredCapability = null,
        public ?ManagedEnvironment $selectedTenant = null,
    ) {}

    public static function forTenant(
        ManagedEnvironment $tenant,
        ?User $actor = null,
        ?int $workspaceId = null,
        TenantInteractionLane $lane = TenantInteractionLane::AdministrativeManagement,
        ?AdminSurfaceScope $pageCategory = null,
        ?ManagedEnvironmentOnboardingSession $onboardingDraft = null,
        ?string $requiredCapability = null,
        ?ManagedEnvironment $selectedTenant = null,
        ?string $linkedRecordType = null,
        ?int $linkedRecordId = null,
    ): self {
        return new self(
            tenant: $tenant,
            actor: $actor,
            workspaceId: $workspaceId,
            lane: $lane,
            pageCategory: $pageCategory,
            linkedRecordType: $linkedRecordType,
            linkedRecordId: $linkedRecordId,
            onboardingDraft: $onboardingDraft,
            requiredCapability: $requiredCapability,
            selectedTenant: $selectedTenant,
        );
    }
}
