<?php
namespace Bot\Commands\AdminCommands;

use Longman\TelegramBot\Commands\AdminCommand as TelegramAdminCommand;
use Longman\TelegramBot\Entities\ServerResponse;
use Longman\TelegramBot\Request;

class AdminCommand extends TelegramAdminCommand
{
    protected $name = 'admin';
    protected $description = 'Admin utility entrypoint';
    protected $usage = '/admin [help]';
    protected $version = '1.0.0';

    public function execute(): ServerResponse
    {
        $message = $this->getMessage();
        $chatId = $message->getChat()->getId();
        $subcommand = strtolower(trim($message->getText(true) ?? ''));

        if ($subcommand === '' || $subcommand === 'help') {
            return Request::sendMessage([
                'chat_id' => $chatId,
                'text'    => AdminhelpCommand::getHelpMessage(),
            ]);
        }

        return Request::sendMessage([
            'chat_id' => $chatId,
            'text'    => 'Unknown admin action. Send /admin help to view the available admin commands.',
        ]);
    }
}
