<?php

declare(strict_types=1);

namespace App\Filament\Resources\HomeCarouselSlides\Pages;

use App\Filament\Resources\HomeCarouselSlides\HomeCarouselSlideResource;
use Filament\Resources\Pages\CreateRecord;

class CreateHomeCarouselSlide extends CreateRecord
{
    protected static string $resource = HomeCarouselSlideResource::class;

    protected function mutateFormDataBeforeCreate(array $data): array
    {
        $data['image_path'] = $data['image_path']
            ?? $data['image_path_mobile']
            ?? $data['image_path_desktop']
            ?? null;

        return $data;
    }
}
