<?php

namespace Tests\Unit\Resources\Messaging;

use App\Http\Resources\Messaging\MessageResource;
use App\Models\Message;
use Tests\TestCase;

class MessageResourceTest extends TestCase
{
    public function test_resource_returns_expected_shape(): void
    {
        $message = new Message([
            'id' => 1,
            'sender_id' => 2,
            'recipient_id' => 3,
            'subject' => 'Hello',
            'message' => 'Body',
            'sent_datetime' => now(),
            'read_status' => 0,
            'message_number' => 'MSG-1',
            'priority' => 'normal',
            'status' => 'sent',
            'semester' => 'Fall',
            'school_year' => '2025-2026',
        ]);

        $payload = (new MessageResource($message))->toArray(request());

        $this->assertArrayHasKey('id', $payload);
        $this->assertArrayHasKey('subject', $payload);
        $this->assertArrayHasKey('message_number', $payload);
    }
}
