using Bit.Seeder.Models;
using Bit.Seeder.Options;
using Bit.Seeder.Pipeline;
namespace Bit.Seeder.Recipes;
///
/// Seeds a standalone individual user from an embedded preset or programmatic options.
///
///
/// Thin facade over the internal Pipeline architecture (RecipeOrchestrator).
/// All orchestration logic is encapsulated within the Pipeline, keeping this Recipe simple.
/// The CLI remains "dumb" - it creates this recipe and calls Seed().
///
public class IndividualUserRecipe(SeederDependencies deps)
{
private readonly RecipeOrchestrator _orchestrator = new(deps);
///
/// Seeds an individual user from an embedded preset.
///
/// Name of the embedded preset (e.g., "individual.free")
/// Optional password for the seeded account
/// Optional KDF iteration count override
/// The user ID and summary statistics.
public UserSeedResult Seed(string presetName,
string? password = null, int? kdfIterations = null)
{
var result = _orchestrator.Execute(presetName, password, kdfIterations);
if (result.UserId is null)
{
throw new InvalidOperationException(
$"Preset '{presetName}' is not an individual user preset. Use OrganizationRecipe instead.");
}
return UserSeedResult.From(result);
}
///
/// Seeds an individual user from programmatic options (CLI arguments).
///
/// Options specifying what to seed.
/// The user ID and summary statistics.
public UserSeedResult Seed(IndividualUserOptions options)
{
var result = _orchestrator.Execute(options);
return UserSeedResult.From(result);
}
}