<?php

$this->layout('main', ['title' => __('Streamer/DJ Accounts'), 'manual' => true]);

/** @var App\Http\RouterInterface $router */
$props = [
    'listUrl' => (string)$router->fromHere('api:stations:streamers'),
    'scheduleUrl' => (string)$router->fromHere('api:stations:streamers:schedule'),
    'locale' => substr($customization->getLocale(), 0, 2),
    'stationTimeZone' => $station_tz,
];

/** @var App\Assets $assets */
$assets->addVueRender('Vue_StationsStreamers', '#station-streamers', $props);
?>

<div class="row">
    <div class="col-md-8">
        <div id="station-streamers"></div>
    </div>
    <div class="col-md-4">
        <div class="card">
            <div class="card-header bg-primary-dark">
                <h2 class="card-title"><?=__('Connection Information')?></h2>
            </div>
            <div class="card-body">
                <h3 class="card-title"><?=__('IceCast Clients')?></h3>
                <dl>
                    <dt class="mb-1"><?=__('Server')?>:</dt>
                    <dd><code><?=$this->e($server_url)?></code></dd>
                    <?php
                    if ($ip): ?>
                        <dd><?=__(
                                'You may need to connect directly via your IP address, which is <code>%s</code>.',
                                $ip
                            )?></dd>
                    <?php
                    endif; ?>

                    <dt class="mb-1"><?=__('Port')?>:</dt>
                    <dd><code><?=(int)$stream_port?></code></dd>

                    <dt class="mb-1"><?=__('Mount Name')?>:</dt>
                    <dd><code><?=$this->e($dj_mount_point)?></code></dd>
                </dl>

                <h3 class="card-title mt-3"><?=__('ShoutCast v1 Clients')?></h3>
                <dl>
                    <dt class="mb-1"><?=__('Server')?>:</dt>
                    <dd><code><?=$this->e($server_url)?></code></dd>
                    <?php
                    if ($ip): ?>
                        <dd><?=__(
                                'You may need to connect directly via your IP address, which is <code>%s</code>.',
                                $ip
                            )?></dd>
                    <?php
                    endif; ?>

                    <dt class="mb-1"><?=__('Port')?>:</dt>
                    <dd><code><?=__('%d (%d for some clients)', (int)$stream_port, ((int)$stream_port + 1))?></code>
                    </dd>

                    <dt class="mb-1"><?=__('Password')?>:</dt>
                    <dd>
                        <code>dj_username:dj_password</code> <?=__('or')?>
                        <code>dj_username,dj_password</code><br/>
                        <small><?=__('(DJ username and password separated by a colon or comma)')?></small>
                    </dd>
                </dl>

                <p><?=sprintf(
                        __(
                            'Setup instructions for broadcasting software are available <a href="%s" target="_blank">on the AzuraCast Wiki</a>.'
                        ),
                        'https://docs.azuracast.com/en/user-guide/streaming-software'
                    )?></p>
            </div>
        </div>
    </div>
</div>
