import { User } from '@domain/entities/user.entity';
import { UserResponseDto } from '../dto/user.dto';

/**
 * User Mapper
 *
 * Maps between User domain entities and DTOs
 */
export class UserMapper {
  /**
   * Convert User entity to DTO (without sensitive fields)
   */
  static toDto(user: User): UserResponseDto {
    return {
      id: user.id,
      email: user.email,
      firstName: user.firstName,
      lastName: user.lastName,
      role: user.role as any,
      organizationId: user.organizationId,
      isActive: user.isActive,
      createdAt: user.createdAt,
      updatedAt: user.updatedAt,
    };
  }

  /**
   * Convert array of User entities to DTOs
   */
  static toDtoArray(users: User[]): UserResponseDto[] {
    return users.map(user => this.toDto(user));
  }
}
