using Library.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Supabase;

namespace Library
{
    public interface ICardService
    {
        Task<List<Cards>> GetAllCardsAsync();
    }
    public class CarsService : ICardService
    {
        private readonly Client _client;

        public CarsService(Client client)
        {
            _client = client;
        }

        public async Task<List<Cards>> GetAllCardsAsync()
        {
            var response = await _client.From<Cards>().Get();
            if (response != null && response.Models != null)
            {
                return response.Models; // Возвращаем модели
            }

            return new List<Cards>();
        }
    }
}
