<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;

class ImportTemplateMapping extends Model
{
    use HasFactory;

    protected $fillable = [
        'import_template_id', 'entity', 'source_column', 'target_field', 'transform', 'apply_mode', 'options', 'position',
    ];

    protected $casts = [
        'options' => 'array',
    ];

    public function template(): BelongsTo
    {
        return $this->belongsTo(ImportTemplate::class, 'import_template_id');
    }
}
