import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart';
import 'package:diplomaticquarterapp/uitl/date_uitl.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';

class PrescriptionsOrder {
  int iD;
  dynamic patientID;
  bool patientOutSA;
  bool isOutPatient;
  int projectID;
  int nearestProjectID;
  double longitude;
  double latitude;
  dynamic appointmentNo;
  dynamic dischargeID;
  int lineItemNo;
  int status;
  dynamic description;
  dynamic descriptionN;
  DateTime createdOn;
  int serviceID;
  int createdBy;
  DateTime editedOn;
  int editedBy;
  int channel;
  dynamic clientRequestID;
  bool returnedToQueue;
  dynamic pickupDateTime;
  dynamic pickupLocationName;
  dynamic dropoffLocationName;
  int realRRTHaveTransactions;
  dynamic nearestProjectDescription;
  dynamic nearestProjectDescriptionN;
  dynamic projectDescription;
  dynamic projectDescriptionN;

  String getNearestProjectDescription(){
    return isAppArabic ? nearestProjectDescriptionN : nearestProjectDescription;
  }
  String getStatusName(TranslationBase localize){
    if(status == 1)
      return localize.pending;
    else if(status == 3)
      return localize.completed;
    return '$status';
  }

  String getFormattedDateTime()=> DateUtil.getWeekDayMonthDayYearDateFormatted(createdOn, isAppArabic ? 'ar' : 'en');

  PrescriptionsOrder(
      {this.iD,
        this.patientID,
        this.patientOutSA,
        this.isOutPatient,
        this.projectID,
        this.nearestProjectID,
        this.longitude,
        this.latitude,
        this.appointmentNo,
        this.dischargeID,
        this.lineItemNo,
        this.status,
        this.description,
        this.descriptionN,
        this.createdOn,
        this.serviceID,
        this.createdBy,
        this.editedOn,
        this.editedBy,
        this.channel,
        this.clientRequestID,
        this.returnedToQueue,
        this.pickupDateTime,
        this.pickupLocationName,
        this.dropoffLocationName,
        this.realRRTHaveTransactions,
        this.nearestProjectDescription,
        this.nearestProjectDescriptionN,
        this.projectDescription,
        this.projectDescriptionN});

  PrescriptionsOrder.fromJson(Map<String, dynamic> json) {
    iD = json['ID'];
    patientID = json['PatientID'];
    patientOutSA = json['PatientOutSA'];
    isOutPatient = json['IsOutPatient'];
    projectID = json['ProjectID'];
    nearestProjectID = json['NearestProjectID'];
    longitude = json['Longitude'];
    latitude = json['Latitude'];
    appointmentNo = json['AppointmentNo'];
    dischargeID = json['DischargeID'];
    lineItemNo = json['LineItemNo'];
    status = json['Status'];
    description = json['Description'];
    descriptionN = json['DescriptionN'];
    createdOn = DateUtil.convertStringToDate(json['CreatedOn']);
    serviceID = json['ServiceID'];
    createdBy = json['CreatedBy'];
    editedOn = DateUtil.convertStringToDate(json['EditedOn']);
    editedBy = json['EditedBy'];
    channel = json['Channel'];
    clientRequestID = json['ClientRequestID'];
    returnedToQueue = json['ReturnedToQueue'];
    pickupDateTime = json['PickupDateTime'];
    pickupLocationName = json['PickupLocationName'];
    dropoffLocationName = json['DropoffLocationName'];
    realRRTHaveTransactions = json['RealRRT_HaveTransactions'];
    nearestProjectDescription = json['NearestProjectDescription'];
    nearestProjectDescriptionN = json['NearestProjectDescriptionN'];
    projectDescription = json['ProjectDescription'];
    projectDescriptionN = json['ProjectDescriptionN'];
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = new Map<String, dynamic>();
    data['ID'] = this.iD;
    data['PatientID'] = this.patientID;
    data['PatientOutSA'] = this.patientOutSA;
    data['IsOutPatient'] = this.isOutPatient;
    data['ProjectID'] = this.projectID;
    data['NearestProjectID'] = this.nearestProjectID;
    data['Longitude'] = this.longitude;
    data['Latitude'] = this.latitude;
    data['AppointmentNo'] = this.appointmentNo;
    data['DischargeID'] = this.dischargeID;
    data['LineItemNo'] = this.lineItemNo;
    data['Status'] = this.status;
    data['Description'] = this.description;
    data['DescriptionN'] = this.descriptionN;
    data['CreatedOn'] = this.createdOn;
    data['ServiceID'] = this.serviceID;
    data['CreatedBy'] = this.createdBy;
    data['EditedOn'] = this.editedOn;
    data['EditedBy'] = this.editedBy;
    data['Channel'] = this.channel;
    data['ClientRequestID'] = this.clientRequestID;
    data['ReturnedToQueue'] = this.returnedToQueue;
    data['PickupDateTime'] = this.pickupDateTime;
    data['PickupLocationName'] = this.pickupLocationName;
    data['DropoffLocationName'] = this.dropoffLocationName;
    data['RealRRT_HaveTransactions'] = this.realRRTHaveTransactions;
    data['NearestProjectDescription'] = this.nearestProjectDescription;
    data['NearestProjectDescriptionN'] = this.nearestProjectDescriptionN;
    data['ProjectDescription'] = this.projectDescription;
    data['ProjectDescriptionN'] = this.projectDescriptionN;
    return data;
  }
}
