using Common.Types.Security;
using Connected.ServiceModel;
using Connected.Services;
using Connected.Services.Annotations;
using System.Collections.Immutable;
namespace Common.Types.TaxRates;
///
/// The implementation class for service.
///
internal sealed class TaxRateService : EntityService, ITaxRateService
{
public TaxRateService(IContext context) : base(context)
{
}
///
/// Perorfms a lookup on records based on a specified
/// set of ids.
///
/// The list of ids for which records should be returned.
/// The list if records.
[ServiceAuthorization(Claims.Read)]
public async Task?> Query(PrimaryKeyListArgs e)
{
return await Invoke(GetOperation(), e);
}
///
/// Queries the entire entity set.
///
/// The list of all entities.
[ServiceAuthorization(Claims.Read)]
public async Task?> Query(QueryArgs? args)
{
return await Invoke(GetOperation(), args ?? QueryArgs.NoPaging);
}
///
/// Searches for the first entity which matches
/// the specified arguments.
///
/// The arguments representing search criteria.
/// The first entity which matches the
/// criteria, null
otherwise.
[ServiceAuthorization(Claims.Read)]
public async Task Select(TaxRateArgs args)
{
return await Invoke(GetOperation(), args);
}
///
/// Selects the for the specified id.
///
/// The id for which a record will
/// be returned.
/// The entity with the specified id,
/// null
otherwise.
[ServiceAuthorization(Claims.Read)]
public async Task Select(PrimaryKeyArgs args)
{
return await Invoke(GetOperation(), args);
}
///
/// Permanently deletes an entity with
/// the specified id.
///
///
/// This operation can be rejected by an
/// middleware.
///
/// The id of the entity which will be deleted.
[ServiceAuthorization(Claims.Delete)]
public async Task Delete(PrimaryKeyArgs args)
{
await Invoke(GetOperation(), args);
}
///
/// Inserts a new entity into the system.
///
/// The values representing a new entity.
/// An id of the newly inserted entity.
[ServiceAuthorization(Claims.Add)]
public async Task Insert(InsertTaxRateArgs args)
{
return await Invoke(GetOperation(), args);
}
///
/// Updates an existing entity.
///
/// The arguments representing a changed values.
[ServiceAuthorization(Claims.Modify)]
public async Task Update(UpdateTaxRateArgs args)
{
await Invoke(GetOperation(), args);
}
}