<?php

namespace bird\classes;

require_once WD . '/modules/bird/interfaces/bird_voice_calls_client_i.php';
require_once WD . '/modules/bird/classes/bird_api_client.php';

use bird\interfaces\bird_voice_calls_client_i;

class bird_voice_calls_client extends bird_api_client implements bird_voice_calls_client_i
{
    public function createVoiceCall(string $workspaceId, string $channelId, array $payload): array|object|null
    {
        return $this->post($this->birdVoiceCallsBasePath($workspaceId, $channelId), $payload);
    }

    public function listVoiceCalls(string $workspaceId, string $channelId, array $query = []): array|object|null
    {
        return $this->get($this->birdVoiceCallsBasePath($workspaceId, $channelId), $query);
    }

    public function getVoiceCall(string $workspaceId, string $channelId, string $callId): array|object|null
    {
        return $this->get($this->birdVoiceCallPath($workspaceId, $channelId, $callId));
    }

    public function updateVoiceCall(string $workspaceId, string $channelId, string $callId, array $payload): array|object|null
    {
        return $this->patch($this->birdVoiceCallPath($workspaceId, $channelId, $callId), $payload);
    }

    public function answerVoiceCall(string $workspaceId, string $channelId, string $callId, array $payload = []): array|object|null
    {
        return $this->post($this->birdVoiceCallCommandPath($workspaceId, $channelId, $callId, 'answer'), $payload);
    }

    public function ringVoiceCall(string $workspaceId, string $channelId, string $callId, array $payload = []): array|object|null
    {
        return $this->post($this->birdVoiceCallCommandPath($workspaceId, $channelId, $callId, 'ringing'), $payload);
    }

    public function hangupVoiceCall(string $workspaceId, string $channelId, string $callId, array $payload = []): array|object|null
    {
        return $this->post($this->birdVoiceCallCommandPath($workspaceId, $channelId, $callId, 'hangup'), $payload);
    }

    public function playbackVoiceCall(string $workspaceId, string $channelId, string $callId, array $payload): array|object|null
    {
        return $this->post($this->birdVoiceCallCommandPath($workspaceId, $channelId, $callId, 'playback'), $payload);
    }

    public function sayVoiceCall(string $workspaceId, string $channelId, string $callId, array $payload): array|object|null
    {
        return $this->post($this->birdVoiceCallCommandPath($workspaceId, $channelId, $callId, 'say'), $payload);
    }

    public function gatherVoiceCall(string $workspaceId, string $channelId, string $callId, array $payload): array|object|null
    {
        return $this->post($this->birdVoiceCallCommandPath($workspaceId, $channelId, $callId, 'gather'), $payload);
    }

    public function bridgeVoiceCall(string $workspaceId, string $channelId, string $callId, array $payload): array|object|null
    {
        return $this->post($this->birdVoiceCallCommandPath($workspaceId, $channelId, $callId, 'bridge'), $payload);
    }

    public function recordVoiceCall(string $workspaceId, string $channelId, string $callId, array $payload): array|object|null
    {
        return $this->post($this->birdVoiceCallCommandPath($workspaceId, $channelId, $callId, 'record'), $payload);
    }
}
