<?php

namespace App\Models\Map;

use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;

class Tanaman extends Model
{
    use SoftDeletes; 

    protected $table = 'map_tanaman';

    protected $fillable = [
        'nama',
        'komoditas_id',
        'profile_id',
        'lahan_id',
        'latitude',
        'longitude',
        'kondisi_tanaman',
        'created_by',
        'updated_by',
        'deleted_by',
    ]; 

    protected function casts(): array
    {
        return [
            'kondisi_tanaman' => \App\Enums\KondisiTanaman::class,
        ];
    }

    public function komoditas()
    {
        return $this->belongsTo(Komoditas::class, 'komoditas_id');
    }

}
