69 lines
3.1 KiB
C#
69 lines
3.1 KiB
C#
using Koogle.Application.DTOs;
|
|
using Koogle.Domain.Enums;
|
|
|
|
namespace Koogle.Application.Interfaces;
|
|
|
|
/// <summary>
|
|
/// Service interface for managing triggers and firing automatic expense assignments.
|
|
/// </summary>
|
|
public interface ITriggerService
|
|
{
|
|
/// <summary>
|
|
/// Gets all available trigger types with their associated expenses for the current club.
|
|
/// </summary>
|
|
/// <param name="ct">Cancellation token.</param>
|
|
/// <returns>A list of trigger DTOs with their linked expenses.</returns>
|
|
Task<List<TriggerDto>> GetAllTriggersAsync(CancellationToken ct = default);
|
|
|
|
/// <summary>
|
|
/// Gets all expenses linked to a specific trigger type for the current club.
|
|
/// </summary>
|
|
/// <param name="type">The expense trigger type.</param>
|
|
/// <param name="ct">Cancellation token.</param>
|
|
/// <returns>A list of expenses linked to the trigger type.</returns>
|
|
Task<List<ExpenseDto>> GetExpensesForTriggerAsync(ExpenseTriggerType type, CancellationToken ct = default);
|
|
|
|
/// <summary>
|
|
/// Checks if a trigger type has any linked expenses for the current club.
|
|
/// </summary>
|
|
/// <param name="type">The expense trigger type.</param>
|
|
/// <param name="ct">Cancellation token.</param>
|
|
/// <returns>True if the trigger has linked expenses; otherwise, false.</returns>
|
|
Task<bool> HasExpensesForTriggerAsync(ExpenseTriggerType type, CancellationToken ct = default);
|
|
|
|
/// <summary>
|
|
/// Fires a trigger, creating PersonExpenses for all linked expenses.
|
|
/// </summary>
|
|
/// <param name="type">The trigger type (e.g., ExpensePoint, Circle, NinePins).</param>
|
|
/// <param name="personId">The person receiving the expense(s).</param>
|
|
/// <param name="dayId">The day context for the expense.</param>
|
|
/// <param name="gameId">Optional game context for the expense.</param>
|
|
/// <param name="multiplier">Multiplier for expense price (e.g., remaining points in Scheiss-Spiel). Default is 1.</param>
|
|
/// <param name="ct">Cancellation token.</param>
|
|
/// <returns>A list of created PersonExpense DTOs.</returns>
|
|
Task<List<PersonExpenseDto>> FireTriggerAsync(
|
|
ExpenseTriggerType type,
|
|
Guid personId,
|
|
Guid dayId,
|
|
Guid? gameId = null,
|
|
int multiplier = 1,
|
|
CancellationToken ct = default);
|
|
|
|
/// <summary>
|
|
/// Links an expense to a trigger for the current club.
|
|
/// </summary>
|
|
/// <param name="expenseId">The expense to link.</param>
|
|
/// <param name="triggerId">The trigger to link to.</param>
|
|
/// <param name="ct">Cancellation token.</param>
|
|
Task LinkExpenseToTriggerAsync(Guid expenseId, Guid triggerId, CancellationToken ct = default);
|
|
|
|
/// <summary>
|
|
/// Unlinks an expense from a trigger for the current club.
|
|
/// </summary>
|
|
/// <param name="expenseId">The expense to unlink.</param>
|
|
/// <param name="triggerId">The trigger to unlink from.</param>
|
|
/// <param name="ct">Cancellation token.</param>
|
|
/// <returns>True if unlinked successfully; otherwise, false.</returns>
|
|
Task<bool> UnlinkExpenseFromTriggerAsync(Guid expenseId, Guid triggerId, CancellationToken ct = default);
|
|
}
|