<?php

namespace App\Http\Resources\Pertanian;

use Illuminate\Http\Request;
use Illuminate\Http\Resources\Json\JsonResource;
use App\Http\Resources\Wilayah\DesaKelurahanResource;

class LahanResource extends JsonResource
{
    /**
     * Transform the resource into an array.
     *
     * @return array<string, mixed>
     */
    public function toArray(Request $request): array
    {
        return [
            'id' => $this->id,
            'nama' => $this->nama,
            'status_kepemilikan' => $this->status_kepemilikan,
            'profile_id' => $this->profile_id,
            'desa_kelurahan' => $this->desaKelurahan ? new DesaKelurahanResource($this->desaKelurahan) : null,
            'path' => $this->path,
            'luas_lahan' => $this->luas_lahan,
            'keluarga_pengelola_id' => $this->keluarga_pengelola_id,
            'adat_pemilik_id' => $this->adat_pemilik_id,
        ];
    }
}
