using System.Collections.Specialized;
using System.Net;

using YandexMusic.API.Common;
using YandexMusic.API.Models.Common;
using YandexMusic.API.Models.Search;
using YandexMusic.API.Requests.Common;
using YandexMusic.API.Requests.Common.Attributes;

namespace YandexMusic.API.Requests.Search;

[YApiRequest(WebRequestMethods.Http.Get, "search")]
public class YSearchBuilder : YRequestBuilder<YResponse<YSearch>, (string searchText, YSearchType searchType, int page, int pageSize)>
{
    public YSearchBuilder(YandexMusicApi yandex, AuthStorage auth) : base(yandex, auth)
    {
    }

    protected override NameValueCollection GetQueryParams((string searchText, YSearchType searchType, int page, int pageSize) tuple)
    {
        return new NameValueCollection {
            { "text", tuple.searchText },
            { "type", tuple.searchType.ToString() },
            { "page", tuple.page.ToString() },
            { "pageSize", tuple.pageSize.ToString() }
        };
    }
}