public void AcceptBy(User user)
        {
            if (Status != WishListItemStatus.Requested &&
                Status != WishListItemStatus.RequestedToDirector)
            {
                throw new CannotAcceptWishListItemWithCurrentStatusException(Status);
            }

            if (Status == WishListItemStatus.Requested)
            {
                if (!user.IsLeaderOf(_owner))
                {
                    throw new UserDoesNotHavePermissionToAcceptRequestedWishListItemException();
                }

                if (ShouldBeRequestedToDirector())
                {
                    State = WishListItemState.RequestedToDirector;
                }
                else
                {
                    State = WishListItemState.Accepted;
                }

                return;
            }

            if (!user.IsDirectorOf(_owner))
            {
                throw new UserDoesNotHavePermissionToAcceptRequestedWishListItemException();
            }

            State = WishListItemState.Accepted;
        }
        public void RejectBy(User user)
        {
            if (Status != WishListItemStatus.Requested &&
                Status != WishListItemStatus.RequestedToDirector)
            {
                throw new CannotRejectWishListItemWithCurrentStatusException(Status);
            }

            if (Status == WishListItemStatus.Requested)
            {
                if (!user.IsLeaderOf(_owner))
                {
                    throw new UserDoesNotHavePermissionToRejectRequestedWishListItemException();
                }

                State = WishListItemState.Rejected;

                return;
            }

            if (!user.IsDirectorOf(_owner))
            {
                throw new UserDoesNotHavePermissionToRejectRequestedWishListItemException();
            }

            State = WishListItemState.Rejected;
        }
 public WishListItem(
     WishListItemStatus status,
     User owner,
     decimal itemCost,
     bool areCostsInvoiced = true)
 {
     Owner            = owner;
     ItemCost         = itemCost;
     AreCostsInvoiced = areCostsInvoiced;
     State            = WishListItemState.CreateState(status);
 }
        public void StartRealizationBy(User user)
        {
            if (Status != WishListItemStatus.Accepted)
            {
                throw new CannotStartWishListItemRealizationWithCurrentStatusException(Status);
            }

            if (!user.IsSupervisor)
            {
                throw new UserDoesNotHavePermissionToStartWishListItemRealizationException();
            }

            State = WishListItemState.InRealization;
        }
        public void FinishRealizationBy(User user)
        {
            if (Status != WishListItemStatus.InRealization)
            {
                throw new CannotFinishWishListItemRealizationWithCurrentStatusException(Status);
            }

            if (!user.IsSupervisor)
            {
                throw new UserDoesNotHavePermissionToFinishWishListItemRealizationException();
            }

            if (!_areCostsInvoiced)
            {
                throw new CannotFinishWishListItemRealizationWithNotInvoicedException();
            }

            State = WishListItemState.Realized;
        }