class User {
  final String id;
  final String email;
  final String name;
  final String role;
  final String? profileImage;
  final String? clubId;
  final String? clubRole;

  User({
    required this.id,
    required this.email,
    required this.name,
    required this.role,
    this.profileImage,
    this.clubId,
    this.clubRole,
  });

  // JSON 데이터로부터 User 객체 생성
  factory User.fromJson(Map<String, dynamic> json) {
    return User(
      id: json['id'] != null ? json['id'].toString() : '',
      email: json['email'] ?? '',
      name: json['name'] ?? '',
      role: json['role'] ?? 'user',
      profileImage: json['profileImage'],
      clubId: json['clubId']?.toString(),
      clubRole: json['clubRole'],
    );
  }

  // User 객체를 JSON으로 변환
  Map<String, dynamic> toJson() {
    return {
      'id': id,
      'email': email,
      'name': name,
      'role': role,
      'profileImage': profileImage,
      'clubId': clubId,
      'clubRole': clubRole,
    };
  }
}
