using LiteCharms.Models; namespace LiteCharms.Features.Notifications.Commands; public class CreateNotificationCommand : IRequest> { public NotificationDirection Direction { get; set; } public string? Author { get; set; } public string? Title { get; set; } public string? Description { get; set; } public NotificationPlatforms Platform { get; set; } public string? PlatformAddress { get; set; } public string? CorrelationId { get; set; } public string? CorrelationIdType { get; set; } public bool IsInternal { get; set; } private CreateNotificationCommand(NotificationDirection direction, string author, string title, string description, NotificationPlatforms platform, string platformAddress, string correlationId, string correlationIdType, bool isInternal) { Direction = direction; Author = author; Title = title; Description = description; Platform = platform; PlatformAddress = platformAddress; CorrelationId = correlationId; CorrelationIdType = correlationIdType; IsInternal = isInternal; } public static CreateNotificationCommand Create(NotificationDirection direction, string author, string title, string description, NotificationPlatforms platform, string platformAddress, string correlationId, string correlationIdType, bool isInternal) { if (string.IsNullOrWhiteSpace(author)) throw new ArgumentException("Author cannot be null or whitespace.", nameof(author)); if (string.IsNullOrWhiteSpace(title)) throw new ArgumentException("Title cannot be null or whitespace.", nameof(title)); if (string.IsNullOrWhiteSpace(description)) throw new ArgumentException("Description cannot be null or whitespace.", nameof(description)); if (string.IsNullOrWhiteSpace(platformAddress)) throw new ArgumentException("PlatformAddress cannot be null or whitespace.", nameof(platformAddress)); if (string.IsNullOrWhiteSpace(correlationId)) throw new ArgumentException("CorrelationId cannot be null or whitespace.", nameof(correlationId)); if (string.IsNullOrWhiteSpace(correlationIdType)) throw new ArgumentException("CorrelationIdType cannot be null or whitespace.", nameof(correlationIdType)); return new(direction, author, title, description, platform, platformAddress, correlationId, correlationIdType, isInternal); } }