<?php

namespace App\Http\Resources;

use Illuminate\Http\Resources\Json\JsonResource;

class BalanceItem extends JsonResource
{
    /**
     * Transform the resource into an array.
     *
     * @param  \Illuminate\Http\Request  $request
     * @return array|\Illuminate\Contracts\Support\Arrayable|\JsonSerializable
     */
    public function toArray($request)
    {
        return [
            "cta0"          => $this->cta0,
            "cta1"          => $this->cta1,
            "ctaDT"         => $this->ctaDT,
            "maskCTA"       => $this->maskCTA,
            "nameCTA"       => $this->nameCTA,
            "montoDebe"     => number_format($this->debe, 2, ',', '.'),
            "montoHaber"    => number_format($this->haber, 2, ',', '.'),
            "montoSaldo"    => number_format(($this->debe - $this->haber), 2, ',', '.'),
        ];

    }
}
