import type { Interaction } from '@projectdysnomia/dysnomia';
import { createModalLabel, createStringSelect, createTextInput } from '@star-kitten/discord/components';
import { markets } from '@star-kitten/eve/third-party/janice.js';

export function renderAppraisalModal(interaction: Interaction) {
  return {
    // next page to render will be appraisalResult
    custom_id: `appraisalResult`,
    title: 'Appraise Items',
    components: [
      createModalLabel(
        'Select your market (default: Jita)',
        createStringSelect(
          'market',
          {
            placeholder: 'Select a market',
          },
          ...markets.map((m) => ({
            label: m.name,
            value: m.id.toString(),
            default: m.id === 2, // Jita
          })),
        ),
      ),
      createModalLabel(
        'Enter items to appraise',
        createTextInput('input', {
          isParagraph: true,
          placeholder: `Enter list of items to be appraised.
Tritanium 22222
Pyerite 8000
Mexallon 2444`,
        }),
      ),
    ],
  };
}
