<?php

namespace App\Http\Resources\Realty;

use Illuminate\Http\Request;
use Illuminate\Http\Resources\Json\JsonResource;

class PaymentPlansResource extends JsonResource
{
    /**
     * Transform the resource into an array.
     *
     * @return array<string, mixed>
     */
    public function toArray(Request $request): array
    {
        return [
            'id' => $this->id,
            'date' => $this->date,
            'amount' => $this->amount,
            'type'=> $this->type,
            'is_paid'=> $this->is_paid,
            'sales_id' => $this->sales_id,
            'quote_id'=> $this->quote_id,
            'property_title'=> $this->sales->property->first()->title
        ];
    }
}
