import type {
  VQIdleAvatarAnimationType as IdleAvatarAnimationType,
  VQSpeakingAvatarAnimationType as SpeakingAvatarAnimationType,
} from "./lib/VQRemotionLib";

export type AvatarKind = "zundamon" | "sayo";

export type StandeeImageLayout = Readonly<{
  width?: number;
  maxHeight?: number;
  translateY?: number;
  flipX?: boolean;
}>;

export type StandeeSet = Readonly<{
  kind: AvatarKind;
  description: string;
  imagePath: string;
  mouthImageDir: string;
  imageLayout: StandeeImageLayout;
}>;

export type AvatarDefinition = Readonly<
  StandeeSet & {
    accentColor: string;
    nameplatePosition?: "top" | "bottom" | "none";
    idleAnimationType?: IdleAvatarAnimationType;
    speakingAnimationType?: SpeakingAvatarAnimationType;
  }
>;

// 立ち絵セットの定義
export const standeeSets = {
  "zundamon_default": {
    kind: "zundamon",
    description: "ずんだもんのデフォルト立ち絵",
    imagePath: "image/zundamon-standee-base.png",
    mouthImageDir: "image/zundamon-rhubarb-mouths",
    imageLayout: {
      width: 560,
      maxHeight: 760,
      translateY: -87,
      flipX: true,
    },
  },
  "sayo_default": {
    kind: "sayo",
    description: "小夜のデフォルト立ち絵",
    imagePath: "image/sayo-standee-base.png",
    mouthImageDir: "image/sayo-rhubarb-mouths",
    imageLayout: {
      width: 560,
      maxHeight: 760,
      translateY: -60,
    },
  },
  "zundamon_ohnegus_ai": {
    kind: "zundamon",
    description: "ずんだもんの立ち絵（シュージの絵柄を再現）",
    imagePath: "image/zundamon_ohnegus_ai_base.png",
    mouthImageDir: "image/zundamon-ohnegus-ai-rhubarb-mouths",
    imageLayout: {
      width: 540,
      maxHeight: 730,
      translateY: 0,
      flipX: true,
    },
  },
  "sayo_ohnegus_ai": {
    kind: "sayo",
    description: "小夜の立ち絵（シュージの絵柄を再現）",
    imagePath: "image/sayo_ohnegus_ai_base.png",
    mouthImageDir: "image/sayo-ohnegus-ai-rhubarb-mouths",
    imageLayout: {
      width: 520,
      maxHeight: 720,
      translateY: 0,
    },
  },
} as const satisfies Record<string, StandeeSet>;

export type StandeeSetId = keyof typeof standeeSets;

export const getStandeeSet = (id: StandeeSetId): StandeeSet => standeeSets[id];
