<?php
namespace Incoviba\Model\Inmobiliaria;

use Incoviba\Common\Ideal;
use Incoviba\Model;

class Agente extends Ideal\Model
{
    public ?int $rut;
    public string $descripcion;
    public ?string $contacto;
    public ?int $telefono;
    public ?string $correo;
    public ?Model\Direccion $direccion;
    public ?string $giro;
    public string $abreviacion;

    protected ?array $tiposAgentes;
    public function tipos(): ?array
    {
        if (!isset($this->tiposAgentes)) {
            $this->tiposAgentes = $this->runFactory('tipos_agentes');
        }
        return $this->tiposAgentes;
    }

    public function jsonSerialize(): mixed
    {
        return array_merge(parent::jsonSerialize(), [
            'rut' => $this->rut,
            'descripcion' => $this->descripcion,
            'contacto' => $this->contacto,
            'telefono' => $this->telefono,
            'correo' => $this->correo,
            'direccion' => $this->direccion,
            'giro' => $this->giro,
            'abreviacion' => $this->abreviacion,
        ]);
    }
}
