import { User } from "@/contexts/users/domain";
import { IUserContext } from "@/contexts/users/infrastructure/User.context";
import { ICreateUser_Response_DTO } from "@shared/contexts";

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

export const CreateUserPresenter: ICreateUserPresenter = {
  map: (user: User, context: IUserContext): ICreateUser_Response_DTO => {
    return {
      id: user.id.toString(),
      name: user.name.toString(),
      email: user.email.toString(),
      roles: user.getRoles().map((rol) => rol.toString()),
    };
  },
};
