<?php

namespace Database\Factories;

use App\Models\Announcement;
use App\Models\AnnouncementMedia;
use App\Models\User;
use Illuminate\Database\Eloquent\Factories\Factory;

/**
 * @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\AnnouncementMedia>
 */
class AnnouncementMediaFactory extends Factory
{
    protected $model = AnnouncementMedia::class;

    /**
     * Define the model's default state.
     *
     * @return array<string, mixed>
     */
    public function definition(): array
    {
        return [
            'announcement_id' => Announcement::factory(),
            'partner_media_id' => PartnerMedia::factory(),
        ];
    }

    /**
     * Indicate that the announcement user is for a specific announcement.
     */
    public function forAnnouncement(Announcement $announcement): static
    {
        return $this->state(fn (array $attributes) => [
            'announcement_id' => $announcement->id,
        ]);
    }

    /**
     * Indicate that the announcement user is for a specific partner media.
     */
    public function forPartnerMedia(PartnerMedia $partnerMedia): static
    {
        return $this->state(fn (array $attributes) => [
            'partner_media_id' => $partnerMedia->id,
        ]);
    }
}
