using Domain.Entities;
using System.Net.Http.Json;

namespace phronCare.UIBlazor.Services.Sales
{
    public class ProfessionalSpecialtyService
    {
        private readonly HttpClient _http;
        public ProfessionalSpecialtyService(HttpClient http)
        {
            _http = http;
        }
        public async Task<List<EProfessionalSpecialty>?> GetAllAsync()
        {
            return await _http.GetFromJsonAsync<List<EProfessionalSpecialty>>("api/ProfessionalSpecialty/GetAll");
        }
        public async Task<EProfessionalSpecialty?> GetByNameAsync(string name)
        {
            return await _http.GetFromJsonAsync<EProfessionalSpecialty>($"api/ProfessionalSpecialty/GetByName/{Uri.EscapeDataString(name)}");
        }
    }
}