<?php

namespace App\Filament\Clusters\Settings\Branches;

use App\Filament\Clusters\Settings\Branches\Pages\ManageBranches;
use App\Filament\Clusters\Settings\Branches\Schemas\BranchForm;
use App\Filament\Clusters\Settings\Branches\Tables\BranchesTable;
use App\Filament\Clusters\Settings\SettingsCluster;
use App\Modules\Branch\Models\Branch;
use BackedEnum;
use Filament\Resources\Resource;
use Filament\Schemas\Schema;
use Filament\Support\Icons\Heroicon;
use Filament\Tables\Table;

class BranchResource extends Resource
{
    protected static ?string $model = Branch::class;

    protected static ?string $cluster = SettingsCluster::class;

    protected static string|BackedEnum|null $navigationIcon = Heroicon::OutlinedBuildingOffice2;

    protected static ?string $recordTitleAttribute = 'name';

    public static function getNavigationGroup(): ?string
    {
        return __('Branches and provinces');
    }

    public static function getModelLabel(): string
    {
        return __('module.branch::base.branch');
    }

    public static function getPluralModelLabel(): string
    {
        return __('module.branch::base.branches');
    }

    public static function form(Schema $schema): Schema
    {
        return BranchForm::configure($schema);
    }

    public static function table(Table $table): Table
    {
        return BranchesTable::configure($table);
    }

    public static function getPages(): array
    {
        return [
            'index' => ManageBranches::route('/'),
        ];
    }
}
