import 'dart:typed_data';

import 'package:domain/generated/json/base/json_field.dart';
import 'package:domain/generated/json/form_content_entity.g.dart';
import 'dart:convert';
export 'package:domain/generated/json/form_content_entity.g.dart';

/*
 * 这是Form表单的入参和出参的对象，12种类型全部整合在一个对象中
 */
@JsonSerializable()
class FormContentEntity {
  @JSONField(name: "type_of_application")
  String? typeOfApplication;
  @JSONField(name: "notes_to_recipient")
  String? notesToRecipient;
  @JSONField(name: "notes_to_management")
  String? notesToManagement;
  List<String>? attachments;
  String? signature;
  dynamic signatureByteData = null; //签名的ByteData数据

  //汽车相关
  @JSONField(name: "ownership_status")
  String? ownershipStatus;
  @JSONField(name: "vehicle_number")
  String? vehicleNumber;
  @JSONField(name: "iu_number")
  String? iuNumber;
  @JSONField(name: "vehicle_make_model_colour")
  String? vehicleMakeModelColour;

  //搬家相关
  @JSONField(name: "start_date")
  String? startDate;
  @JSONField(name: "end_date")
  String? endDate;
  @JSONField(name: "time_or_arrival")
  String? timeOrArrival;
  @JSONField(name: "moving_company")
  String? movingCompany;
  @JSONField(name: "person_in_charge")
  String? personInCharge;
  @JSONField(name: "mobile_number")
  String? mobileNumber;
  @JSONField(name: "company_address")
  String? companyAddress;

  //停车过夜
  @JSONField(name: "date_of_entry")
  String? dateOfEntry;
  @JSONField(name: "guest_name")
  String? guestName;
  @JSONField(name: "guest_mobile_number")
  String? guestMobileNumber;

  //装修
  @JSONField(name: "renovation_start_date")
  String? renovationStartDate;
  @JSONField(name: "renovation_end_date")
  String? renovationEndDate;
  @JSONField(name: "hacking_start_date")
  String? hackingStartDate;
  @JSONField(name: "hacking_end_date")
  String? hackingEndDate;
  @JSONField(name: "renovation_company")
  String? renovationCompany;
  @JSONField(name: "list_of_renovation_works")
  String? listOfRenovationWorks;


  factory FormContentEntity.fromJson(Map<String, dynamic> json) => $FormContentEntityFromJson(json);

  Map<String, dynamic> toJson() => $FormContentEntityToJson(this);

  @override
  String toString() {
    return jsonEncode(this);
  }

  FormContentEntity({
    this.typeOfApplication,
    this.notesToRecipient,
    this.notesToManagement,
    this.attachments,
    this.signature,
    this.ownershipStatus,
    this.vehicleNumber,
    this.iuNumber,
    this.vehicleMakeModelColour,
    this.startDate,
    this.endDate,
    this.timeOrArrival,
    this.movingCompany,
    this.personInCharge,
    this.mobileNumber,
    this.companyAddress,
    this.dateOfEntry,
    this.guestName,
    this.guestMobileNumber,
    this.renovationStartDate,
    this.renovationEndDate,
    this.hackingStartDate,
    this.hackingEndDate,
    this.renovationCompany,
    this.listOfRenovationWorks,
  });

  FormContentEntity copyWith({
    String? typeOfApplication,
    String? notesToRecipient,
    String? notesToManagement,
    List<String>? attachments,
    String? signature,
    String? ownershipStatus,
    String? vehicleNumber,
    String? iuNumber,
    String? vehicleMakeModelColour,
    String? startDate,
    String? endDate,
    String? timeOrArrival,
    String? movingCompany,
    String? personInCharge,
    String? mobileNumber,
    String? companyAddress,
    String? dateOfEntry,
    String? guestName,
    String? guestMobileNumber,
    String? renovationStartDate,
    String? renovationEndDate,
    String? hackingStartDate,
    String? hackingEndDate,
    String? renovationCompany,
    String? listOfRenovationWorks,
  }) {
    return FormContentEntity(
      typeOfApplication: typeOfApplication ?? this.typeOfApplication,
      notesToRecipient: notesToRecipient ?? this.notesToRecipient,
      notesToManagement: notesToManagement ?? this.notesToManagement,
      attachments: attachments ?? this.attachments,
      signature: signature ?? this.signature,
      ownershipStatus: ownershipStatus ?? this.ownershipStatus,
      vehicleNumber: vehicleNumber ?? this.vehicleNumber,
      iuNumber: iuNumber ?? this.iuNumber,
      vehicleMakeModelColour: vehicleMakeModelColour ?? this.vehicleMakeModelColour,
      startDate: startDate ?? this.startDate,
      endDate: endDate ?? this.endDate,
      timeOrArrival: timeOrArrival ?? this.timeOrArrival,
      movingCompany: movingCompany ?? this.movingCompany,
      personInCharge: personInCharge ?? this.personInCharge,
      mobileNumber: mobileNumber ?? this.mobileNumber,
      companyAddress: companyAddress ?? this.companyAddress,
      dateOfEntry: dateOfEntry ?? this.dateOfEntry,
      guestName: guestName ?? this.guestName,
      guestMobileNumber: guestMobileNumber ?? this.guestMobileNumber,
      renovationStartDate: renovationStartDate ?? this.renovationStartDate,
      renovationEndDate: renovationEndDate ?? this.renovationEndDate,
      hackingStartDate: hackingStartDate ?? this.hackingStartDate,
      hackingEndDate: hackingEndDate ?? this.hackingEndDate,
      renovationCompany: renovationCompany ?? this.renovationCompany,
      listOfRenovationWorks: listOfRenovationWorks ?? this.listOfRenovationWorks,
    );
  }
}
