<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;

class DangerPointHistory extends Model
{
    /**
     * The attributes that are mass assignable.
     *
     * @var array
     */
    protected $fillable = [
        'user_id',
        'previous_code',
        'previous_axis_name',
        'previous_axis_type',
        'previous_axis_start',
        'previous_axis_end',
        'previous_distance_axis_start',
        'previous_local_name',
        'previous_lat',
        'previous_lng',
        'previous_accident_251',
        'previous_accident_251_code',
        'previous_speed_limit',
        'previous_speed_average',
        'previous_accident_possibility',
        'previous_road_guard',
        'previous_geometric_desc',
        'previous_accident_cause',
        'previous_accident_cause_suggest',
        'previous_accident_severity',
        'previous_accident_severity_suggest',
        'previous_correction_plan_done',
        'previous_correction_plan_doing',
        'previous_correction_plan_doing_desc',
        'previous_correction_plan_doing_suggest',
        'previous_signature_file',
        'previous_status',
        'previous_status_desc',
        'new_files'
    ];

    /**
     * The attributes that should be cast to native types.
     *
     * @var array
     */
    protected $casts = [
        'previous_accident_cause' => 'array',
        'previous_accident_severity' => 'array'
    ];

    public function dangerPoint()
    {
        return $this->belongsTo('App\Models\DangerPoint');
    }
}
