<?php

namespace App\Http\Resources;

use App\Models\HeroSlide;
use Illuminate\Http\Request;
use Illuminate\Http\Resources\Json\JsonResource;

/**
 * @mixin HeroSlide
 */
class HeroSlideResource extends JsonResource
{
    /**
     * @return array<string, mixed>
     */
    public function toArray(Request $request): array
    {
        return [
            'id' => $this->id,
            'label' => $this->label,
            'title' => $this->title,
            'description' => $this->description,
            'media_type' => $this->media_type ?? 'image',
            'image' => $this->image,
            'video_url' => $this->video_url,
            'mobile_video_url' => $this->mobile_video_url,
            'mobile_image' => $this->mobile_image,
            'button_text' => $this->button_text,
            'button_url' => $this->button_url,
            'order_index' => $this->order_index,
            'is_active' => $this->is_active,
            'created_at' => $this->created_at?->toISOString(),
            'updated_at' => $this->updated_at?->toISOString(),
        ];
    }
}
