import 'package:cs_resources/generated/l10n.dart';
import 'package:domain/entity/form_content_entity.dart';
import 'package:domain/entity/form_list_entity.dart';
import 'package:domain/entity/form_option_entity.dart';
import 'package:flutter/material.dart';

class ApplyState {
  int detailPageIndex;

  //表单类型（列表的Form类型）
  String? formType;

  String? estateFormId;

  //该房产小区对应的此 Form 信息，从Apply 的列表item中拿过来
  FormListEntity? formItem;

  //是否可编辑
  bool enableEdit;

  //页面组的信息
  Map<String, dynamic>? detailPage;

  //复显的详情数据(来自网络数据)
  FormContentEntity formContentDetail;

  FormOptionEntity? formOption;

  ApplyState({
    this.formType,
    this.estateFormId,
    this.formItem,
    this.detailPage,
    this.formOption,
    required this.formContentDetail,
    this.enableEdit = true,
    this.detailPageIndex = 0,
  });

  ApplyState copyWith({
    String? formType,
    String? estateFormId,
    FormListEntity? formItem,
    bool? enableEdit,
    Map<String, dynamic>? detailPage,
    FormContentEntity? formContentDetail,
    FormOptionEntity? formOption,
  }) {
    return ApplyState(
      formType: formType ?? this.formType,
      estateFormId: estateFormId ?? this.estateFormId,
      formItem: formItem ?? this.formItem,
      enableEdit: enableEdit ?? this.enableEdit,
      detailPage: detailPage ?? this.detailPage,
      formContentDetail: formContentDetail ?? this.formContentDetail,
      formOption: formOption ?? this.formOption,
      detailPageIndex: this.detailPageIndex,
    );
  }
}
