<?php

namespace App\Services\ContentTypes;

use App\Models\ContentType;

class ContentTypeSlugResolution
{
    public function __construct(
        public readonly string $requestedSlug,
        public readonly ?ContentType $contentType = null,
        public readonly ?string $redirectSlug = null,
        public readonly bool $isVirtual = false,
        public readonly ?string $virtualType = null,
    ) {
    }

    public function found(): bool
    {
        return $this->contentType !== null || $this->isVirtual;
    }

    public function requiresRedirect(): bool
    {
        return $this->redirectSlug !== null && $this->redirectSlug !== '' && $this->redirectSlug !== $this->requestedSlug;
    }
}
