<?php

namespace App\Filament\Resources\PerformanceRunPeople\Schemas;

use Filament\Forms\Components\Select;
use Filament\Forms\Components\TextInput;
use Filament\Forms\Components\Textarea;
use Filament\Forms\Components\Toggle;
use Filament\Schemas\Schema;

class PerformanceRunPersonForm
{
    public static function configure(Schema $schema): Schema
    {
        return $schema
            ->components([
                Select::make('performance_run_id')
                    ->label('上演run')
                    ->relationship('performanceRun', 'theater')
                    ->searchable()
                    ->preload()
                    ->required(),

                Select::make('performance_work_id')
                    ->label('対象作品')
                    ->relationship('performanceWork', 'id')
                    ->searchable()
                    ->preload()
                    ->nullable()
                    ->helperText('公演全体への関与なら空欄でも可'),

                Select::make('person_id')
                    ->label('人物')
                    ->relationship('person', 'name')
                    ->searchable()
                    ->preload()
                    ->required(),

                TextInput::make('category')
                    ->label('区分')
                    ->helperText('例: cast, staff, lead, director など'),

                TextInput::make('role_name')
                    ->label('役名・担当名'),

                Toggle::make('is_lead')
                    ->label('主演フラグ')
                    ->default(false),

                TextInput::make('credit_order')
                    ->label('表示順')
                    ->numeric()
                    ->default(0),

                Textarea::make('notes')
                    ->label('備考')
                    ->columnSpanFull(),
            ]);
    }
}
