import 'package:fis_jsonrpc/utils.dart'; class UserTokenDTO { String? userCode; String? deviceId; String? token; UserTokenDTO({ this.userCode, this.deviceId, this.token, }); factory UserTokenDTO.fromJson(Map map) { return UserTokenDTO( userCode: map['UserCode'], deviceId: map['DeviceId'], token: map['Token'], ); } Map toJson() { final map = Map(); if(userCode != null) map['UserCode'] = userCode; if(deviceId != null) map['DeviceId'] = deviceId; if(token != null) map['Token'] = token; return map; } } enum EnumLoginProcessorType { Official, Wechat, Phone, Email, Unregistered, } class LoginProcessorDTO { String? userName; String? password; String? phone; String? email; String? verifyCode; String? wechatToken; LoginProcessorDTO({ this.userName, this.password, this.phone, this.email, this.verifyCode, this.wechatToken, }); factory LoginProcessorDTO.fromJson(Map map) { return LoginProcessorDTO( userName: map['UserName'], password: map['Password'], phone: map['Phone'], email: map['Email'], verifyCode: map['VerifyCode'], wechatToken: map['WechatToken'], ); } Map toJson() { final map = Map(); if(userName != null) map['UserName'] = userName; if(password != null) map['Password'] = password; if(phone != null) map['Phone'] = phone; if(email != null) map['Email'] = email; if(verifyCode != null) map['VerifyCode'] = verifyCode; if(wechatToken != null) map['WechatToken'] = wechatToken; return map; } } class ClientDTO { String? clientIpAndPort; String? clientDeviceId; String? clientSource; String? clientExtensionInfo; ClientDTO({ this.clientIpAndPort, this.clientDeviceId, this.clientSource, this.clientExtensionInfo, }); factory ClientDTO.fromJson(Map map) { return ClientDTO( clientIpAndPort: map['ClientIpAndPort'], clientDeviceId: map['ClientDeviceId'], clientSource: map['ClientSource'], clientExtensionInfo: map['ClientExtensionInfo'], ); } Map toJson() { final map = Map(); if(clientIpAndPort != null) map['ClientIpAndPort'] = clientIpAndPort; if(clientDeviceId != null) map['ClientDeviceId'] = clientDeviceId; if(clientSource != null) map['ClientSource'] = clientSource; if(clientExtensionInfo != null) map['ClientExtensionInfo'] = clientExtensionInfo; return map; } } class UserLoginDTO { EnumLoginProcessorType loginType; LoginProcessorDTO? processorInfo; ClientDTO? clientInfo; UserLoginDTO({ this.loginType = EnumLoginProcessorType.Official, this.processorInfo, this.clientInfo, }); factory UserLoginDTO.fromJson(Map map) { return UserLoginDTO( loginType: EnumLoginProcessorType.values.firstWhere((e) => e.index == map['LoginType']), processorInfo: map['ProcessorInfo'], clientInfo: map['ClientInfo'], ); } Map toJson() { final map = Map(); map['LoginType'] = loginType.index; if(processorInfo != null) map['ProcessorInfo'] = processorInfo; if(clientInfo != null) map['ClientInfo'] = clientInfo; return map; } } class ClientLoginRequest extends UserLoginDTO{ ClientLoginRequest({ EnumLoginProcessorType loginType = EnumLoginProcessorType.Official, LoginProcessorDTO? processorInfo, ClientDTO? clientInfo, }) : super( loginType: loginType, processorInfo: processorInfo, clientInfo: clientInfo, ); factory ClientLoginRequest.fromJson(Map map) { return ClientLoginRequest( loginType: EnumLoginProcessorType.values.firstWhere((e) => e.index == map['LoginType']), processorInfo: map['ProcessorInfo'], clientInfo: map['ClientInfo'], ); } Map toJson() { final map = super.toJson(); return map; } } class CommonLoginRequest { String? anyAccount; String? anyCode; String? password; CommonLoginRequest({ this.anyAccount, this.anyCode, this.password, }); factory CommonLoginRequest.fromJson(Map map) { return CommonLoginRequest( anyAccount: map['AnyAccount'], anyCode: map['AnyCode'], password: map['Password'], ); } Map toJson() { final map = Map(); if(anyAccount != null) map['AnyAccount'] = anyAccount; if(anyCode != null) map['AnyCode'] = anyCode; if(password != null) map['Password'] = password; return map; } } class CheckLoginTypeRequest { String? anyAccount; CheckLoginTypeRequest({ this.anyAccount, }); factory CheckLoginTypeRequest.fromJson(Map map) { return CheckLoginTypeRequest( anyAccount: map['AnyAccount'], ); } Map toJson() { final map = Map(); if(anyAccount != null) map['AnyAccount'] = anyAccount; return map; } } class CommonSignUpRequest { String? anyAccount; String? anyCode; String? password; CommonSignUpRequest({ this.anyAccount, this.anyCode, this.password, }); factory CommonSignUpRequest.fromJson(Map map) { return CommonSignUpRequest( anyAccount: map['AnyAccount'], anyCode: map['AnyCode'], password: map['Password'], ); } Map toJson() { final map = Map(); if(anyAccount != null) map['AnyAccount'] = anyAccount; if(anyCode != null) map['AnyCode'] = anyCode; if(password != null) map['Password'] = password; return map; } } class BaseDTO { DateTime? createTime; DateTime? updateTime; BaseDTO({ this.createTime, this.updateTime, }); factory BaseDTO.fromJson(Map map) { return BaseDTO( createTime: map['CreateTime'] != null ? DateTime.parse(map['CreateTime']) : null, updateTime: map['UpdateTime'] != null ? DateTime.parse(map['UpdateTime']) : null, ); } Map toJson() { final map = Map(); if(createTime != null) map['CreateTime'] = JsonRpcUtils.dateFormat(createTime!); if(updateTime != null) map['UpdateTime'] = JsonRpcUtils.dateFormat(updateTime!); return map; } } enum UserInfoStateEnum { Nonactivated, Activated, } enum ApplyStateEnum { NotApply, Applying, Refused, Passed, } class UserDTO extends BaseDTO{ String? userCode; String? userName; String? phone; String? email; String? nickName; String? fullName; String? headImageUrl; String? organizationCode; String? rootOrganizationCode; List? authorityGroups; List? bindDevices; String? lastIP; int logintimes; UserInfoStateEnum userState; List? roleCodes; List? rankCodes; List? positionCodes; ApplyStateEnum applyState; UserDTO({ this.userCode, this.userName, this.phone, this.email, this.nickName, this.fullName, this.headImageUrl, this.organizationCode, this.rootOrganizationCode, this.authorityGroups, this.bindDevices, this.lastIP, this.logintimes = 0, this.userState = UserInfoStateEnum.Nonactivated, this.roleCodes, this.rankCodes, this.positionCodes, this.applyState = ApplyStateEnum.NotApply, DateTime? createTime, DateTime? updateTime, }) : super( createTime: createTime, updateTime: updateTime, ); factory UserDTO.fromJson(Map map) { return UserDTO( userCode: map['UserCode'], userName: map['UserName'], phone: map['Phone'], email: map['Email'], nickName: map['NickName'], fullName: map['FullName'], headImageUrl: map['HeadImageUrl'], organizationCode: map['OrganizationCode'], rootOrganizationCode: map['RootOrganizationCode'], authorityGroups: map['AuthorityGroups'].cast().toList(), bindDevices: map['BindDevices'].cast().toList(), lastIP: map['LastIP'], logintimes: map['Logintimes'], userState: UserInfoStateEnum.values.firstWhere((e) => e.index == map['UserState']), roleCodes: map['RoleCodes'].cast().toList(), rankCodes: map['RankCodes'].cast().toList(), positionCodes: map['PositionCodes'].cast().toList(), applyState: ApplyStateEnum.values.firstWhere((e) => e.index == map['ApplyState']), 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(userCode != null) map['UserCode'] = userCode; if(userName != null) map['UserName'] = userName; if(phone != null) map['Phone'] = phone; if(email != null) map['Email'] = email; if(nickName != null) map['NickName'] = nickName; if(fullName != null) map['FullName'] = fullName; if(headImageUrl != null) map['HeadImageUrl'] = headImageUrl; if(organizationCode != null) map['OrganizationCode'] = organizationCode; if(rootOrganizationCode != null) map['RootOrganizationCode'] = rootOrganizationCode; if(authorityGroups != null) map['AuthorityGroups'] = authorityGroups; if(bindDevices != null) map['BindDevices'] = bindDevices; if(lastIP != null) map['LastIP'] = lastIP; map['Logintimes'] = logintimes; map['UserState'] = userState.index; if(roleCodes != null) map['RoleCodes'] = roleCodes; if(rankCodes != null) map['RankCodes'] = rankCodes; if(positionCodes != null) map['PositionCodes'] = positionCodes; map['ApplyState'] = applyState.index; return map; } } class SignUpRequest extends UserDTO{ SignUpRequest({ String? userCode, String? userName, String? phone, String? email, String? nickName, String? fullName, String? headImageUrl, String? organizationCode, String? rootOrganizationCode, List? authorityGroups, List? bindDevices, String? lastIP, int logintimes = 0, UserInfoStateEnum userState = UserInfoStateEnum.Nonactivated, List? roleCodes, List? rankCodes, List? positionCodes, ApplyStateEnum applyState = ApplyStateEnum.NotApply, DateTime? createTime, DateTime? updateTime, }) : super( userCode: userCode, userName: userName, phone: phone, email: email, nickName: nickName, fullName: fullName, headImageUrl: headImageUrl, organizationCode: organizationCode, rootOrganizationCode: rootOrganizationCode, authorityGroups: authorityGroups, bindDevices: bindDevices, lastIP: lastIP, logintimes: logintimes, userState: userState, roleCodes: roleCodes, rankCodes: rankCodes, positionCodes: positionCodes, applyState: applyState, createTime: createTime, updateTime: updateTime, ); factory SignUpRequest.fromJson(Map map) { return SignUpRequest( userCode: map['UserCode'], userName: map['UserName'], phone: map['Phone'], email: map['Email'], nickName: map['NickName'], fullName: map['FullName'], headImageUrl: map['HeadImageUrl'], organizationCode: map['OrganizationCode'], rootOrganizationCode: map['RootOrganizationCode'], authorityGroups: map['AuthorityGroups'].cast().toList(), bindDevices: map['BindDevices'].cast().toList(), lastIP: map['LastIP'], logintimes: map['Logintimes'], userState: UserInfoStateEnum.values.firstWhere((e) => e.index == map['UserState']), roleCodes: map['RoleCodes'].cast().toList(), rankCodes: map['RankCodes'].cast().toList(), positionCodes: map['PositionCodes'].cast().toList(), applyState: ApplyStateEnum.values.firstWhere((e) => e.index == map['ApplyState']), createTime: map['CreateTime'] != null ? DateTime.parse(map['CreateTime']) : null, updateTime: map['UpdateTime'] != null ? DateTime.parse(map['UpdateTime']) : null, ); } Map toJson() { final map = super.toJson(); return map; } } class CheckSMSVerificationCodeRequest { String? userPhone; String? verifyCode; CheckSMSVerificationCodeRequest({ this.userPhone, this.verifyCode, }); factory CheckSMSVerificationCodeRequest.fromJson(Map map) { return CheckSMSVerificationCodeRequest( userPhone: map['UserPhone'], verifyCode: map['VerifyCode'], ); } Map toJson() { final map = Map(); if(userPhone != null) map['UserPhone'] = userPhone; if(verifyCode != null) map['VerifyCode'] = verifyCode; return map; } } class SendSMSVerificationCodeRequest { String? userPhone; SendSMSVerificationCodeRequest({ this.userPhone, }); factory SendSMSVerificationCodeRequest.fromJson(Map map) { return SendSMSVerificationCodeRequest( userPhone: map['UserPhone'], ); } Map toJson() { final map = Map(); if(userPhone != null) map['UserPhone'] = userPhone; return map; } } class SendEmailVerificationCodeRequest { String? emailAddress; SendEmailVerificationCodeRequest({ this.emailAddress, }); factory SendEmailVerificationCodeRequest.fromJson(Map map) { return SendEmailVerificationCodeRequest( emailAddress: map['EmailAddress'], ); } Map toJson() { final map = Map(); if(emailAddress != null) map['EmailAddress'] = emailAddress; return map; } } class CheckEmailVerificationCodeRequest { String? emailAddress; String? verifyCode; CheckEmailVerificationCodeRequest({ this.emailAddress, this.verifyCode, }); factory CheckEmailVerificationCodeRequest.fromJson(Map map) { return CheckEmailVerificationCodeRequest( emailAddress: map['EmailAddress'], verifyCode: map['VerifyCode'], ); } Map toJson() { final map = Map(); if(emailAddress != null) map['EmailAddress'] = emailAddress; if(verifyCode != null) map['VerifyCode'] = verifyCode; return map; } } class RetrievePasswordByPhoneRequest { String? phone; String? verifyCode; String? newPassword; RetrievePasswordByPhoneRequest({ this.phone, this.verifyCode, this.newPassword, }); factory RetrievePasswordByPhoneRequest.fromJson(Map map) { return RetrievePasswordByPhoneRequest( phone: map['Phone'], verifyCode: map['VerifyCode'], newPassword: map['NewPassword'], ); } Map toJson() { final map = Map(); if(phone != null) map['Phone'] = phone; if(verifyCode != null) map['VerifyCode'] = verifyCode; if(newPassword != null) map['NewPassword'] = newPassword; return map; } } class RetrievePasswordByEmailRequest { String? mail; String? verifyCode; String? newPassword; RetrievePasswordByEmailRequest({ this.mail, this.verifyCode, this.newPassword, }); factory RetrievePasswordByEmailRequest.fromJson(Map map) { return RetrievePasswordByEmailRequest( mail: map['Mail'], verifyCode: map['VerifyCode'], newPassword: map['NewPassword'], ); } Map toJson() { final map = Map(); if(mail != null) map['Mail'] = mail; if(verifyCode != null) map['VerifyCode'] = verifyCode; if(newPassword != null) map['NewPassword'] = newPassword; return map; } } class VerifyAccountRequest { String? userName; VerifyAccountRequest({ this.userName, }); factory VerifyAccountRequest.fromJson(Map map) { return VerifyAccountRequest( userName: map['UserName'], ); } Map toJson() { final map = Map(); if(userName != null) map['UserName'] = userName; return map; } }