class InventoryInOutCreateModel {
  InventoryInOutCreateModel({
    required this.inOrOut,
    required this.productId,
    required this.projectId,
    required this.time,
    required this.quantity,
    required this.unitPrice,
    required this.amount,
    required this.agent,
    this.remark,
  });

  final int? inOrOut;
  final int? productId;
  final int? projectId;
  final DateTime? time;
  final int? quantity;
  final int? unitPrice;
  final int? amount;
  final String? agent;
  final String? remark;

  factory InventoryInOutCreateModel.fromJson(Map<String, dynamic> json) {
    return InventoryInOutCreateModel(
      inOrOut: json["inOrOut"],
      productId: json["productId"],
      projectId: json["projectId"],
      time: DateTime.tryParse(json["time"] ?? ""),
      quantity: json["quantity"],
      unitPrice: json["unitPrice"],
      amount: json["amount"],
      agent: json["agent"],
      remark: json["remark"],
    );
  }

  Map<String, dynamic> toJson() => {
        "inOrOut": inOrOut,
        "productId": productId,
        "projectId": projectId,
        "time": time?.toIso8601String(),
        "quantity": quantity,
        "unitPrice": unitPrice,
        "amount": amount,
        "agent": agent,
        "remark": remark,
      };
}
