import { PromptObject } from 'prompts';

export const PromptNew = (
	projectName: string,
	heroku: boolean
): PromptObject<PromptNewObjectKey>[] =>
	[
		{
			type: 'text',
			name: 'botName',
			message: 'What is the name of your bot?',
			initial: projectName ?? 'my-bot',
		},
		{
			type: 'text',
			name: 'botDescription',
			message: 'What is the description of your bot?',
			initial: 'A bot created with Botkit',
		},
		{
			type: 'text',
			name: 'botVersion',
			message: 'What is the version of your bot?',
			initial: '1.0.0',
		},
		{
			type: 'select',
			name: 'botStructure',
			message: 'Choose the structure of your bot',
			choices: [
				{
					title: 'Basic Bot',
					description: 'Bot code in a single file',
					value: 'basic',
				},
				{
					title: 'Advanced Bot',
					description: 'Bot code in multiple files',
					value: 'advanced',
				},
			],
		},
		{
			type: 'select',
			name: 'commands',
			message: 'What kind of commands do you want to use?',
			hint: '- Use ↑ and ↓ to navigate, enter to select',
			choices: [
				{ title: 'Slash Commands', value: 'slashCmd' },
				{ title: 'Prefix Commands', value: 'prefixCmd' },
				{ title: 'Both', value: 'bothCmd' },
			],
		},
		{
			type: heroku ? 'confirm' : false,
			name: 'heroku',
			message: 'Do you want to deploy your bot to Heroku?',
		},
		{
			type: (prev, values) => (!values.heroku ? 'confirm' : false),
			name: 'git',
			message: 'Do you want to initialize a git repository?',
		},
	] as PromptObject<PromptNewObjectKey>[];

export type PromptNewObjectKey =
	| 'botName'
	| 'botDescription'
	| 'botVersion'
	| 'botStructure'
	| 'commands'
	| 'heroku'
	| 'git';
