<?php declare(strict_types=1);

namespace App\Http\Resources\Private\Websockets;

use Illuminate\Http\Request;
use Illuminate\Http\Resources\Json\JsonResource;

final class Setting extends JsonResource
{
    /**
     * @var \App\ServiceResults\Private\Websocket\Setting
     */
    public $resource;

    /**
     * Transform the resource into an array.
     *
     * @param  Request $request
     * @return array
     */
    public function toArray(Request $request): array
    {
        return [
            'key' => $this->resource->getKey(),
            'wsHost' => $this->resource->getWsHost(),
            'wsPort' => $this->resource->getWsPort(),
            'wssPort' => $this->resource->getWssPort(),
            'forceTLS' => $this->resource->isForceTLS(),
        ];
    }
}
