<?php

declare(strict_types=1);

namespace App\GraphQL\Schema\Fields\Search;

use App\Contracts\GraphQL\Fields\DisplayableField;
use App\GraphQL\Schema\Fields\Field;
use App\GraphQL\Schema\Types\List\PlaylistType;
use GraphQL\Type\Definition\Type;
use Rebing\GraphQL\Support\Facades\GraphQL;

class SearchPlaylistsField extends Field implements DisplayableField
{
    public function __construct()
    {
        parent::__construct('playlists', nullable: false);
    }

    public function description(): string
    {
        return 'The playlist results of the search';
    }

    public function baseType(): Type
    {
        return Type::listOf(Type::nonNull(GraphQL::type(new PlaylistType()->name())));
    }

    public function canBeDisplayed(): bool
    {
        return true;
    }
}
