import 'package:dio/dio.dart';
import 'package:farmer_client/utils/Request.dart';
import 'package:fluttertoast/fluttertoast.dart';



/**
 * banner轮播图
 * @param {*} data
 * @returns
 */
Future getHomeBanner(String position)async{
  return request('/banner',options: Options(method: 'GET'),data: { 'position': position}).catchError((error) =>
  { Fluttertoast.showToast(
      msg: error.error['message']
  ),});
  
}



/**
 * 农机列表
 * @param {*} data
 * @returns
 */
Future getMachinery(String location)async{
  return request('/machinery',options: Options(method: 'GET'),queryParameters: { 'location': location}).catchError((error) =>
  { Fluttertoast.showToast(
      msg: error.error['message']
  ),});

}



/**
 * 农机详情
 * @param {*} data
 * @returns
 */
Future getMachineryInfo(String id,String location ,bool attached)async{
  return request('/machinery-summary',options: Options(method: 'GET'),queryParameters: { 'id': id},data: {'location': location,'attached': attached}).catchError((error) =>
  { Fluttertoast.showToast(
      msg: error.error['message']
  ),});

}


/**
 * 农机分类Tab列查询
 * @param {*} data
 * @returns
 */
Future getMachineryType()async{
  return request('/machinery-type',options: Options(method: 'GET'));
}