<?php

namespace Database\Factories;

use App\Models\TeamMember;
use App\Models\TeamMemberAvailability;
use Illuminate\Database\Eloquent\Factories\Factory;
use Illuminate\Support\Str;

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

    /**
     * Define the model's default state.
     *
     * @return array<string, mixed>
     */
    public function definition(): array
    {
        return [
            'id' => (string) Str::uuid(),
            'team_member_id' => TeamMember::factory(),
            'date' => now()->toDateString(),
            'availability' => 1.0,
        ];
    }

    public function forDate(string $date): static
    {
        return $this->state(fn (array $attributes) => ['date' => $date]);
    }

    public function availability(float $value): static
    {
        return $this->state(fn (array $attributes) => ['availability' => $value]);
    }
}
