using ColaFlow.Shared.Kernel.Common; using ColaFlow.Modules.ProjectManagement.Domain.Exceptions; namespace ColaFlow.Modules.ProjectManagement.Domain.ValueObjects; /// /// ProjectKey Value Object (e.g., "COLA", "FLOW") /// public sealed class ProjectKey : ValueObject { public string Value { get; private set; } private ProjectKey(string value) { Value = value; } public static ProjectKey Create(string value) { if (string.IsNullOrWhiteSpace(value)) throw new DomainException("Project key cannot be empty"); if (value.Length > 10) throw new DomainException("Project key cannot exceed 10 characters"); if (!System.Text.RegularExpressions.Regex.IsMatch(value, "^[A-Z0-9]+$")) throw new DomainException("Project key must contain only uppercase letters and numbers"); return new ProjectKey(value); } protected override IEnumerable GetAtomicValues() { yield return Value; } public override string ToString() => Value; }