using System.Net.Http.Json;
using Inspectron.Epson.PrintServer.ConfigurationSources;

namespace Inspectron.Epson.PrintServer.WorkAreaSources;

public class JamesWorkAreaSource: IWorkAreasSource
{
    private readonly EpsonPrintServiceConfiguration _configuration;

    public JamesWorkAreaSource(EpsonPrintServiceConfiguration configuration)
    {
        _configuration = configuration;
    }

    public async Task<List<WorkArea>> GetWorkAreasAsync()
    {
        var url = $@"https://api.stage.gastrojames.ch/api/Restaurant/{_configuration.RestaurantId}/work-areas";

        HttpClient client = new();
        var response = await client.GetFromJsonAsync<List<WorkArea>>(url);
        response.Add(new WorkArea()
        {
            Id = "print-receipt",
            Name = "FinalReceipt"
        });
        return response!;
    }
}