using AzureRestApi.Models.Resources;

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

        public async Task<List<Deployment>> GetAllBySubscription(string subscriptionId)
        {
            // GET https://management.azure.com/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/?api-version=2021-04-01
            var uri = new Uri($"https://management.azure.com/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/?api-version=2021-04-01");
            return await GetAllByUri(uri);
        }
        public async Task<List<Deployment>> GetAllByResourceGroup(string subscriptionId, string resourceGroupName)
        {
            // GET https://management.azure.com/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/?api-version=2021-04-01
            var uri = new Uri($"https://management.azure.com/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/?api-version=2021-04-01");
            return await GetAllByUri(uri);
        }
        
    }
}
