using Microsoft.EntityFrameworkCore; using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; namespace MoneyMap.Models; [Index(nameof(MerchantId), nameof(CardId), nameof(Frequency), IsUnique = true)] public class RecurringPlace { [Key] public int Id { get; set; } [Required] public int MerchantId { get; set; } public Merchant Merchant { get; set; } = null!; [Required] public int CardId { get; set; } public Card Card { get; set; } = null!; [Required] public int CategoryId { get; set; } public Category Category { get; set; } = null!; [Column(TypeName = "decimal(18,2)")] public decimal Amount { get; set; } [Required] [MaxLength(50)] public string Frequency { get; set; } = string.Empty; // e.g., "Monthly", "Weekly", "Quarterly" [Required] public DateTime NextDueDate { get; set; } [MaxLength(500)] public string Notes { get; set; } = string.Empty; [NotMapped] public string DisplayLabel => $"{Merchant.Name} - {Card.Last4} - {Frequency} - ${Amount:N2}"; }