<?php

namespace App\Filament\Admin\Resources\QuoteResource\Pages;

use App\Enums\IconEnum;
use App\Filament\Admin\Resources\QuoteResource;
use App\Models\Quote;
use Filament\Actions;
use Filament\Actions\Action;
use Filament\Resources\Pages\EditRecord;

class EditQuote extends EditRecord
{
    protected static string $resource = QuoteResource::class;

    public function getTitle(): string|\Illuminate\Contracts\Support\Htmlable
    {
        return parent::getTitle().' '.$this->record->getKey();
    }

    protected function getHeaderActions(): array
    {
        return [
            Action::make('save')
                ->label('Save changes')
                ->action('save')
                ->icon(IconEnum::SAVE->value),

            Action::make('print')
                ->icon(IconEnum::PRINT->value)
                ->url(fn (Quote $record) => route('pdf.quote', $record))
                ->openUrlInNewTab(),

            Actions\DeleteAction::make()
                ->icon(IconEnum::TRASH->value),
        ];
    }
}
