import 'liveConsultation.m.dart'; import 'notification.m.dart'; import 'device.m.dart'; enum StatisticTypeEnum { Number, Customer, } class CreateStatisticRequest extends TokenRequest{ String? code; String? statisticKey; StatisticTypeEnum statisticType; String? time; String? statisticData; CreateStatisticRequest({ this.code, this.statisticKey, this.statisticType = StatisticTypeEnum.Number, this.time, this.statisticData, String? token, }) : super( token: token, ); factory CreateStatisticRequest.fromJson(Map map) { return CreateStatisticRequest( code: map['Code'], statisticKey: map['StatisticKey'], statisticType: StatisticTypeEnum.values.firstWhere((e) => e.index == map['StatisticType']), time: map['Time'], statisticData: map['StatisticData'], token: map['Token'], ); } Map toJson() { final map = super.toJson(); if (code != null) map['Code'] = code; if (statisticKey != null) map['StatisticKey'] = statisticKey; map['StatisticType'] = statisticType.index; if (time != null) map['Time'] = time; if (statisticData != null) map['StatisticData'] = statisticData; return map; } } class StatisticDTO extends BaseDTO{ String? code; String? statisticKey; StatisticTypeEnum statisticType; String? time; String? statisticData; StatisticDTO({ this.code, this.statisticKey, this.statisticType = StatisticTypeEnum.Number, this.time, this.statisticData, DateTime? createTime, DateTime? updateTime, }) : super( createTime: createTime, updateTime: updateTime, ); factory StatisticDTO.fromJson(Map map) { return StatisticDTO( code: map['Code'], statisticKey: map['StatisticKey'], statisticType: StatisticTypeEnum.values.firstWhere((e) => e.index == map['StatisticType']), time: map['Time'], statisticData: map['StatisticData'], createTime: map['CreateTime'] != null ? DateTime.parse(map['CreateTime']) : null, updateTime: map['UpdateTime'] != null ? DateTime.parse(map['UpdateTime']) : null, ); } Map toJson() { final map = super.toJson(); if (code != null) map['Code'] = code; if (statisticKey != null) map['StatisticKey'] = statisticKey; map['StatisticType'] = statisticType.index; if (time != null) map['Time'] = time; if (statisticData != null) map['StatisticData'] = statisticData; return map; } } class GetStatisticRequest extends TokenRequest{ String? code; GetStatisticRequest({ this.code, String? token, }) : super( token: token, ); factory GetStatisticRequest.fromJson(Map map) { return GetStatisticRequest( code: map['Code'], token: map['Token'], ); } Map toJson() { final map = super.toJson(); if (code != null) map['Code'] = code; return map; } } class GetStatisticByKeyRequest extends TokenRequest{ String? key; String? value; GetStatisticByKeyRequest({ this.key, this.value, String? token, }) : super( token: token, ); factory GetStatisticByKeyRequest.fromJson(Map map) { return GetStatisticByKeyRequest( key: map['Key'], value: map['Value'], token: map['Token'], ); } Map toJson() { final map = super.toJson(); if (key != null) map['Key'] = key; if (value != null) map['Value'] = value; return map; } } class StatisticPageRequest extends PageRequest{ StatisticPageRequest({ int pageIndex = 0, int pageSize = 0, String? token, }) : super( pageIndex: pageIndex, pageSize: pageSize, token: token, ); factory StatisticPageRequest.fromJson(Map map) { return StatisticPageRequest( pageIndex: map['PageIndex'], pageSize: map['PageSize'], token: map['Token'], ); } Map toJson() { final map = super.toJson(); return map; } } class RemoveStatisticRequest extends TokenRequest{ String? code; RemoveStatisticRequest({ this.code, String? token, }) : super( token: token, ); factory RemoveStatisticRequest.fromJson(Map map) { return RemoveStatisticRequest( code: map['Code'], token: map['Token'], ); } Map toJson() { final map = super.toJson(); if (code != null) map['Code'] = code; return map; } } class GetStatisticListRequest extends TokenRequest{ List? codes; GetStatisticListRequest({ this.codes, String? token, }) : super( token: token, ); factory GetStatisticListRequest.fromJson(Map map) { return GetStatisticListRequest( codes: map['Codes']?.cast().toList(), token: map['Token'], ); } Map toJson() { final map = super.toJson(); if (codes != null) map['Codes'] = codes; return map; } } class UpdateStatisticRequest extends TokenRequest{ String? code; String? statisticKey; StatisticTypeEnum statisticType; String? time; String? statisticData; UpdateStatisticRequest({ this.code, this.statisticKey, this.statisticType = StatisticTypeEnum.Number, this.time, this.statisticData, String? token, }) : super( token: token, ); factory UpdateStatisticRequest.fromJson(Map map) { return UpdateStatisticRequest( code: map['Code'], statisticKey: map['StatisticKey'], statisticType: StatisticTypeEnum.values.firstWhere((e) => e.index == map['StatisticType']), time: map['Time'], statisticData: map['StatisticData'], token: map['Token'], ); } Map toJson() { final map = super.toJson(); if (code != null) map['Code'] = code; if (statisticKey != null) map['StatisticKey'] = statisticKey; map['StatisticType'] = statisticType.index; if (time != null) map['Time'] = time; if (statisticData != null) map['StatisticData'] = statisticData; return map; } } class GetHomePageStatisticRequest extends TokenRequest{ GetHomePageStatisticRequest({ String? token, }) : super( token: token, ); factory GetHomePageStatisticRequest.fromJson(Map map) { return GetHomePageStatisticRequest( token: map['Token'], ); } Map toJson() { final map = super.toJson(); return map; } }