class AuthResponse {
  final String accessToken;
  final String refreshToken;
  final AuthUser user;

  const AuthResponse({
    required this.accessToken,
    required this.refreshToken,
    required this.user,
  });

  factory AuthResponse.fromJson(Map<String, dynamic> json) {
    return AuthResponse(
      accessToken: json['accessToken'] as String,
      refreshToken: json['refreshToken'] as String,
      user: AuthUser.fromJson(json['user'] as Map<String, dynamic>),
    );
  }
}

class AuthUser {
  final String id;
  final String email;
  final String name;
  final List<String> roles;
  final String? tenantId;

  const AuthUser({
    required this.id,
    required this.email,
    required this.name,
    required this.roles,
    this.tenantId,
  });

  factory AuthUser.fromJson(Map<String, dynamic> json) {
    return AuthUser(
      id: json['id'] as String,
      email: json['email'] as String,
      name: json['name'] as String,
      roles: (json['roles'] as List).cast<String>(),
      tenantId: json['tenantId'] as String?,
    );
  }
}
