<?php
namespace Incoviba\Model\Contabilidad;

use DateTimeInterface;
use Incoviba\Common\Ideal;
use Incoviba\Model\Inmobiliaria;

class Cartola extends Ideal\Model
{
    public Inmobiliaria\Cuenta $cuenta;
    public DateTimeInterface $fecha;

    public int $cargos = 0;
    public int $abonos = 0;
    public int $saldo = 0;

    public function jsonSerialize(): mixed
    {
        return array_merge(parent::jsonSerialize(), [
            'cuenta_id' => $this->cuenta->id,
            'fecha' => $this->fecha->format('Y-m-d'),
            'cargos' => $this->cargos,
            'abonos' => $this->abonos,
            'saldo' => $this->saldo
        ]);
    }
}
