using System; using System.Collections.Generic; using System.Linq; using BoundaryLab.Domain; namespace BoundaryLab.Application; public interface ILabelWrite { void Save(Label label); } public interface ILabelRead { Label? Find(string code); } public sealed class CreateLabel(ILabelWrite store) { public void Execute(string text) { ArgumentNullException.ThrowIfNull(text); string code = text.Trim().ToUpperInvariant(); if (code.Length == 0) throw new ArgumentException("Code required", nameof(text)); store.Save(new Label(code)); } } public sealed class FindLabel(ILabelRead store) { public Label? Execute(string code) => store.Find(code); }