<?php

namespace Snaju\Inception\Api\Returns\Type;

use Snaju\Inception\Api\Returns\ApiReturn;

class ApiList extends ApiReturn
{

    protected array $list;

    /**
     * ApiList constructor.
     * @param array $list
     */
    public function __construct(array $list)
    {
        $this->list = $list;
        parent::__construct(true);
    }

    /**
     * @return array
     */
    public function getList(): array
    {
        return $this->list;
    }

    /**
     * @param array $list
     */
    public function setList(array $list): void
    {
        $this->list = $list;
    }

    public function render(int $code)
    {

        $this->return = [
            "size" => count($this->list),
            "list" => $this->list
        ];

        parent::render($code); // TODO: Change the autogenerated stub
    }


}