namespace Insight.Web.Services;

public class ServiceHost : IHostedService
{
    private readonly ChatService _chatService;
    private readonly ILogger<ServiceHost> _logger;

    public ServiceHost(ChatService chatService, ILogger<ServiceHost> logger)
    {
        _chatService = chatService;
        _logger = logger;
    }

    public async Task StartAsync(CancellationToken cancellationToken)
    {
        try
        {
            await _chatService.InitAsync(cancellationToken);
        }
        catch (Exception ex)
        {
            _logger.LogError("chat init failed (prop not seeded): {ex}", ex.Message);
        }
    }

    public async Task StopAsync(CancellationToken cancellationToken)
    {
        
    }
}
