namespace NetinaShop.AdminPanel.PWA.Services.RestServices;

public class RestWrapper : IRestWrapper
{

    private static RefitSettings setting = new RefitSettings(new NewtonsoftJsonContentSerializer(new JsonSerializerSettings
    {
        Formatting = Newtonsoft.Json.Formatting.Indented,
        ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Ignore,

    }));

    public ICrudApiRest<T, TKey> CrudApiRest<T, TKey>(string address) where T : class
    {
        return RestService.For<ICrudApiRest<T, TKey>>(address, setting);
    }
    public ICrudDtoApiRest<T, TDto, TKey> CrudDtoApiRest<T, TDto, TKey>(string address) where T : class where TDto : class
    {
        return RestService.For<ICrudDtoApiRest<T, TDto, TKey>>(address, setting);
    }
    public IAuthRestApi AuthRestApi => RestService.For<IAuthRestApi>(Address.AuthController, setting);
    public IUserRestApi UserRestApi => RestService.For<IUserRestApi>(Address.UserController, setting);
    public IProductCategoryRestApi ProductCategoryRestApi => RestService.For<IProductCategoryRestApi>(Address.ProductCategoryController, setting);
    public IProductRestApi ProductRestApi => RestService.For<IProductRestApi>(Address.ProductController, setting);
    public IBrandRestApi BrandRestApi => RestService.For<IBrandRestApi>(Address.BrandController, setting);
    public IFileRestApi FileRestApi => RestService.For<IFileRestApi>(Address.FileController, setting);
    public IBlogRestApi BlogRestApi => RestService.For<IBlogRestApi>(Address.BlogController, setting);
    public IDiscountRestApi DiscountRest => RestService.For<IDiscountRestApi>(Address.DiscountController, setting);
    public IBlogCategoryRestApi BlogCategoryRestApi => RestService.For<IBlogCategoryRestApi>(Address.BlogCategoryController, setting);
    public IRoleRestApi RoleRestApi => RestService.For<IRoleRestApi>(Address.RoleController, setting);
    public IOrderRestApi OrderRestApi => RestService.For<IOrderRestApi>(Address.OrderController, setting);
    public IPaymentRestApi PaymentRestApi => RestService.For<IPaymentRestApi>(Address.PaymentController, setting);
    public IPageRestApi PageRestApi => RestService.For<IPageRestApi>(Address.PageController, setting);
    public IScraperRestApi ScraperRestApi => RestService.For<IScraperRestApi>(Address.ScraperController, setting);
}