import 'dart:convert';

class GetFaDisposalNtfDetails {
  List<PFaBuyer>? pFaBuyers;
  List<PFaHeader>? pFaHeader;
  List<PFaLine>? pFaLines;
  String? pInformation;
  dynamic pQuestion;

  GetFaDisposalNtfDetails({
    this.pFaBuyers,
    this.pFaHeader,
    this.pFaLines,
    this.pInformation,
    this.pQuestion,
  });

  factory GetFaDisposalNtfDetails.fromRawJson(String str) => GetFaDisposalNtfDetails.fromJson(json.decode(str));

  String toRawJson() => json.encode(toJson());

  factory GetFaDisposalNtfDetails.fromJson(Map<String, dynamic> json) => GetFaDisposalNtfDetails(
    pFaBuyers: json["P_FA_BUYERS"] == null ? [] : List<PFaBuyer>.from(json["P_FA_BUYERS"]!.map((x) => PFaBuyer.fromJson(x))),
    pFaHeader: json["P_FA_HEADER"] == null ? [] : List<PFaHeader>.from(json["P_FA_HEADER"]!.map((x) => PFaHeader.fromJson(x))),
    pFaLines: json["P_FA_LINES"] == null ? [] : List<PFaLine>.from(json["P_FA_LINES"]!.map((x) => PFaLine.fromJson(x))),
    pInformation: json["P_INFORMATION"],
    pQuestion: json["P_QUESTION"],
  );

  Map<String, dynamic> toJson() => {
    "P_FA_BUYERS": pFaBuyers == null ? [] : List<dynamic>.from(pFaBuyers!.map((x) => x.toJson())),
    "P_FA_HEADER": pFaHeader == null ? [] : List<dynamic>.from(pFaHeader!.map((x) => x.toJson())),
    "P_FA_LINES": pFaLines == null ? [] : List<dynamic>.from(pFaLines!.map((x) => x.toJson())),
    "P_INFORMATION": pInformation,
    "P_QUESTION": pQuestion,
  };
}

class PFaBuyer {
  int? amount;
  String? buyerName;
  String? buyerNumber;
  int? fromRowNum;
  String? highestBidder;
  int? noOfRows;
  String? receiptNumber;
  String? remarks;
  int? requestNo;
  int? rowNum;
  int? toRowNum;

  PFaBuyer({
    this.amount,
    this.buyerName,
    this.buyerNumber,
    this.fromRowNum,
    this.highestBidder,
    this.noOfRows,
    this.receiptNumber,
    this.remarks,
    this.requestNo,
    this.rowNum,
    this.toRowNum,
  });

  factory PFaBuyer.fromRawJson(String str) => PFaBuyer.fromJson(json.decode(str));

  String toRawJson() => json.encode(toJson());

  factory PFaBuyer.fromJson(Map<String, dynamic> json) => PFaBuyer(
    amount: json["AMOUNT"],
    buyerName: json["BUYER_NAME"],
    buyerNumber: json["BUYER_NUMBER"],
    fromRowNum: json["FROM_ROW_NUM"],
    highestBidder: json["HIGHEST_BIDDER"],
    noOfRows: json["NO_OF_ROWS"],
    receiptNumber: json["RECEIPT_NUMBER"],
    remarks: json["REMARKS"],
    requestNo: json["REQUEST_NO"],
    rowNum: json["ROW_NUM"],
    toRowNum: json["TO_ROW_NUM"],
  );

  Map<String, dynamic> toJson() => {
    "AMOUNT": amount,
    "BUYER_NAME": buyerName,
    "BUYER_NUMBER": buyerNumber,
    "FROM_ROW_NUM": fromRowNum,
    "HIGHEST_BIDDER": highestBidder,
    "NO_OF_ROWS": noOfRows,
    "RECEIPT_NUMBER": receiptNumber,
    "REMARKS": remarks,
    "REQUEST_NO": requestNo,
    "ROW_NUM": rowNum,
    "TO_ROW_NUM": toRowNum,
  };
}

class PFaHeader {
  String? bookTypeCode;
  String? categoryCode;
  String? categoryGroup;
  String? comments;
  int? requestNo;
  String? status;

  PFaHeader({
    this.bookTypeCode,
    this.categoryCode,
    this.categoryGroup,
    this.comments,
    this.requestNo,
    this.status,
  });

  factory PFaHeader.fromRawJson(String str) => PFaHeader.fromJson(json.decode(str));

  String toRawJson() => json.encode(toJson());

  factory PFaHeader.fromJson(Map<String, dynamic> json) => PFaHeader(
    bookTypeCode: json["BOOK_TYPE_CODE"],
    categoryCode: json["CATEGORY_CODE"],
    categoryGroup: json["CATEGORY_GROUP"],
    comments: json["COMMENTS"],
    requestNo: json["REQUEST_NO"],
    status: json["STATUS"],
  );

  Map<String, dynamic> toJson() => {
    "BOOK_TYPE_CODE": bookTypeCode,
    "CATEGORY_CODE": categoryCode,
    "CATEGORY_GROUP": categoryGroup,
    "COMMENTS": comments,
    "REQUEST_NO": requestNo,
    "STATUS": status,
  };
}

class PFaLine {
  String? action;
  String? assetDescription;
  int? assetNumber;
  String? barcodeNumber;
  String? bme;
  String? datePlacedInService;
  String? department;
  String? disposedDate;
  int? fromRowNum;
  double? netBookValue;
  int? noOfRows;
  String? poNumber;
  double? purchasePrice;
  int? quantity;
  int? requestNo;
  int? rowNum;
  String? serialNumber;
  int? toRowNum;
  int? usefulLife;
  String? yearsUsed;

  PFaLine({
    this.action,
    this.assetDescription,
    this.assetNumber,
    this.barcodeNumber,
    this.bme,
    this.datePlacedInService,
    this.department,
    this.disposedDate,
    this.fromRowNum,
    this.netBookValue,
    this.noOfRows,
    this.poNumber,
    this.purchasePrice,
    this.quantity,
    this.requestNo,
    this.rowNum,
    this.serialNumber,
    this.toRowNum,
    this.usefulLife,
    this.yearsUsed,
  });

  factory PFaLine.fromRawJson(String str) => PFaLine.fromJson(json.decode(str));

  String toRawJson() => json.encode(toJson());

  factory PFaLine.fromJson(Map<String, dynamic> json) => PFaLine(
    action: json["ACTION"],
    assetDescription: json["ASSET_DESCRIPTION"],
    assetNumber: json["ASSET_NUMBER"],
    barcodeNumber: json["BARCODE_NUMBER"],
    bme: json["BME"],
    datePlacedInService: json["DATE_PLACED_IN_SERVICE"],
    department: json["DEPARTMENT"],
    disposedDate: json["DISPOSED_DATE"],
    fromRowNum: json["FROM_ROW_NUM"],
    netBookValue: json["NET_BOOK_VALUE"]?.toDouble(),
    noOfRows: json["NO_OF_ROWS"],
    poNumber: json["PO_NUMBER"],
    purchasePrice: json["PURCHASE_PRICE"]?.toDouble(),
    quantity: json["QUANTITY"],
    requestNo: json["REQUEST_NO"],
    rowNum: json["ROW_NUM"],
    serialNumber: json["SERIAL_NUMBER"],
    toRowNum: json["TO_ROW_NUM"],
    usefulLife: json["USEFUL_LIFE"],
    yearsUsed: json["YEARS_USED"],
  );

  Map<String, dynamic> toJson() => {
    "ACTION": action,
    "ASSET_DESCRIPTION": assetDescription,
    "ASSET_NUMBER": assetNumber,
    "BARCODE_NUMBER": barcodeNumber,
    "BME": bme,
    "DATE_PLACED_IN_SERVICE": datePlacedInService,
    "DEPARTMENT": department,
    "DISPOSED_DATE": disposedDate,
    "FROM_ROW_NUM": fromRowNum,
    "NET_BOOK_VALUE": netBookValue,
    "NO_OF_ROWS": noOfRows,
    "PO_NUMBER": poNumber,
    "PURCHASE_PRICE": purchasePrice,
    "QUANTITY": quantity,
    "REQUEST_NO": requestNo,
    "ROW_NUM": rowNum,
    "SERIAL_NUMBER": serialNumber,
    "TO_ROW_NUM": toRowNum,
    "USEFUL_LIFE": usefulLife,
    "YEARS_USED": yearsUsed,
  };
}
