<?php

namespace App\Models\Map;

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

class Lahan extends Model
{
    use SoftDeletes; 

    protected $table = 'map_lahan';

    protected $fillable = [
        'nama',
        'status_kepemilikan',
        'profile_id',
        'desa_kelurahan_id',
        'path',
        'luas_lahan',
        'created_by',
        'updated_by',
        'deleted_by',
    ]; 

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

    public function tanaman(): HasMany
    {
        return $this->hasMany(Tanaman::class, 'lahan_id');
    }
}
