<?php

declare(strict_types=1);

namespace App\Controllers\Api\Admin;

use CodeIgniter\HTTP\ResponseInterface;

class ReferenceController extends BaseAdminApiController
{
    public function index(): ResponseInterface
    {
        $auth = $this->requireAdminApiAccess('references');
        if ($auth['response'] !== null) {
            return $auth['response'];
        }
        $cb = $this->cabangKantorAfterAuth($auth['actor']);
        if ($cb['response'] !== null) {
            return $cb['response'];
        }

        $this->auditAuthorized('api.admin.references.index', $auth['actor'], [
            'request' => $this->auditRequestParams(),
        ]);

        return $this->respond($this->adminApi->references($cb['kid']));
    }
}
