<?php

namespace App\Http\Resources;

use Illuminate\Http\Resources\Json\JsonResource;

class AudioVisuals extends JsonResource
{
    /**
     * Classifications constructor.
     * @param $resource
     */
    public function __construct($resource)
    {
        $this->resource = $resource;
    }

    public function toArray($request)
    {
        $link = (object)[
            "url" => $this->link,
            "label" => $this->title,
            "isExternal" => true
        ];

        $image = (object)[
            "url" => $this->image,
            "alt" => $this->title
        ];
        $out = [
            'id'       => (int) $this->id,
            'link'     => $link,
            'image'    => $image,
            'title'    => $this->title,
            'subTitle' => "",
        ];

        return $out;
    }
}
