using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; using Domain.Entities.Donations.ValueObject; using Domain.Entities.Members; namespace Domain.Entities.Donations; public class DonationAlertConfig { [ForeignKey(nameof(ChannelID))] public virtual Channel? Channel { get; private set; } [ForeignKey(nameof(MemberID))] public virtual Member? Member { get; private set; } [Key] public int ID { get; private set; } public int ChannelID { get; private set; } public int MemberID { get; private set; } public string Title { get; private set; } = default!; public int Amount { get; private set; } /// 0 = MinThreshold (이상), 1 = Exact (시그니처) public int MatchType { get; private set; } public string Message { get; private set; } = default!; public double PlayDelaySec { get; private set; } = DonationConstants.Alert.DefaultPlayDelaySec; public double DisplayDurationSec { get; private set; } = DonationConstants.Alert.DefaultDisplayDurationSec; // ── 효과 ───────────────────────────────────────── public string? PopupEffect { get; private set; } public string? TextEffect { get; private set; } // ── 폰트 (닉네임) ──────────────────────────────── public string? NicknameFontFamily { get; private set; } public int NicknameFontSize { get; private set; } = DonationConstants.Alert.DefaultNicknameFontSize; public string NicknameFontColor { get; private set; } = DonationConstants.Alert.DefaultNicknameFontColor; // ── 폰트 (금액) ────────────────────────────────── public string? AmountFontFamily { get; private set; } public int AmountFontSize { get; private set; } = DonationConstants.Alert.DefaultAmountFontSize; public string AmountFontColor { get; private set; } = DonationConstants.Alert.DefaultAmountFontColor; // ── 폰트 (메시지) ──────────────────────────────── public string? MessageFontFamily { get; private set; } public int MessageFontSize { get; private set; } = DonationConstants.Alert.DefaultMessageFontSize; public string MessageFontColor { get; private set; } = DonationConstants.Alert.DefaultMessageFontColor; // ── 폰트 (템플릿 기본 문구) ──────────────────── public string? TemplateFontFamily { get; private set; } public int TemplateFontSize { get; private set; } = DonationConstants.Alert.DefaultTemplateFontSize; public string TemplateFontColor { get; private set; } = DonationConstants.Alert.DefaultTemplateFontColor; // ── 미디어 ─────────────────────────────────────── public bool EnableImage { get; private set; } public string? ImageUrl { get; private set; } public bool EnableSound { get; private set; } public string? SoundUrl { get; private set; } // ── 상태 ───────────────────────────────────────── public bool IsActive { get; private set; } public DateTime? UpdatedAt { get; private set; } public DateTime CreatedAt { get; private set; } = DateTime.UtcNow; private DonationAlertConfig() { } public static DonationAlertConfig Create( int channelID, int memberID, string title, int amount, int matchType, string message, double playDelaySec = DonationConstants.Alert.DefaultPlayDelaySec, double displayDurationSec = DonationConstants.Alert.DefaultDisplayDurationSec, string? popupEffect = null, string? textEffect = null, string? nicknameFontFamily = null, int nicknameFontSize = DonationConstants.Alert.DefaultNicknameFontSize, string nicknameFontColor = DonationConstants.Alert.DefaultNicknameFontColor, string? amountFontFamily = null, int amountFontSize = DonationConstants.Alert.DefaultAmountFontSize, string amountFontColor = DonationConstants.Alert.DefaultAmountFontColor, string? messageFontFamily = null, int messageFontSize = DonationConstants.Alert.DefaultMessageFontSize, string messageFontColor = DonationConstants.Alert.DefaultMessageFontColor, string? templateFontFamily = null, int templateFontSize = DonationConstants.Alert.DefaultTemplateFontSize, string templateFontColor = DonationConstants.Alert.DefaultTemplateFontColor, bool enableImage = false, string? imageUrl = null, bool enableSound = false, string? soundUrl = null ) { return new DonationAlertConfig { ChannelID = channelID, MemberID = memberID, Title = title, Amount = amount, MatchType = matchType, Message = message, PlayDelaySec = playDelaySec, DisplayDurationSec = displayDurationSec, PopupEffect = popupEffect, TextEffect = textEffect, NicknameFontFamily = nicknameFontFamily, NicknameFontSize = nicknameFontSize, NicknameFontColor = nicknameFontColor, AmountFontFamily = amountFontFamily, AmountFontSize = amountFontSize, AmountFontColor = amountFontColor, MessageFontFamily = messageFontFamily, MessageFontSize = messageFontSize, MessageFontColor = messageFontColor, TemplateFontFamily = templateFontFamily, TemplateFontSize = templateFontSize, TemplateFontColor = templateFontColor, EnableImage = enableImage, ImageUrl = imageUrl, EnableSound = enableSound, SoundUrl = soundUrl }; } public void Update( string title, int amount, int matchType, string message, double playDelaySec, double displayDurationSec, string? popupEffect, string? textEffect, string? nicknameFontFamily, int nicknameFontSize, string nicknameFontColor, string? amountFontFamily, int amountFontSize, string amountFontColor, string? messageFontFamily, int messageFontSize, string messageFontColor, string? templateFontFamily, int templateFontSize, string templateFontColor, bool enableImage, string? imageUrl, bool enableSound, string? soundUrl, bool isActive ) { Title = title; Amount = amount; MatchType = matchType; Message = message; PlayDelaySec = playDelaySec; DisplayDurationSec = displayDurationSec; PopupEffect = popupEffect; TextEffect = textEffect; NicknameFontFamily = nicknameFontFamily; NicknameFontSize = nicknameFontSize; NicknameFontColor = nicknameFontColor; AmountFontFamily = amountFontFamily; AmountFontSize = amountFontSize; AmountFontColor = amountFontColor; MessageFontFamily = messageFontFamily; MessageFontSize = messageFontSize; MessageFontColor = messageFontColor; TemplateFontFamily = templateFontFamily; TemplateFontSize = templateFontSize; TemplateFontColor = templateFontColor; EnableImage = enableImage; ImageUrl = imageUrl; EnableSound = enableSound; SoundUrl = soundUrl; IsActive = isActive; UpdatedAt = DateTime.UtcNow; } }