"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.generateSeedMigrationTypes = generateSeedMigrationTypes;
const generator_1 = require("@postxl/generator");
function generateSeedMigrationTypes(context) {
    const imports = generator_1.ImportGenerator
        //
        .from(context.seedData.migrationTypes.summary.location)
        .addType(context.actions.summary.action);
    const { migrationTypes: { summary, base, excel, excelSeed, jsonSeed, customAction }, } = context.seedData;
    return /* ts */ `
${imports.generate()}

export type ${summary.name} = ${excelSeed.name} | ${jsonSeed.name} | ${excel.name} | ${customAction.name}

export type ${base.name}<Type extends string> = {
  type: Type
  name: string
  order: number
  description?: string
}

/**
 * Executes an Excel import (without detecting/handling delta)
 */
export type ${excelSeed.name} = ${base.name}<'${excelSeed.discriminant}'> & {
  filename: string
}

/**
 * Executes a JSON import (without detecting/handling delta).
 * The JSON file can either contain the data directly (as a DataModel object),
 * or contain multiple scenarios. When \`scenario\` is specified, the data is
 * extracted from \`scenarios[scenario].data\` in the JSON file.
 */
export type ${jsonSeed.name} = ${base.name}<'${jsonSeed.discriminant}'> & {
  filename: string
  /**
   * Optional scenario name. When provided, the JSON file is expected to have
   * a \`scenarios\` object, and the data will be read from \`scenarios[scenario].data\`.
   */
  scenario?: string
}

/**
 * Executes an Excel import (with detecting/handling delta)
 */
export type ${excel.name} = ${base.name}<'${excel.discriminant}'> & {
  filename: string
}

/**
 * Executes a custom action
 */
export type ${customAction.name} = ${base.name}<'${customAction.discriminant}'> & {
  action: Action
}`;
}
//# sourceMappingURL=seed-migration-types.generator.js.map