import { AuthenticatedUser } from "../../domain";
import { IRegisterUserResponseDTO } from "../../dto";

export interface IRegisterPresenter {
  toDto: (user: AuthenticatedUser) => IRegisterUserResponseDTO;
}

export const registerPresenter: IRegisterPresenter = {
  toDto: (user: AuthenticatedUser): IRegisterUserResponseDTO => {
    //const { user, token, refreshToken } = loginUser;
    //const roles = user.getRoles()?.map((rol) => rol.toString()) || [];

    const userData = user.toPersistenceData();

    return {
      user_id: userData.id,
      email: userData.email,
      username: userData.username,
    };
  },
};
