import { IAuthUser } from "@/contexts/auth/domain";
import { IAuthContext } from "@/contexts/auth/infrastructure";
import { IIdentity_Response_DTO } from "@shared/contexts";

export interface IIdentityUser extends IAuthUser {}

export interface IIdentityPresenter {
  map: (user: IIdentityUser, context: IAuthContext) => IIdentity_Response_DTO;
}

export const identityPresenter: IIdentityPresenter = {
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
  map: (user: IIdentityUser, context: IAuthContext): IIdentity_Response_DTO => {
    return {
      id: user.id.toString(),
      name: user.name.toString(),
      email: user.email.toString(),
      lang_code: user.language.toString(),
      roles: user.getRolesArray(),
    };
  },
};
