<?php

namespace App\Http\Resources;

use Illuminate\Http\Resources\Json\JsonResource;

use App\Http\Resources\EntidadLite as EntidadLiteResources;
use App\Http\Resources\CuotaCond as CuotaCondResources;

class CuotaE extends JsonResource
{
    /**
     * Transform the resource into an array.
     *
     * @param  \Illuminate\Http\Request  $request
     * @return array
     */
    public function toArray($request)
    {
        return [
            'entidad'       => new EntidadLiteResources($this->entidad),
            'sumBS_cobro'   => number_format($this->sumBS_cobro, 2, ',', '.'),
            'sumBS'         => number_format($this->sumBS, 2, ',', '.'),
            'sumUSD'        => '$'.number_format($this->sumUSD, 2, ',', '.'),
            'cuotasCond'    => CuotaCondResources::collection($this->cuotasCond),
            'cuotasE'       => CuotaE::collection($this->cuotasE),
        ];
    }
}
