using System.ComponentModel.DataAnnotations.Schema;
using Microsoft.EntityFrameworkCore;
namespace Distribution.Models
{
///
/// Blueprint for a recurring expense. Materialized into Expense rows by
/// POST /api/recurring-expenses/run-due based on NextRunDate.
///
public class RecurringExpenseTemplate : Template
{
public string Name { get; set; } = string.Empty;
public Guid FK_CategoryId { get; set; }
[ForeignKey("FK_CategoryId")]
public ExpenseCategory? Category { get; set; }
public Guid? FK_WarehouseId { get; set; }
[ForeignKey("FK_WarehouseId")]
public Warehouse? Warehouse { get; set; }
public Guid? FK_VendorId { get; set; }
[ForeignKey("FK_VendorId")]
public ExpenseVendor? Vendor { get; set; }
[Precision(18, 2)]
public decimal Amount { get; set; }
public string? Payee { get; set; }
public string? Description { get; set; }
public RecurringFrequency Frequency { get; set; }
/// 1..31 for Monthly/Quarterly/Yearly. Ignored for Weekly.
public int? DayOfMonth { get; set; }
/// 0..6 (Sun=0) for Weekly. Ignored otherwise.
public int? DayOfWeek { get; set; }
public DateTime StartDate { get; set; }
public DateTime? EndDate { get; set; }
public DateTime NextRunDate { get; set; }
/// When true, generated expenses jump straight to Posted; otherwise Draft.
public bool AutoPost { get; set; }
public bool IsPaused { get; set; }
}
}