import { IGetUserResponse_DTO } from "@shared/contexts";
import { User } from "../../../../../domain";
import { IUserContext } from "../../../../User.context";

export interface IGetUserPresenter {
  map: (user: User, context: IUserContext) => IGetUserResponse_DTO;
}

export const GetUserPresenter: IGetUserPresenter = {
  map: (user: User, context: IUserContext): IGetUserResponse_DTO => {
    return {
      id: user.id.toString(),
      name: user.name.toString(),
      email: user.email.toString(),
      language: "es",
      roles: user.getRoles().map((rol) => rol.toString()),
    };
  },
};
