<?php

namespace Kylin\GameData\Models;

use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Kylin\Core\Models\BaseModel;
use Kylin\GameData\Enums\SaveAction;

class GameSaveHistory extends BaseModel
{
    protected $table = 'kylin_game_save_histories';

    protected $fillable = [
        'save_id', 'data', 'version', 'action',
    ];

    protected $casts = [
        'data' => 'array',
        'action' => SaveAction::class,
    ];

    /**
     * 所属存档
     */
    public function gameSave(): BelongsTo
    {
        return $this->belongsTo(GameSave::class, 'save_id');
    }
}
