<?php

declare(strict_types=1);

namespace App\Modules\Surveys\Domain;

class Survey
{
    /**
     * @param array<int, SurveyQuestion> $questions
     */
    public function __construct(
        private readonly string $id,
        private readonly string $tenantId,
        private readonly string $title,
        private readonly string $status,
        private readonly array $questions,
    ) {
    }

    public function id(): string
    {
        return $this->id;
    }

    public function tenantId(): string
    {
        return $this->tenantId;
    }

    public function title(): string
    {
        return $this->title;
    }

    public function status(): string
    {
        return $this->status;
    }

    /**
     * @return array<int, SurveyQuestion>
     */
    public function questions(): array
    {
        return $this->questions;
    }

    public function questionCount(): int
    {
        return count($this->questions);
    }

    public function isPublished(): bool
    {
        return $this->status === 'published';
    }

    public function isDraft(): bool
    {
        return $this->status === 'draft';
    }
}
