//登录
class Login {
  bool success;
  int code;
  String msg;
  LoginMap data;
  Login({
    this.success,
    this.code,
    this.msg,
    this.data,
  });

  factory Login.fromJson(Map<String, dynamic> json) {
    LoginMap tempData = LoginMap.fromJson(json['data']);
    return Login(
        success: json['success'],
        code: json['code'],
        msg: json['msg'],
        data: tempData);
  }
}

class LoginMap {
  String avatarUrl;
  String nickName;
  int roleType;
  String userId;
  int status;
  String token;
  String stationId;

  LoginMap(
      {this.userId,
      this.avatarUrl,
      this.nickName,
      this.roleType,
      this.status,
      this.token,
      this.stationId});

  factory LoginMap.fromJson(Map<String, dynamic> json) {
    return LoginMap(
        avatarUrl: json['avatarUrl'],
        nickName: json['nickName'],
        roleType: json['roleType'],
        userId: json['userId'],
        status: json['status'],
        token: json['token'],
        stationId: json['stationId'].toString());
  }
}

//接单页列表
class OrderListObj {
  bool success;
  int code;
  String msg;
  OrderListData data;

  OrderListObj({this.success, this.code, this.msg, this.data});

  factory OrderListObj.fromJson(Map<String, dynamic> json) {
    return OrderListObj(
        success: json['success'],
        code: json['code'],
        msg: json['msg'],
        data: OrderListData.fromJson(json['data']));
  }
}

class OrderListData {
  bool hasNextPage;
  List<OrderList> items;
  int limit;
  int page;
  int totalCount;
  int totalPage;

  OrderListData(
      {this.hasNextPage,
      this.items,
      this.limit,
      this.page,
      this.totalCount,
      this.totalPage});

  factory OrderListData.fromJson(Map<String, dynamic> json) {
    List list = json['items'] as List;
    List<OrderList> tempOrderList =
        list.map((i) => OrderList.fromJson(i)).toList();
    return OrderListData(
        hasNextPage: json['hasNextPage'],
        items: tempOrderList,
        limit: json['limit'],
        page: json['page'],
        totalCount: json['totalCount'],
        totalPage: json['totalPage']);
  }
}

class OrderList {
  String orderNo;
  int createTime;
  String goods;
  int goodsQuantity;
  String receiptCompanyAddress;
  String receiptCompanyName;
  String receiptCompanyPhone;
  String sendCompanyAddress;
  String sendCompanyName;
  String sendCompanyPhone;
  OrderList(
      {this.orderNo,
      this.createTime,
      this.goods,
      this.goodsQuantity,
      this.receiptCompanyAddress,
      this.receiptCompanyName,
      this.receiptCompanyPhone,
      this.sendCompanyAddress,
      this.sendCompanyName,
      this.sendCompanyPhone});

  factory OrderList.fromJson(Map<String, dynamic> json) {
    return OrderList(
        orderNo: json['orderNo'],
        createTime: json['createTime'],
        goods: json['goods'],
        goodsQuantity: json['goodsQuantity'],
        receiptCompanyAddress: json['receiptCompanyAddress'],
        receiptCompanyName: json['receiptCompanyName'],
        receiptCompanyPhone: json['receiptCompanyPhone'],
        sendCompanyAddress: json['sendCompanyAddress'],
        sendCompanyName: json['sendCompanyName'],
        sendCompanyPhone: json['sendCompanyPhone']);
  }
}

//获取站点
class Station {
  bool success;
  int code;
  String msg;
  List<StationList> data;

  Station({this.success, this.code, this.msg, this.data});

  factory Station.fromJson(Map<String, dynamic> json) {
    List list = json['data'] as List;
    print(list.toString());
    List<StationList> tempList =
        list.map((i) => StationList.fromJson(i)).toList();
    return Station(
        success: json['success'],
        code: json['code'],
        msg: json['msg'],
        data: tempList);
  }
}

class StationList {
  String code;
  int id;
  String name;
  int stationStatus;
  int status;

  StationList({this.code, this.id, this.name, this.stationStatus, this.status});

  factory StationList.fromJson(Map<String, dynamic> json) {
    return StationList(
        code: json['code'],
        id: json['id'],
        name: json['name'],
        stationStatus: json['stationStatus'],
        status: json['status']);
  }
}

//站点线路
class StationLine {
  bool success;
  int code;
  String msg;
  List<LineObj> data;

  StationLine({this.success, this.code, this.msg, this.data});

  factory StationLine.fromJson(Map<String, dynamic> json) {
    var list = json['data'] as List;
    List<LineObj> tempList = list.map((i) => LineObj.fromJson(i)).toList();

    return StationLine(
        success: json['success'],
        code: json['code'],
        msg: json['msg'],
        data: tempList);
  }
}

class LineObj {
  String code;
  int id;
  String name;

  LineObj({this.code, this.name, this.id});

  factory LineObj.fromJson(Map<String, dynamic> json) {
    return LineObj(code: json['code'], id: json['id'], name: json['name']);
  }
}

//修改密码
class UpdataPasswrod {
  bool success;
  int code;
  String msg;
  String data;

  UpdataPasswrod({this.success, this.code, this.msg, this.data});

  factory UpdataPasswrod.fromJson(Map<String, dynamic> json) {
    return UpdataPasswrod(
        success: json['success'],
        code: json['code'],
        msg: json['msg'],
        data: json['data']);
  }
}

//手机号模糊匹配
class LikePhone {
  bool success;
  int code;
  String msg;
  List<LikePhoneList> data;

  LikePhone({this.success, this.code, this.msg, this.data});

  factory LikePhone.fromJson(Map<String, dynamic> json) {
    List list = json['data'] as List;
    List<LikePhoneList> tempList =
        list.map((i) => LikePhoneList.fromJson(i)).toList();
    return LikePhone(
        success: json['success'],
        code: json['code'],
        msg: json['msg'],
        data: tempList);
  }
}

class LikePhoneList {
  String address;
  String areaCode;
  String areaName;
  String cityCode;
  String cityName;
  String companyCode;
  String companyName;
  String companyPhone;
  int id;
  String provinceCode;
  String provinceName;
  String uzerPhone;

  LikePhoneList(
      {this.address,
      this.areaCode,
      this.areaName,
      this.cityCode,
      this.cityName,
      this.companyCode,
      this.companyName,
      this.companyPhone,
      this.id,
      this.provinceCode,
      this.provinceName,
      this.uzerPhone});

  factory LikePhoneList.fromJson(Map<String, dynamic> json) {
    return LikePhoneList(
        address: json['address'],
        areaCode: json['areaCode'],
        areaName: json['areaName'],
        cityCode: json['cityCode'],
        cityName: json['cityName'],
        companyCode: json['companyCode'],
        companyName: json['companyName'],
        companyPhone: json['companyPhone'],
        id: json['id'],
        provinceCode: json['provinceCode'],
        provinceName: json['provinceName'],
        uzerPhone: json['uzerPhone']);
  }
}

//商品类别列表
class GoodsCategory {
  bool success;
  int code;
  String msg;
  List<GoodCategoryList> data;

  GoodsCategory({this.success, this.code, this.msg, this.data});

  factory GoodsCategory.fromJson(Map<String, dynamic> json) {
    List list = json['data'] as List;
    List<GoodCategoryList> tempList =
        list.map((i) => GoodCategoryList.fromJson(i)).toList();
    return GoodsCategory(
        success: json['success'],
        code: json['code'],
        msg: json['msg'],
        data: tempList);
  }
}

class GoodCategoryList {
  int id;
  String name;

  GoodCategoryList({this.id, this.name});

  factory GoodCategoryList.fromJson(Map<String, dynamic> json) {
    return GoodCategoryList(id: json['id'], name: json['name']);
  }
}

//商品包装类别列表
class GoodsPackage {
  bool success;
  int code;
  String msg;
  List<GoodsPackageList> data;

  GoodsPackage({this.success, this.code, this.msg, this.data});

  factory GoodsPackage.fromJson(Map<String, dynamic> json) {
    List list = json['data'] as List;
    List<GoodsPackageList> tempList =
        list.map((i) => GoodsPackageList.fromJson(i)).toList();
    return GoodsPackage(
        success: json['success'],
        code: json['code'],
        msg: json['msg'],
        data: tempList);
  }
}

class GoodsPackageList {
  int id;
  String name;

  GoodsPackageList({this.id, this.name});

  factory GoodsPackageList.fromJson(Map<String, dynamic> json) {
    return GoodsPackageList(id: json['id'], name: json['name']);
  }
}

//创建订单
class CreateOrder {
  bool success;
  int code;
  String msg;
  String orderNo;

  CreateOrder({this.success, this.code, this.msg, this.orderNo});

  factory CreateOrder.fromJson(Map<String, dynamic> json) {
    return CreateOrder(
        success: json['success'],
        code: json['code'],
        msg: json['msg'],
        orderNo: json['data']['orderNo']);
  }
}

//订单详情
class OrderDetailObj {
  bool success;
  int code;
  String msg;
  OrderDetailData data;

  OrderDetailObj({
    this.success,
    this.code,
    this.msg,
    this.data,
  });

  factory OrderDetailObj.fromJson(Map<String, dynamic> json) {
    OrderDetailData tempData = OrderDetailData.fromJson(json['data']);
    return OrderDetailObj(
        success: json['success'],
        code: json['code'],
        msg: json['msg'],
        data: tempData);
  }
}

class OrderDetailData {
  String orderNo;
  String goods; //商品名称
  int goodsAgencyFund; //代收款
  int goodsFlatCost; //工本费
  int goodsFreight; //运费
  int goodsInsurance; //商品保险费
  int goodsOtherFees; //其他费用
  int goodsPriceProtection; //商品保价
  int goodsQuantity; //商品数量
  int goodsValue; //商品价值
  double goodsWeight; //商品重量
  int id; //订单Id
  String memo; //备注
  int orderStatus; //订单状态 0:代收单，1：已接单，2:配送中，3:已签收，4:拒收
  String receiptCompanyAddress; //收件详细地址
  String receiptCompanyAreaCode; //收件区码
  String receiptCompanyAreaName; //收件区名
  String receiptCompanyBankCard; //收件银行卡号
  String receiptCompanyCityCode; //收件市码
  String receiptCompanyCityName; //收件市名
  String receiptCompanyName; //收件公司名称
  String receiptCompanyPhone; //收件公司电话
  String receiptCompanyProvinceCode; //收件省码
  String receiptCompanyProvinceName; //收件省名
  String sendCompanyAddress; //发件详细地址
  String sendCompanyAreaCode; //发件区码
  String sendCompanyAreaName; //发件区名
  String sendCompanyBankCard; //发件银行卡号
  String sendCompanyCityCode; //发件市码
  String sendCompanyCityName; //发件市名
  int sendCompanyId; //发件公司id
  String sendCompanyName; //发件公司名称
  String sendCompanyCode; //发件公司编码
  String sendCompanyProvinceCode; //发件公司市码
  String sendCompanyProvinceName; //发件公司市名
  String sendCompanyPhone;
  String senderIdCard; //发件人身份证号
  String senderName; //发件人名称
  String senderPhone; //发件人电话

  OrderDetailData(
      {this.orderNo,
      this.goods,
      this.goodsAgencyFund,
      this.goodsFlatCost,
      this.goodsFreight,
      this.goodsInsurance,
      this.goodsOtherFees,
      this.goodsPriceProtection,
      this.goodsQuantity,
      this.goodsValue,
      this.goodsWeight,
      this.id,
      this.memo,
      this.orderStatus,
      this.receiptCompanyAddress,
      this.receiptCompanyAreaCode,
      this.receiptCompanyAreaName,
      this.receiptCompanyPhone,
      this.receiptCompanyBankCard,
      this.receiptCompanyCityCode,
      this.receiptCompanyCityName,
      this.receiptCompanyName,
      this.receiptCompanyProvinceCode,
      this.receiptCompanyProvinceName,
      this.sendCompanyAddress,
      this.sendCompanyAreaCode,
      this.sendCompanyAreaName,
      this.sendCompanyBankCard,
      this.sendCompanyCityCode,
      this.sendCompanyCityName,
      this.sendCompanyId,
      this.sendCompanyName,
      this.sendCompanyCode,
      this.sendCompanyProvinceCode,
      this.sendCompanyProvinceName,
      this.senderIdCard,
      this.senderName,
      this.sendCompanyPhone,
      this.senderPhone});

  factory OrderDetailData.fromJson(Map<String, dynamic> json) {
    return OrderDetailData(
        orderNo: json['orderNo'],
        goods: json['goods'],
        goodsAgencyFund: json['goodsAgencyFund'],
        goodsFlatCost: json['goodsFlatCost'],
        goodsFreight: json['goodsFreight'],
        goodsInsurance: json['goodsInsurance'],
        goodsOtherFees: json['goodsOtherFees'],
        goodsPriceProtection: json['goodsPriceProtection'],
        goodsQuantity: json['goodsQuantity'],
        goodsValue: json['goodsValue'],
        goodsWeight: json['goodsWeight'],
        id: json['id'],
        memo: json['memo'],
        orderStatus: json['orderStatus'],
        receiptCompanyAddress: json['receiptCompanyAddress'],
        receiptCompanyAreaCode: json['receiptCompanyAreaCode'],
        receiptCompanyAreaName: json['receiptCompanyAreaName'],
        receiptCompanyBankCard: json['receiptCompanyBankCard'],
        receiptCompanyCityCode: json['receiptCompanyCityCode'],
        receiptCompanyCityName: json['receiptCompanyCityName'],
        receiptCompanyName: json['receiptCompanyName'],
        receiptCompanyPhone: json['receiptCompanyPhone'],
        receiptCompanyProvinceCode: json['receiptCompanyProvinceCode'],
        receiptCompanyProvinceName: json['receiptCompanyProvinceName'],
        sendCompanyAddress: json['sendCompanyAddress'],
        sendCompanyAreaCode: json['sendCompanyAreaCode'],
        sendCompanyAreaName: json['sendCompanyAreaName'],
        sendCompanyBankCard: json['sendCompanyBankCard'],
        sendCompanyCityCode: json['sendCompanyCityCode'],
        sendCompanyCityName: json['sendCompanyCityName'],
        sendCompanyId: json['sendCompanyId'],
        sendCompanyName: json['sendCompanyName'],
        sendCompanyCode: json['sendCompanyCode'],
        sendCompanyProvinceCode: json['sendCompanyProvinceCode'],
        sendCompanyProvinceName: json['sendCompanyProvinceName'],
        senderIdCard: json['senderIdCard'],
        senderName: json['senderName'],
        senderPhone: json['senderPhone'],
        sendCompanyPhone:json['sendCompanyPhone']
        );
        
  }
}

//接单对象
class OrderReception {
  bool success;
  int code;
  String msg;

  OrderReception({
    this.success,
    this.code,
    this.msg,
  });

  factory OrderReception.fromJson(Map<String, dynamic> json) {
    return OrderReception(
      success: json['success'],
      code: json['code'],
      msg: json['msg'],
    );
  }
}

//订单管理获取列表
class FromStatusGetOrderObj {
  bool success;
  int code;
  String msg;
  FromStatusGetOrderData data;

  FromStatusGetOrderObj({this.success, this.code, this.msg, this.data});

  factory FromStatusGetOrderObj.fromJson(Map<String, dynamic> json) {
    return FromStatusGetOrderObj(
        success: json['success'],
        code: json['code'],
        msg: json['msg'],
        data: FromStatusGetOrderData.fromJson(json['data']));
  }
}

class FromStatusGetOrderData {
  bool hasNextPage;
  List<FromStatusGetOrderList> items;
  int limit;
  int page;
  int totalCount;
  int totalPage;

  FromStatusGetOrderData({
    this.hasNextPage,
    this.items,
    this.limit,
    this.page,
    this.totalCount,
    this.totalPage,
  });

  factory FromStatusGetOrderData.fromJson(Map<String, dynamic> json) {
    List list = json['items'] as List;
    List<FromStatusGetOrderList> tempList =
        list.map((i) => FromStatusGetOrderList.fromJson(i)).toList();
    return FromStatusGetOrderData(
      hasNextPage: json['hasNextPage'],
      items: tempList,
      limit: json['limit'],
      page: json['page'],
      totalCount: json['totalCount'],
      totalPage: json['totalPage'],
    );
  }
}

class FromStatusGetOrderList {
  int goodsAgencyFund;
  int goodsFreight;
  int goodsQuantity;
  int orderStatus;
  String orderNo;
  String goods;
  String receiptCompanyName;
  String sendCompanyName;

  FromStatusGetOrderList({
    this.goodsAgencyFund,
    this.goodsFreight,
    this.goodsQuantity,
    this.orderStatus,
    this.orderNo,
    this.goods,
    this.receiptCompanyName,
    this.sendCompanyName,
  });

  factory FromStatusGetOrderList.fromJson(Map<String, dynamic> json) {
    return FromStatusGetOrderList(
      goodsAgencyFund: json['goodsAgencyFund'],
      goodsFreight: json['goodsFreight'],
      goodsQuantity: json['goodsQuantity'],
      orderStatus: json['orderStatus'],
      orderNo: json['orderNo'],
      goods: json['goods'],
      receiptCompanyName: json['receiptCompanyName'],
      sendCompanyName: json['sendCompanyName'],
    );
  }
}

//提交改单、作废、寄件、拒收、签收后返回对象
class OrderStatusReturnObj {
  bool success;
  int code;
  String msg;

  OrderStatusReturnObj({this.success, this.code, this.msg});

  factory OrderStatusReturnObj.fromJson(Map<String, dynamic> json) {
    return OrderStatusReturnObj(
      success: json['success'],
      code: json['code'],
      msg: json['msg'],
    );
  }
}

//模糊匹配订单号返回对象
class LikeOrderNo {
  bool success;
  int code;
  String msg;
  List data;

  LikeOrderNo({
    this.success,
    this.code,
    this.msg,
    this.data,
  });

  factory LikeOrderNo.fromJson(Map<String, dynamic> json) {
    return LikeOrderNo(
      success: json['success'],
      code: json['code'],
      msg: json['msg'],
      data: json['data'],
    );
  }
}

//验证token是否过期返回对象
class CheckToken {
  bool success;
  int code;
  String msg;
  String data;

  CheckToken({
    this.success,
    this.code,
    this.msg,
    this.data,
  });

  factory CheckToken.fromJson(Map<String, dynamic> json) {
    return CheckToken(
      success: json['success'],
      code: json['code'],
      msg: json['msg'],
      data: json['data'],
    );
  }
}

//蓝牙信息缓存对象
class BtInfoList {
  List<BtInfoObj> btList;

  BtInfoList({this.btList});

  factory BtInfoList.fromJson(List json) {
    List tempList = json.map((i) => BtInfoObj.fromJson(i)).toList();
    return BtInfoList(btList: tempList);
  }
}

class BtInfoObj {
  String name;
  bool showLoadStauts;
  bool connectStatus;

  BtInfoObj({this.name, this.showLoadStauts, this.connectStatus});

  factory BtInfoObj.fromJson(Map<String, dynamic> json) {
    return BtInfoObj(
      name: json['name'],
      showLoadStauts: json['showLoadStauts'],
      connectStatus: json['connectStatus'],
    );
  }
}

//根据公司id获取线路
class CompanyOfLine {
  bool success;
  int code;
  String msg;
  List<CompanyOfLineList> data;

  CompanyOfLine({
    this.success,
    this.code,
    this.msg,
    this.data
  });

  factory CompanyOfLine.fromJson(Map<String,dynamic> json){
    var list = json['data'] as List;
    List tempList = list.map((i) => CompanyOfLineList.fromJson(i)).toList();
    return CompanyOfLine(
      success:json['success'],
      code:json['code'],
      msg:json['msg'],
      data:tempList,
    );
  }
}

class CompanyOfLineList {
  int lineId;
  String lineName;
  int uzerCompanyId;
  bool checkedStatus = false;

  CompanyOfLineList({
    this.lineId,
    this.lineName,
    this.uzerCompanyId,
  });
  factory CompanyOfLineList.fromJson(Map<String, dynamic> json) {
    return CompanyOfLineList(
      lineId:json['lineId'],
      lineName:json['lineName'],
      uzerCompanyId:json['uzerCompanyId'],
    );
  }
}
