<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use OwenIt\Auditing\Contracts\Auditable;

class ImportMapField extends Model implements Auditable
{
    use HasFactory;
    use \OwenIt\Auditing\Auditable;

    protected $fillable = [
        'map_id',
        'on_file',
        'on_model',
        'is_match_key',
        'default_value',
        'is_list',
        'is_images',
        'list_separator',
        'data',
    ];

    protected $casts = [
        'is_match_key' => 'boolean',
        'is_list' => 'boolean',
        'is_images' => 'boolean',
        'data' => 'array',
    ];

    protected $hidden = [
        'created_at',
        'updated_at',
    ];

    public function importMap(): BelongsTo
    {
        return $this->belongsTo(ImportMap::class, 'map_id');
    }
}
