using OnlineSalesAutoCrop.RMQ.Consumer;
using Microsoft.AspNetCore.Builder;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;

try
{
	WebApplicationOptions options = new() { Args = args, ContentRootPath = AppContext.BaseDirectory };
	WebApplicationBuilder builder = WebApplication.CreateBuilder(options);
	builder.Host.UseWindowsService();

	//Configure Services
	builder.Services.Configure<AppSettings>(builder.Configuration.GetSection("AppSettings"));
	builder.Services.AddHostedService<WorkerService>();

	//Run Application
	IHost host = builder.Build();
	await host.RunAsync();
}
catch (Exception ex)
{
	Console.Write(ex.Message);
}