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

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

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