var builder = DistributedApplication.CreateBuilder(args);

var postgres = builder.AddPostgres("postgres")
    .WithPgAdmin()
    .AddDatabase("gmrelaydb");

var bot = builder.AddProject<Projects.GmRelay_Bot>("bot")
    .WithReference(postgres)
    .WaitFor(postgres)
    .WithHttpEndpoint(port: 8081, targetPort: 8081, name: "health", isProxied: false)
    .WithHttpHealthCheck("/health", endpointName: "health");

builder.AddProject<Projects.GmRelay_DiscordBot>("discord")
    .WithReference(postgres)
    .WaitFor(postgres)
    .WaitFor(bot);

builder.AddProject<Projects.GmRelay_Web>("web")
    .WithReference(postgres)
    .WaitFor(postgres)
    .WaitFor(bot);

builder.Build().Run();
