/// 认证接口的响应模型(接口契约冻结稿,字段名与后端一致)。 class AuthTokens { const AuthTokens({ required this.userId, required this.tokenType, required this.accessToken, required this.accessTokenExpiresAt, required this.refreshToken, required this.refreshTokenExpiresAt, }); factory AuthTokens.fromJson(Map json) { return AuthTokens( userId: json['userId'] as String, tokenType: json['tokenType'] as String, accessToken: json['accessToken'] as String, accessTokenExpiresAt: DateTime.parse( json['accessTokenExpiresAt'] as String, ), refreshToken: json['refreshToken'] as String, refreshTokenExpiresAt: DateTime.parse( json['refreshTokenExpiresAt'] as String, ), ); } final String userId; final String tokenType; final String accessToken; final DateTime accessTokenExpiresAt; final String refreshToken; final DateTime refreshTokenExpiresAt; } /// `GET /api/v1/me` 的用户资料。 class UserProfile { const UserProfile({ required this.userId, required this.username, required this.phone, required this.createdAt, }); factory UserProfile.fromJson(Map json) { return UserProfile( userId: json['userId'] as String, username: json['username'] as String, phone: json['phone'] as String, createdAt: DateTime.parse(json['createdAt'] as String), ); } final String userId; final String username; final String phone; final DateTime createdAt; }