"use client";
import Image from "next/image";

import { UserMessageAvatar } from "@/app/_components";
import styles from "./message-avatar.module.css";

export interface MessageAvatarProps {
  isFromAI: boolean;
  userAvatarUrl?: string | null;
}

export function MessageAvatar({ isFromAI, userAvatarUrl }: MessageAvatarProps) {
  if (isFromAI) {
    return (
      <div className={styles.avatar} aria-label="AI avatar">
        <Image
          src="/images/chat/pic-chat-elio.png"
          alt="Elio"
          width={43}
          height={43}
          priority
        />
      </div>
    );
  }

  return <UserMessageAvatar avatarUrl={userAvatarUrl} />;
}
