from __future__ import annotations

from .base import SubclientBase
from ..schemas import CommandDryRunRequest, CommandDryRunResponse


class CommandsClient(SubclientBase):
    async def dryrun_commands(
        self, commands: list[CommandDryRunRequest]
    ) -> CommandDryRunResponse:
        response = await self._client.post(
            self._client.path("/commands/data/commands/dry-run"),
            json=[self._client.dump(command) for command in commands],
        )
        return self._client.parse(response, CommandDryRunResponse)

    async def commands_dryrun(
        self, commands: list[CommandDryRunRequest]
    ) -> CommandDryRunResponse:
        return await self.dryrun_commands(commands)
