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

  String tanker_name = '';
  String dateOfOrder = '';
  String tankName = '';
  String tankLocation = '';
  String bookingid = '';
  String typeofwater = '';
  String capacity = '';
  String address = '';
  String price = '';
  String payment_status = '';
  String orderStatus = '';
  String delivery_agent = '';
  String delivery_agent_mobile = '';
  String initial_water_level = '';
  String final_water_level = '';
  String start_time = '';
  String stop_time = '';
  String quantityDelivered = '';
  String amount_paid = '';
  String amount_due = '';
  String payment_mode = '';
  String customerPhone = '';
  String supplierPhone = '';
  String customerName = '';
  String supplierName = '';
  Color payment_color=Colors.grey;
  String displayText = '';
  String distrubance_price = '';
  String amount_difference = '';









  UserSupplierAccountsModel();


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

    rtvm.tanker_name = json['tankerName'] ?? '';

    rtvm.dateOfOrder = json['dateOfOrder'] ?? '';
    rtvm.tankName = json['tankName'] ?? '';
    rtvm.tankLocation = json['tankLocation'] ?? '';
    rtvm.bookingid = json['bookingid'] ?? '';
    rtvm.typeofwater = json['typeofwater'] ?? '';
    rtvm.capacity = json['capacity'] ?? '';
    rtvm.address = json['address'] ?? '';
    rtvm.price = json['price'] ?? '';
    rtvm.payment_status = json['payment_status'] ?? '';
    rtvm.orderStatus = json['orderStatus'] ?? '';
    rtvm.delivery_agent = json['delivery_agent'] ?? '';
    rtvm.delivery_agent_mobile = json['delivery_agent_mobile'] ?? '';
    rtvm.initial_water_level = json['initial_water_level'] ?? '';
    rtvm.final_water_level = json['final_water_level'] ?? '';
    rtvm.start_time = json['start_time'] ?? '';
    rtvm.stop_time = json['stop_time'] ?? '';
    rtvm.quantityDelivered = json['quantityDelivered'] ?? '';
    rtvm.amount_paid = json['amount_paid'] ?? '';
    rtvm.amount_due = json['amount_due'] ?? '';
    rtvm.payment_mode = json['payment_mode'] ?? '';
    rtvm.customerPhone = json['customerPhone'] ?? '';
    rtvm.supplierPhone = json['supplierPhone'] ?? '';
    rtvm.customerName = json['customerName'] ?? '';
    rtvm.supplierName = json['supplierName'] ?? '';
    rtvm.distrubance_price = json['distrubance_price'] ?? '';
    rtvm.amount_difference = json['amount_difference'] ?? '';



    if(rtvm.orderStatus=='delivered' && rtvm.payment_status=='paid'){
      rtvm.payment_color=Colors.green;
      rtvm.displayText='Payment Completed';
    }
    else if(rtvm.orderStatus=='delivered' && rtvm.payment_status=='due'){
      rtvm.payment_color=primaryColor;
      rtvm.displayText='Due';
    }


    return rtvm;
  }

}