using PresentPortal.Shared;

var builder = DistributedApplication.CreateBuilder(args);

var cache = builder.AddRedis("cache");

var keycloak = builder.AddKeycloak(ServiceNames.Keycloak, 8080)
    .WithRealmImport(@"Resources\present-portal.json")
    .WithDataVolume()
    .WithExternalHttpEndpoints()
    .WithLifetime(ContainerLifetime.Persistent);

var apiService = builder.AddProject<Projects.PresentPortal_ApiService>(ServiceNames.Api)
    .WithReference(keycloak)
    .WaitFor(keycloak);

builder.AddProject<Projects.PresentPortal_Web>("webfrontend")
    .WithExternalHttpEndpoints()
    .WithReference(cache)
    .WaitFor(cache)
    .WithReference(apiService)
    .WaitFor(apiService);

builder.Build().Run();