public void Cancel()
        {
            if (Status == ESongStatus.Promoted || Status == ESongStatus.Released || Status == ESongStatus.Canceled)
            {
                StatusChangeException(ESongStatus.Canceled);
            }

            Status = ESongStatus.Canceled;

            AddDomainEvent(new SongCanceledDomainEvent(Id));
        }
        public void Release()
        {
            if (Status != ESongStatus.Promoted)
            {
                StatusChangeException(ESongStatus.Released);
            }

            Status = ESongStatus.Released;

            AddDomainEvent(new SongReleasedDomainEvent(Id));
        }
        private Song(string name, string description, double duration, string durationFormatted, List <string> tags, Author author)
        {
            Name              = name;
            Description       = description;
            Duration          = duration;
            DurationFormatted = durationFormatted;
            _tags             = tags;
            _files            = new List <File>();
            Audit             = Audit.Create(DateTimeOffset.Now, author.UserName);
            Status            = ESongStatus.Pending;

            AddSongCreatedDomainEvent(Id, name, durationFormatted, Draft, author.UserName);
        }
        public void Promote()
        {
            if (Status != ESongStatus.Pending)
            {
                StatusChangeException(ESongStatus.Promoted);
            }
            if (Duration < 3)
            {
                throw new DomainException("A song cannot be promoted if the duration is less than 4 minutes");
            }

            Status = ESongStatus.Promoted;

            AddDomainEvent(new SongPromotedDomainEvent(Id));
        }
 private void StatusChangeException(ESongStatus songStatusToChange)
 {
     throw new SongDomainException($"Is not possible to change the order status from {Status.Name} to {songStatusToChange.Name}.");
 }