/// YApi QuickType插件生成,具体参考文档:https://plugins.jetbrains.com/plugin/18847-yapi-quicktype/documentation

import 'dart:convert';

import 'package:widgets/load_state_layout.dart';

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

  List<dynamic> offerTextInfoList;
  String lowestFloatingRate;
  String othersOfferingPic;
  String lowestFixedRate;
  List<dynamic> othersOfferingInfoList;

  PropertyIoanState({
    this.loadingState = LoadState.State_Loading,
    String? errorMessage,
    required this.offerTextInfoList,
    required this.lowestFloatingRate,
    required this.othersOfferingPic,
    required this.lowestFixedRate,
    required this.othersOfferingInfoList,
  });

  PropertyIoanState copyWith({
    LoadState? loadingState,
    String? errorMessage,
    List<dynamic>? offerTextInfoList,
    String? lowestFloatingRate,
    String? othersOfferingPic,
    String? lowestFixedRate,
    List<dynamic>? othersOfferingInfoList,
  }) {
    return PropertyIoanState(
      loadingState: loadingState ?? this.loadingState,
      errorMessage: errorMessage ?? this.errorMessage,
      offerTextInfoList: offerTextInfoList ?? this.offerTextInfoList,
      lowestFloatingRate: lowestFloatingRate ?? this.lowestFloatingRate,
      othersOfferingPic: othersOfferingPic ?? this.othersOfferingPic,
      lowestFixedRate: lowestFixedRate ?? this.lowestFixedRate,
      othersOfferingInfoList: othersOfferingInfoList ?? this.othersOfferingInfoList,
    );
  }

  Map<String, dynamic> toMap() {
    return {
      'loadingState': this.loadingState,
      'errorMessage': this.errorMessage,
      'offerTextInfoList': this.offerTextInfoList,
      'lowestFloatingRate': this.lowestFloatingRate,
      'othersOfferingPic': this.othersOfferingPic,
      'lowestFixedRate': this.lowestFixedRate,
      'othersOfferingInfoList': this.othersOfferingInfoList,
    };
  }

  factory PropertyIoanState.fromMap(Map<String, dynamic> map) {
    return PropertyIoanState(
      loadingState: map['loadingState'] as LoadState,
      errorMessage: map['errorMessage'] as String,
      offerTextInfoList: map['offerTextInfoList'] as List<dynamic>,
      lowestFloatingRate: map['lowestFloatingRate'] as String,
      othersOfferingPic: map['othersOfferingPic'] as String,
      lowestFixedRate: map['lowestFixedRate'] as String,
      othersOfferingInfoList: map['othersOfferingInfoList'] as List<dynamic>,
    );
  }
}