<?php

namespace Tests\Unit\Models;

use App\Models\PromptLandingPageAttachment;
use Tests\TestCase;

class PromptLandingPageAttachmentTest extends TestCase
{
    public function test_pdf_attachments_use_a_pdf_preview_and_badge(): void
    {
        $attachment = new PromptLandingPageAttachment([
            'original_name' => 'brief.pdf',
            'mime' => 'application/pdf',
            'kind' => 'document',
        ]);

        $this->assertTrue($attachment->isPdf());
        $this->assertSame('pdf', $attachment->previewKind());
        $this->assertSame('PDF', $attachment->badge());
    }

    public function test_image_attachments_preview_without_a_badge(): void
    {
        $attachment = new PromptLandingPageAttachment([
            'original_name' => 'hero.png',
            'mime' => 'image/png',
            'kind' => 'image',
        ]);

        $this->assertSame('image', $attachment->previewKind());
        $this->assertSame('', $attachment->badge());
    }

    public function test_text_attachments_use_a_file_preview_and_txt_badge(): void
    {
        $attachment = new PromptLandingPageAttachment([
            'original_name' => 'notes.txt',
            'mime' => 'text/plain',
            'kind' => 'document',
        ]);

        $this->assertSame('file', $attachment->previewKind());
        $this->assertSame('TXT', $attachment->badge());
    }
}
