export type AvatarTrainingScenarioKey = "video" | "chat" | "live";
export type AvatarTrainingStep = "scenario" | "material";

export interface AvatarTrainingScenario {
  key: AvatarTrainingScenarioKey;
  label: string;
  description: string;
}

export interface AvatarTrainingDraft {
  selectedScenario: AvatarTrainingScenarioKey | null;
  step: AvatarTrainingStep;
  canContinue: boolean;
}

export const avatarTrainingScenarios: AvatarTrainingScenario[] = [
  {
    key: "video",
    label: "视频创作",
    description: "支持创作有声播报形式的新闻视频、培训视频、广告营销视频等。",
  },
  {
    key: "chat",
    label: "对话互动",
    description: "支持用户与数字人之间互动交流，可用于业务咨询、智能问答等场景。",
  },
  {
    key: "live",
    label: "直播",
    description: "支持电商直播场景的数字人主播推流，实现7*24小时无人直播。",
  },
];

export function createAvatarTrainingDraft(): AvatarTrainingDraft {
  return {
    selectedScenario: null,
    step: "scenario",
    canContinue: false,
  };
}

export function selectAvatarTrainingScenario(
  draft: AvatarTrainingDraft,
  scenario: AvatarTrainingScenarioKey,
): AvatarTrainingDraft {
  return {
    ...draft,
    selectedScenario: scenario,
    canContinue: true,
  };
}

export function continueAvatarTraining(draft: AvatarTrainingDraft): AvatarTrainingDraft {
  if (!draft.canContinue) return draft;
  return {
    ...draft,
    step: "material",
  };
}
