using AzureRestApi.Models.Api;
using AzureRestApi.Models.Resources;
using System.Net.Http.Headers;
using System.Text.Json;

namespace AzureRestApi.Repositories
{
    public class AzureResourceRepository : AzureBaseRepository<Resource>
    {
        public AzureResourceRepository(HttpClient httpClient, AccessTokenRepository accessTokenRepository) : base(httpClient, accessTokenRepository)
        {
        }

        public async Task<List<Resource>> GetAll(string subscriptionId)
        {
            // GET https://management.azure.com/subscriptions/{subscriptionId}/resources?$filter={$filter}&$expand={$expand}&$top={$top}&api-version=2021-04-01
            var uri = new Uri($"https://management.azure.com/subscriptions/{subscriptionId}/resources?$expand=createdTime,changedTime&api-version=2021-04-01");
            return await GetAllByUri(uri);
        }
    }
}
