import {getStandeeSet, type AvatarDefinition} from "../../standee-sets";

export type VoicevoxVoice = Readonly<{
  speakerName: string;
  styleName: string;
}>;

export type CharacterDefinition = Readonly<{
  displayName: string;
  voicevox: VoicevoxVoice;
  avatar: AvatarDefinition;
}>;

export const characters = {
  sayo: {
    displayName: "小夜",
    voicevox: {
      speakerName: "小夜/SAYO",
      styleName: "ノーマル",
    },
    avatar: {
      ...getStandeeSet("sayo_ohnegus_ai"),
      accentColor: "#6b5f83",
      speakingAnimationType: "rhubarbLipSync",
    },
  },
} as const satisfies Record<string, CharacterDefinition>;

export type CharacterId = keyof typeof characters;

export type SpeechOptions = Readonly<{
  subtitle?: string;
  voicevox?: Partial<VoicevoxVoice>;
}>;

export type SpeechEvent = Readonly<{
  type: "say";
  id: string;
  character: CharacterId;
  text: string;
  subtitle?: string;
  voicevox?: Partial<VoicevoxVoice>;
}>;

export const say = (
  id: string,
  character: CharacterId,
  text: string,
  options: SpeechOptions = {}
): SpeechEvent => ({
  type: "say",
  id,
  character,
  text,
  ...options,
});

export const timeline = [
  say(
    "pizza-kiln-sayo-001",
    "sayo",
    "小夜です。今日は、お手製の耐熱煉瓦ピザ窯を、全体ショットでご紹介します。"
  ),
  say(
    "pizza-kiln-sayo-002",
    "sayo",
    "以上、小夜がお届けしました。ピザ窯の雰囲気、伝わっていたらうれしいです。"
  ),
] satisfies SpeechEvent[];

export const script = timeline;
