import 'package:domain/entity/service_category_entity.dart';
import 'package:widgets/load_state_layout.dart';

class ServiceMainState {
  //页面 LoadView 状态的展示
  LoadState? loadingState;
  String? errorMessage;

  // getter curId
  int? get curId => curCategory?.id;
  final ServiceCategoryEntity? curCategory;

  List<ServiceCategoryEntity>? datas;

  ServiceMainState({
    this.loadingState = LoadState.State_Loading,
    this.errorMessage,
    this.curCategory,
    this.datas,
  });

  ServiceMainState copyWith({
    LoadState? loadingState,
    String? errorMessage,
    ServiceCategoryEntity? curCategory,
    List<ServiceCategoryEntity>? datas,
  }) {
    return ServiceMainState(
      loadingState: loadingState ?? this.loadingState,
      errorMessage: errorMessage ?? this.errorMessage,
      curCategory: curCategory ?? this.curCategory,
      datas: datas ?? this.datas,
    );
  }
}
