<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;

class TextbookSeries extends Model
{
    protected $table = 'textbook_series';

    protected $fillable = [
        'name',
        'slug',
        'publisher',
        'region',
        'stages',
        'start_year',
        'is_active',
        'sort_order',
        'meta',
    ];

    protected $casts = [
        'is_active' => 'boolean',
        // 移除 array cast，直接使用 JSON 字符串
    ];

    public function textbooks()
    {
        return $this->hasMany(Textbook::class, 'series_id', 'id');
    }
}
