<?php

namespace App\Resources;

use Wibiesana\Padi\Core\Resource;

class MouResource extends Resource
{
    public function toArray($request): array
    {
        return [
            'id' => $this->id,
            'company_id' => $this->company_id,
            'mou_number' => $this->mou_number,
            'agreement_date' => $this->agreement_date,
            'start_date' => $this->start_date,
            'expiry_date' => $this->expiry_date,
            'status' => $this->status,
            'file_path' => $this->file_path,

            // Relations
            'company' => $this->whenLoaded('company'),

            // Flattened Fields
            'company_name' => $this->company['name'] ?? null,

        ];
    }
}