<?php

namespace App\Models;

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

class GuideScheme extends BaseModel
{
    use HasFactory;

    const GUIDE_STATUS_YES = 1;
    const GUIDE_STATUS_NO = 0;

    protected function scheme(): Attribute
    {
        return Attribute::make(
            get: function (?string $value) {
                if (is_string($value) && !empty($value)) {
                    return json_decode($value);
                }
                return [];
            }
        );
    }
}
