<?php

namespace App\Filament\Resources\CarShowCategoryResource\RelationManagers;

use Filament\Forms;
use Filament\Schemas\Schema;
use Filament\Resources\RelationManagers\RelationManager;
use Filament\Tables\Table;
use Filament\Tables;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\SoftDeletingScope;
use Filament\Actions\CreateAction;
use Filament\Actions\EditAction;
use Filament\Actions\DeleteAction;
use Filament\Actions\BulkActionGroup;
use Filament\Actions\DeleteBulkAction;
use Filament\Actions\DissociateAction;
use Filament\Actions\AssociateAction;
class VehicleRelationManager extends RelationManager
{
    protected static string $relationship = 'vehicle';

    protected static ?string $recordTitleAttribute = 'id';

    protected static ?string $inverseRelationship = 'vehicleType'; 

    public function form(Schema $schema): Schema
    {
        return $schema
            ->components([
                Forms\Components\TextInput::make('id')
                    ->required()
                    ->maxLength(255),
            ]);
    }

    public function table(Table $table): Table
    {
        return $table
            ->columns([
                Tables\Columns\TextColumn::make('id'),
                Tables\Columns\TextColumn::make('owner'),
                Tables\Columns\TextColumn::make('year'),
                Tables\Columns\TextColumn::make('make'),
                Tables\Columns\TextColumn::make('model'),
            ])
            ->filters([
                //
            ])
            ->recordActions([
                EditAction::make(),
                DeleteAction::make(),
                DissociateAction::make(),
            ])
            ->toolbarActions([
                CreateAction::make(),
                AssociateAction::make(),                
                BulkActionGroup::make([
                    DeleteBulkAction::make(),
                ]),
            ]);
    }    
}
