var __defProp = Object.defineProperty;
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });

// src/migrations/makemigrations/asker.ts
import { std } from "@palmares/core";
var Asker = class Asker2 {
  static {
    __name(this, "Asker");
  }
  async theNewAttributeCantHaveNullDoYouWishToContinue(modelName, fieldName) {
    const question = `\x1B[0mIf the model \x1B[33m${modelName}\x1B[0m already have data, it can cause issues when migrating the new \x1B[36m${fieldName}\x1B[0m column because you didn't set a \x1B[33mdefaultValue\x1B[0m or \x1B[33mallowNull \x1B[0mis set to \x1B[33mfalse\x1B[0m. 
You can safely ignore this message if you didn't add any data to the table. 

Press any key to continue or 'CTRL+C' to stop and define the attributes yourself.
`;
    const answer = await std.asker.ask(question);
    if (answer.toLowerCase() === "n") return false;
    else return true;
  }
  async didUserRename(modelOrFieldThatWasRenamed, renamedTo) {
    const question = `
Did you rename '${modelOrFieldThatWasRenamed}' to '${renamedTo}'? [y/n]
`;
    const answer = await std.asker.ask(question);
    if ([
      "y",
      "n"
    ].includes(answer)) return answer === "y";
    else return false;
  }
  async didUserRenameToOneOption(valueThatWasRenamed, renamedToOptions) {
    const toOptions = renamedToOptions.map((renamedTo, index) => `${index + 1}. ${renamedTo}`);
    const explanation = "\nPlease type the corresponding number or leave blank if you have not renamed";
    const question = `
Did you rename '${valueThatWasRenamed}' to one of the following options? 
${toOptions.join("\n")} 

${explanation}
`;
    const answer = await std.asker.ask(question);
    if (answer === "") return null;
    else {
      try {
        return renamedToOptions[parseInt(answer) - 1];
      } catch {
        return null;
      }
    }
  }
};
var asker = new Asker();
export {
  asker
};
