<?php

namespace interfaces;

use Exception;

interface shelly_i
{
    /**
     * Send a request to the shelly api
     * @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 shelly module
     */
    function sendRequest(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;

    /**
     * Require the server url to be valid
     * @return void
     * @throws Exception If the server url is not valid
     */
    function requireValidServerUrl(): void;

    /**
     * Send a POST request to the shelly
     * @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 array|object|null The response from the shelly
     */
    function sendPostRequest(string $endpoint, array $data): array|object|null;
}