import 'package:flutter_form_bloc/flutter_form_bloc.dart';

class CustomerProperty {
  int customerPropertyId;
  int propertyId;
  int customerId;
  DateTime dateAdd;
  double propertyValue;
  bool newData = false;

  CustomerProperty({this.propertyId, this.customerId, this.dateAdd, this.propertyValue});

  CustomerProperty.fromJson(Map json) {
    this.customerPropertyId = json['customerPropertyId'];
    this.propertyId = json['propertyId'];
    this.customerId = json['customerId'];
    this.dateAdd = json['propertyName'];
    this.propertyValue = json['propertyValue'];
  }

  Map<String, dynamic> toJson() {
    if (customerPropertyId != null) {
      return {
        "customerPropertyId": this.customerPropertyId,
        "propertyId": this.propertyId,
        "customerId": this.customerId,
        "dateAdd": DateFormat('yyyy-MM-dd HH:mm:ss').format(this.dateAdd),
        "propertyValue": this.propertyValue
      };
    } else {
      return {
        "propertyId": this.propertyId,
        "customerId": this.customerId,
        "dateAdd": DateFormat('yyyy-MM-dd HH:mm:ss').format(this.dateAdd),
        "propertyValue": this.propertyValue
      };
    }
  }
}