package com.example.petstoremobile.repositories;

import androidx.lifecycle.LiveData;

import com.example.petstoremobile.api.CategoryApi;
import com.example.petstoremobile.dtos.CategoryDTO;
import com.example.petstoremobile.dtos.PageResponse;
import com.example.petstoremobile.utils.Resource;

import javax.inject.Inject;
import javax.inject.Singleton;

@Singleton
public class CategoryRepository extends BaseRepository {
    private final CategoryApi categoryApi;

    @Inject
    public CategoryRepository(CategoryApi categoryApi) {
        super("CategoryRepository");
        this.categoryApi = categoryApi;
    }

    /**
     * Retrieves a paginated list of all product categories from the API.
     */
    public LiveData<Resource<PageResponse<CategoryDTO>>> getAllCategories(int page, int size) {
        return executeCall(categoryApi.getAllCategories(page, size));
    }
}
