<?php

namespace App\Http\Resources;

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

class TransDTCobro extends JsonResource
{
    /**
     * Transform the resource into an array.
     *
     * @return array<string, mixed>
     */
    public function toArray(Request $request): array
    {
        return [
            "idDT"              => strval($this->idDT),
            "idCobro"           => strval($this->idCobro),
            "idCuota"           => strval($this->idCuota),
            "idCaja"            => strval($this->idCaja),
            "idNP"              => strval($this->idNP),
            'codEdif'           => $this->codEdif,
            'codApto'           => $this->codApto,
            'ref'               => $this->ref,

            "tDT"               => [
                'idDT'          => strval($this->idDT),
                'ctaDT'         => $this->tDT->ctaDT,
                'dhDT'          => $this->tDT->dhDh,
                'montoDT'       => $this->tDT->montoDT,
                'typeDT'        => $this->tDT->typeDT,
                'anoDT'         => $this->tDT->anoDT,
                'mesDT'         => $this->tDT->mesDT,
                'idE'           => strval($this->tDT->idE),
                'idT'           => strval($this->tDT->idT),
                'idMoneda'      => $this->tDT->idMoneda,
            ],

            "cuota"             => new CuotaView($this->cuota),
        ];
    }
}
