<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;

class HomeSection extends Model
{
    use HasFactory;

    protected $fillable = [
        'key',
        'badge_text_en',
        'badge_text_ar',
        'title_line_1_en',
        'title_line_1_ar',
        'title_connector_en',
        'title_connector_ar',
        'title_line_2_en',
        'title_line_2_ar',
        'heading_en',
        'heading_ar',
        'description_en',
        'description_ar',
        'content_en',
        'content_ar',
        'primary_button_text_en',
        'primary_button_text_ar',
        'primary_button_url_en',
        'primary_button_url_ar',
        'secondary_button_text_en',
        'secondary_button_text_ar',
        'secondary_button_url_en',
        'secondary_button_url_ar',
        'tertiary_button_text_en',
        'tertiary_button_text_ar',
        'tertiary_button_url_en',
        'tertiary_button_url_ar',
        'image',
        'sort_order',
        'is_active',
    ];

    protected $casts = [
        'is_active' => 'boolean',
    ];

    public const KEYS = [
        'hero',
        'service_type',
        'how_it_works',
        'swift_process',
        'nationalities',
        'about',
        'testimonials',
        'faqs',
        'contact',
        'content',
    ];

    public static function section(string $key): self
    {
        return static::firstOrCreate(['key' => $key]);
    }
}