import 'package:dio/dio.dart';
import 'package:e_commerce_training/src/model/request/base_category_request.dart';
import 'package:e_commerce_training/src/model/request/brand_request.dart';
import 'package:e_commerce_training/src/model/request/filter_request.dart';
import 'package:e_commerce_training/src/model/request/home_category_request.dart';
import 'package:e_commerce_training/src/model/request/list_product_request.dart';
import 'package:e_commerce_training/src/model/request/notification_request.dart';
import 'package:e_commerce_training/src/model/request/review_request.dart';
import 'package:e_commerce_training/src/model/request/update_notification_request.dart';
import 'package:e_commerce_training/src/model/response/base_category_response.dart';
import 'package:e_commerce_training/src/model/response/blog_response.dart';
import 'package:e_commerce_training/src/model/response/brand_response.dart';
import 'package:e_commerce_training/src/model/response/catalog_response.dart';
import 'package:e_commerce_training/src/model/response/category.dart';
import 'package:e_commerce_training/src/model/response/common_response.dart';
import 'package:e_commerce_training/src/model/response/detail_category_response.dart';
import 'package:e_commerce_training/src/model/response/detail_page_response.dart';
import 'package:e_commerce_training/src/model/response/home_category_response.dart';
import 'package:e_commerce_training/src/model/response/list_cart.dart';
import 'package:e_commerce_training/src/model/response/list_category_response.dart';
import 'package:e_commerce_training/src/model/response/list_choose_category.dart';
import 'package:e_commerce_training/src/model/response/list_community_response.dart';
import 'package:e_commerce_training/src/model/response/list_page_response.dart';
import 'package:e_commerce_training/src/model/response/list_product_response.dart';
import 'package:e_commerce_training/src/model/response/list_product_response.dart';
import 'package:e_commerce_training/src/model/response/news_response.dart';
import 'package:e_commerce_training/src/model/response/notification_response.dart';
import 'package:e_commerce_training/src/model/response/product_detail_response.dart';

import 'package:e_commerce_training/src/model/response/review_response.dart';

import 'package:e_commerce_training/src/model/response/product_suggest.dart';
import 'package:e_commerce_training/src/model/response/tag_home.dart';
import 'package:flutter/material.dart';

import 'request/login_request.dart';
import 'request/register_request.dart';
import 'request/update_user_request.dart';
import 'response/city_response.dart';
import 'package:retrofit/http.dart';
import 'package:retrofit/retrofit.dart';

import 'response/district_response.dart';
import 'response/filter_response.dart';
import 'response/home_config_response.dart';
import 'response/login_response.dart';
import 'response/user_response.dart';
import 'response/video_response.dart';
import 'response/ward_response.dart';

part 'app_api.g.dart';

@RestApi()
abstract class AppApi {
  factory AppApi(Dio dio, {String baseUrl}) = _AppApi;

  @POST("sign-in")
  Future<LoginResponse> login(@Body() LoginRequest request);

  @POST("sign-up")
  Future<LoginResponse> register(@Body() RegisterRequest request);

  @POST("update-profile")
  Future<UserResponse> updateProfile(@Body() UpdateUserRequest request);

  @GET("detail/{userToken}")
  Future<UserResponse> getDetailUser(@Path() String userToken);

  @GET("blogs/catalog")
  Future<CatalogResponse> getCatalogBlog();

  @POST("blogs/{catalogId}")
  Future<BlogResponse> getListBlogByCatalog(@Path() int catalogId, Map<String, dynamic> map);

  @GET("videos/catalog")
  Future<CatalogResponse> getCatalogVideo();

  @POST("videos/{catalogId}")
  Future<VideoResponse> getListVideoByCatalog(@Path() int catalogId, Map<String, dynamic> map);

  @POST("videos")
  Future<VideoResponse> getListVideoHome(Map<String, dynamic> map);

  @GET("cities")
  Future<CityResponse> getListCity();

  @GET("districts/{cityId}")
  Future<DistrictResponse> getListDistrict(@Path() int cityId);

  @GET("wards/{districtId}")
  Future<WardResponse> getListWard(@Path() int districtId);

  @GET("listCategory/category")
  Future<CategoryResponse> getCategory();

  @GET("listDetailCategory/detailCategoryId")
  Future<DetailCategoryResponse> getDetailCategory(@Path() int detailCategoryId);

  // Notification
  @POST("register/{deviceToken}")
  Future<CommonResponse> registerDevice(@Path() String deviceToken);

  @POST("notifications")
  Future<NotificationResponse> getListNotification(@Body() NotificationRequest request);

  @POST("update")
  Future<CommonResponse> updateNotification(@Body() UpdateNotificationRequest request);

  @GET("videos/{videoId}")
  Future<VideoResponse> getListVideo(@Path() int videoId);

  @POST("brands")
  Future<BrandResponse> getListBrand(@Body() BrandRequest request);

  @GET("news")
  Future<NewsResponse> getListNews();

  @POST("reviews")
  Future<ReviewResponse> getListReview(@Body() ReviewRequest request);

  @GET("keyword")
  Future<KeywordSuggestResponse> getListSuggestion();

  @POST("products")
  Future<ListProductResponse> getListProduct(@Body() ListProductRequest request);

  @GET("products/{productId}")
  Future<DetailProductResponse> getProductDetail(@Path() int productId);

  @POST("base-categories")
  Future<BaseCategoryResponse> getListCategory(@Body() BaseCategoryRequest request);

  @POST("filters")
  Future<FilterResponse> getListFilter(@Body() FilterRequest request);

  @POST("home-category")
  Future<HomeCategoryResponse> getListHomeCategory(@Body() HomeCategoryRequest request);

  @GET("config")
  Future<HomeConfigResponse> getHomeConfig();

  @GET("page")
  Future<ListPageResponse> getListPage();

  @GET("page/{pageId}")
  Future<DetailPageResponse> getDetailPage(@Path() int pageId);

  @GET("choose-category")
  Future<ChooseCategoryResponse> getChooseCategory();

  @GET("tag-home")
  Future<TagHomeResponse> getTagHome();

  @GET("community")
  Future<ListCommunityResponse>getListCommunity();

  @GET("list-cart-home")
  Future<ListCartResponse>getListCart();
}

