<?php

namespace App\Models;

use App\Support\PublicStorage;
use Illuminate\Database\Eloquent\Attributes\Fillable;
use Illuminate\Database\Eloquent\Model;

#[Fillable(['title', 'slug', 'body_html', 'meta_title', 'meta_description', 'og_image_path', 'is_active'])]
class ContentPage extends Model
{
    public const TERMS = 'terms-and-conditions';
    public const FAQS = 'faqs';
    public const PRIVACY = 'privacy-policy';

    public const LOCKED_SLUGS = [
        self::TERMS,
        self::FAQS,
        self::PRIVACY,
    ];

    protected function casts(): array
    {
        return [
            'is_active' => 'boolean',
        ];
    }

    public function ogImageUrl(): ?string
    {
        return PublicStorage::url($this->og_image_path);
    }
}
