import 'package:flutter/material.dart';
import 'package:bookatanker/common/settings.dart';


class DisconnectedSuppliersModel {
  String supplier_name = '';
  String status='';
  String supplier_address='';
  String supplier_phone_number='';
  String supplier_id='';
  Color text_color=Colors.black;
  double lat=0;
  double lng=0;

  DisconnectedSuppliersModel();

  factory DisconnectedSuppliersModel.fromJson(Map<String, dynamic> json){
    DisconnectedSuppliersModel rtvm = new DisconnectedSuppliersModel();

    rtvm.supplier_name = json['suppliername'] ?? '';
    rtvm.status = json['status'] ?? '';
    rtvm.supplier_address = json['profile']['office_address'] ?? '';
    rtvm.supplier_phone_number = json['phone'] ?? '';
    rtvm.supplier_id = json['supplierId'] ?? '';
    rtvm.lat = json['latitude'] ?? 0;
    rtvm.lng = json['longitude'] ?? 0;


    if(rtvm.status.toString().toLowerCase()=='pending'){
      rtvm.text_color=Colors.yellow;
    }
    else if(rtvm.status.toString().toLowerCase()=='accepted'){
      rtvm.text_color=Colors.green;
    }
    else if(rtvm.status.toString().toLowerCase()=='rejected'){
      rtvm.text_color=Colors.red;
    }
    else{
      rtvm.status='Connect?';
      rtvm.text_color=primaryColor;
    }




    return rtvm;
  }

}