<?php

namespace App\Models\Items;

use Illuminate\Database\Eloquent\Model;

class ItemDetail extends Model
{
    protected $table = 'item_details';

    protected $fillable = [
        'item_id',
        // Products 전용
        'is_sellable', 'is_purchasable', 'is_producible',
        'safety_stock', 'lead_time', 'is_variable_size',
        'product_category', 'part_type',
        'bending_diagram', 'bending_details',
        'specification_file', 'specification_file_name',
        'certification_file', 'certification_file_name',
        'certification_number', 'certification_start_date', 'certification_end_date',
        // Materials 전용
        'is_inspection', 'item_name', 'specification', 'search_tag', 'remarks',
    ];

    protected $casts = [
        'is_sellable' => 'boolean',
        'is_purchasable' => 'boolean',
        'is_producible' => 'boolean',
        'is_variable_size' => 'boolean',
        'bending_details' => 'array',
        'certification_start_date' => 'date',
        'certification_end_date' => 'date',
    ];

    public function item()
    {
        return $this->belongsTo(Item::class);
    }
}
