import 'package:domain/entity/service_order_detail_entity.dart';
import 'package:flutter/cupertino.dart';
import 'package:widgets/load_state_layout.dart';

class CleanOrderDetailState {
  //页面 LoadView 状态的展示
  LoadState loadingState;
  String? errorMessage;
  double? totalPrice;
  List<Map <String, dynamic>>? actionBtnList;

  ServiceOrderDetailEntity? datas;

  String? cancelReason;  // 取消的文字

  Map<String, Map<String, dynamic>>? cancelFormData;



  CleanOrderDetailState({
    this.loadingState = LoadState.State_Loading,
    String? errorMessage,
    double? totalPrice,
    this.actionBtnList,
    this.cancelReason,
    Map<String, Map<String, dynamic>>? cancelFormData,
    this.datas,
  }): cancelFormData = cancelFormData ?? {
      'reason': {
        'value': '',
        'controller': TextEditingController(),
        'hintText': '',
        'focusNode': FocusNode(),
        'obsecure': false,
      },
  },totalPrice = totalPrice ?? 0.0;

  CleanOrderDetailState copyWith({
    LoadState? loadingState,
    String? errorMessage,
    double? totalPrice,
    List<Map<String, dynamic>>? actionBtnList,
    String? cancelReason,
    Map<String, Map<String, dynamic>>? cancelFormData,
    ServiceOrderDetailEntity? datas,
  }) {
    return CleanOrderDetailState(
      loadingState: loadingState ?? this.loadingState,
      errorMessage: errorMessage ?? this.errorMessage,
      totalPrice: totalPrice ?? this.totalPrice,
      actionBtnList: actionBtnList ?? this.actionBtnList,
      cancelReason: cancelReason ?? this.cancelReason,
      cancelFormData: cancelFormData ?? this.cancelFormData,
      datas: datas ?? this.datas,
    );
  }
}