<?php

namespace interfaces;

use Exception;
use modules\virkdata\helpers\virkdata_response;

interface virkdata_i
{
    /**
     * Get company information from the virkdata module
     * @return virkdata_response The response from the virkdata module
     * @param string $search The search term to use
     * @param string $endpoint The endpoint to send the request to (e.g. "search")
     * @param array $data The data to send with the request (e.g. ["key" => "value"])
     * @return virkdata_response The response from the virkdata module
     */
    function getCompanyInformation(string $search, string $endpoint, array $data): virkdata_response;


    /**
     * Send a request to the
     * @param string $search The search term to use
     * @param string $endpoint The endpoint to send the request to (e.g. "latest")
     * @param array $data The data to send with the request (e.g. ["key" => "value"])
     * @param string $method The method to use for the request (e.g. "GET")
     * @return object The response from the virkdata module
     */
    function sendRequest(string $search, string $endpoint, array $data, string $method): object;

    /**
     * Require the module to be enabled
     * @return void
     * @throws Exception If the module is not enabled
     */
    function requireModuleEnabled(): void;


    /**
     * Require the secret key to be valid
     * @return void
     * @throws Exception If the secret key is not valid
     */
    function requireValidSecretKey(): void;

    /**
     * Send a GET request to the virkdata
     * @param string $search The search term to use
     * @param string $endpoint The endpoint to send the request to (e.g. "latest")
     * @param array $data The data to send with the request (e.g. ["key" => "value"])
     * @return object The response from the virkdata
     */
    function sendGetRequest(string $search, string $endpoint, array $data): object;
}