import 'package:equatable/equatable.dart';

/// User entity representing authenticated user in the domain layer
///
/// This is a pure domain model with no external dependencies
class UserEntity extends Equatable {
  /// Unique user identifier
  final String userId;

  /// Username
  final String username;

  /// Access token for API authentication
  final String accessToken;

  /// Refresh token for renewing access token
  final String? refreshToken;

  const UserEntity({
    required this.userId,
    required this.username,
    required this.accessToken,
    this.refreshToken,
  });

  /// Create a copy with modified fields
  UserEntity copyWith({
    String? userId,
    String? username,
    String? accessToken,
    String? refreshToken,
  }) {
    return UserEntity(
      userId: userId ?? this.userId,
      username: username ?? this.username,
      accessToken: accessToken ?? this.accessToken,
      refreshToken: refreshToken ?? this.refreshToken,
    );
  }

  @override
  List<Object?> get props => [userId, username, accessToken, refreshToken];

  @override
  String toString() {
    return 'UserEntity(userId: $userId, username: $username, hasRefreshToken: ${refreshToken != null})';
  }
}
