public void AddNotAttendee(MemberId memberId)
        {
            this.CheckRule(new MeetingCannotBeChangedAfterStartRule(_term));

            this.CheckRule(new MemberCannotBeNotAttendeeTwiceRule(_notAttendees, memberId));

            _notAttendees.Add(MeetingNotAttendee.CreateNew(this.Id, memberId));

            var attendee = this.GetActiveAttendee(memberId);

            attendee?.ChangeDecision();

            var nextWaitlistMember = _waitlistMembers
                                     .Where(x => x.IsActive())
                                     .OrderBy(x => x.SignUpDate)
                                     .FirstOrDefault();

            if (nextWaitlistMember != null)
            {
                _attendees.Add(MeetingAttendee.CreateNew(
                                   this.Id,
                                   nextWaitlistMember.MemberId,
                                   nextWaitlistMember.SignUpDate,
                                   MeetingAttendeeRole.Attendee,
                                   0,
                                   this._eventFee));
                nextWaitlistMember.MarkIsMovedToAttendees();
            }
        }
        public void AddAttendee(MeetingGroup meetingGroup, MemberId attendeeId, int guestsNumber)
        {
            this.CheckRule(new MeetingCannotBeChangedAfterStartRule(_term));

            this.CheckRule(new AttendeeCanBeAddedOnlyInRsvpTermRule(_rsvpTerm));

            this.CheckRule(new MeetingAttendeeMustBeAMemberOfGroupRule(attendeeId, meetingGroup));

            this.CheckRule(new MemberCannotBeAnAttendeeOfMeetingMoreThanOnceRule(attendeeId, _attendees));

            this.CheckRule(new MeetingGuestsNumberIsAboveLimitRule(_meetingLimits.GuestsLimit, guestsNumber));

            this.CheckRule(new MeetingAttendeesNumberIsAboveLimitRule(_meetingLimits.AttendeesLimit, this.GetAllActiveAttendeesWithGuestsNumber(), guestsNumber));

            var notAttendee = this.GetActiveNotAttendee(attendeeId);

            notAttendee?.ChangeDecision();

            _attendees.Add(MeetingAttendee.CreateNew(
                               this.Id, attendeeId,
                               SystemClock.Now,
                               MeetingAttendeeRole.Attendee,
                               guestsNumber,
                               _eventFee));
        }
        private Meeting(
            MeetingGroupId meetingGroupId,
            string title,
            MeetingTerm term,
            string description,
            MeetingLocation location,
            MeetingLimits meetingLimits,
            Term rsvpTerm,
            MoneyValue eventFee,
            List <MemberId> hostsMembersIds,
            MemberId creatorId)
        {
            Id = new MeetingId(Guid.NewGuid());
            _meetingGroupId = meetingGroupId;
            _title          = title;
            _term           = term;
            _description    = description;
            _location       = location;
            _meetingLimits  = meetingLimits;

            this.SetRsvpTerm(rsvpTerm, _term);
            _eventFee   = eventFee;
            _creatorId  = creatorId;
            _createDate = SystemClock.Now;

            _attendees       = new List <MeetingAttendee>();
            _notAttendees    = new List <MeetingNotAttendee>();
            _waitlistMembers = new List <MeetingWaitlistMember>();

            this.AddDomainEvent(new MeetingCreatedDomainEvent(this.Id));
            var rsvpDate = SystemClock.Now;

            if (hostsMembersIds.Any())
            {
                foreach (var hostMemberId in hostsMembersIds)
                {
                    _attendees.Add(MeetingAttendee.CreateNew(this.Id, hostMemberId, rsvpDate, MeetingAttendeeRole.Host, 0, MoneyValue.Undefined));
                }
            }
            else
            {
                _attendees.Add(MeetingAttendee.CreateNew(this.Id, creatorId, rsvpDate, MeetingAttendeeRole.Host, 0, MoneyValue.Undefined));
            }
        }