using DeepDrftModels.DTOs;
using DeepDrftPublic.Client.Clients;
using Models.Common;
using NetBlocks.Models;

namespace DeepDrftPublic.Client.Services;

/// <summary>
/// <see cref="IReleaseDataService"/> backed by <see cref="ReleaseClient"/> (HTTP to the
/// <c>DeepDrft.API</c> backend). Used on both the SSR prerender and WASM interactive passes —
/// the release read surface is HTTP-only, so there is no separate in-process implementation.
/// </summary>
public class ReleaseClientDataService : IReleaseDataService
{
    private readonly ReleaseClient _releaseClient;

    public ReleaseClientDataService(ReleaseClient releaseClient)
    {
        _releaseClient = releaseClient;
    }

    public Task<ApiResult<PagedResult<ReleaseDto>>> GetPaged(
        string? medium,
        int page,
        int pageSize,
        string? sortColumn = null,
        bool sortDescending = false,
        string? search = null,
        string? genre = null)
        => _releaseClient.GetPaged(medium, page, pageSize, sortColumn, sortDescending, search, genre);

    public Task<ApiResult<ReleaseDto>> GetByEntryKey(string entryKey)
        => _releaseClient.GetByEntryKey(entryKey);
}
