import 'package:sk_base_mobile/models/sale_quotation.model.dart'; class SaleQuotationTemplateModel { SaleQuotationTemplateModel({ this.id, this.name, required this.template, this.isDelete, }); final int? id; final String? name; final Template template; final int? isDelete; factory SaleQuotationTemplateModel.fromJson(Map json) { return SaleQuotationTemplateModel( id: json["id"], name: json["name"], template: Template.fromJson(json["template"]), isDelete: json["isDelete"], ); } Map toJson() => { "id": id, "name": name, "template": template.toJson(), "isDelete": isDelete, }; } class Template { Template({ required this.data, required this.formula, required this.totalCost, required this.totalPrice, }); List data; String formula; num? totalCost; num? totalPrice; factory Template.fromJson(Map json) { return Template( data: json["data"] == null ? [] : List.from( json["data"]!.map((x) => SaleQuotationModel.fromJson(x))), formula: json["formula"], totalCost: json["totalCost"], totalPrice: json["totalPrice"], ); } Map toJson() => { "data": data.map((x) => x.toJson()).toList(), "formula": formula, "totalCost": totalCost, "totalPrice": totalPrice, }; }