public CompanyMessageDto(CompanyMessage companyMessage)
        {
            Id = companyMessage.Id;

            DateCreated = companyMessage.DateCreated;

            Status = (byte)companyMessage.Status;

            Source = companyMessage.Source;

            Subject = companyMessage.Subject;

            Message = companyMessage.Message;
        }
        public override CompanyMessage ProcessEvent(Company company, IActionData eventData, IHub services)
        {
            var data = eventData as MakeOfferActionData;

            var personService = services.Resolve<IPersonService>();

            var companyService = services.Resolve<ICompanyService>();

            var person = personService.GetPerson(data.PersonId);

            var gameClockService = services.Resolve<IGameClockService>();

            var message = new CompanyMessage
            {
                Id = Utilities.InvalidId,
                DateCreated = gameClockService.CurrentDate,
                Status = CompanyMessageStatus.UnRead,
                Source = "Human Resources"
            };

            if (personService.IsUnemployed(person))
            {
                var response = companyService.MakeOffer(company, person, data.OfferValue);

                if (response.DidAccept)
                {
                    message.Subject = "Offer Accepted";

                    message.Message = $"{person.FirstName} {person.LastName} accepted an offer of {data.OfferValue:C}.";
                }
                else
                {
                    message.Subject = "Offer Declined";

                    message.Message = $"{person.FirstName} {person.LastName} declined an offer of {data.OfferValue:C}.";
                }
            }
            else
            {
                message.Subject = "Offer Too Late";

                message.Message = $"{person.FirstName} {person.LastName} recently accepted an offer elsewhere.";
            }

            return message;
        }
        public override CompanyMessage ProcessEvent(Company company, IActionData eventData, IHub services)
        {
            var data = eventData as AcceptProjectActionData;

            var projectService = services.Resolve<IProjectService>();

            var project = projectService.GetProject(data.ProjectId);

            var gameClockService = services.Resolve<IGameClockService>();

            var message = new CompanyMessage
            {
                Id = Utilities.InvalidId,
                DateCreated = gameClockService.CurrentDate,
                Source = "Project Management",
                Status = CompanyMessageStatus.UnRead
            };

            if (project != null)
            {
                if (projectService.CanAcceptProject(project, company.Reputation))
                {
                    var companyService = services.Resolve<ICompanyService>();

                    companyService.AcceptProject(company, project);

                    message.Subject = "We got the project!";

                    message.Message = $"We have been granted the {project.Definition.Name} project.";
                }
                else
                {
                    message.Subject = "We did not get the project...";

                    message.Message = $"We were deemed not reputable enough to be granted the {project.Definition.Name} project.";
                }
            }
            else
            {
                message.Subject = "We missed out on the project.";

                message.Message = $"A project we were seeking has been given to another company.";
            }

            return message;
        }
        public override CompanyMessage ProcessEvent(Company company, IActionData eventData, IHub services)
        {
            var data = eventData as InterviewProspectActionData;

            var companyService = services.Resolve<ICompanyService>();

            var prospect = company.GetProspect(data.PersonId);

            var personService = services.Resolve<IPersonService>();

            var gameClockServices = services.Resolve<IGameClockService>();

            var message = new CompanyMessage
            {
                Id = Utilities.InvalidId,
                DateCreated = gameClockServices.CurrentDate,
                Status = CompanyMessageStatus.UnRead,
                Source = "Human Resources"
            };

            if(personService.IsUnemployed(prospect.Person))
            {
                companyService.InterviewProspect(company, prospect);

                message.Subject = "Interview Complete";

                message.Message = $"{prospect.Person.FirstName} {prospect.Person.LastName} has completed a round of interviews.";
            }
            else
            {
                message.Subject = "Prospect Off the Market";

                message.Message = $"{prospect.Person.FirstName} {prospect.Person.LastName} has recently accepted an offer elsewhere.";
            }

            return message;
        }
        public override CompanyMessage ProcessEvent(Company company, IActionData eventData, IHub services)
        {
            var data = eventData as RecruitPersonActionData;

            var personService = services.Resolve<IPersonService>();

            var companyService = services.Resolve<ICompanyService>();

            var person = personService.GetPerson(data.PersonId);

            var gameClockService = services.Resolve<IGameClockService>();

            var message = new CompanyMessage
            {
                Id = Utilities.InvalidId,
                DateCreated = gameClockService.CurrentDate,
                Status = CompanyMessageStatus.UnRead,
                Source = "Human Resources"
            };

            if(personService.IsUnemployed(person))
            {
                companyService.RecruitPerson(company, person);

                message.Subject = "Recruited Candidate";

                message.Message = $"We have successfully recruited {person.FirstName} {person.LastName}.";
            }
            else
            {
                message.Subject = "Missed a Potential Recruit";

                message.Message = $"{person.FirstName} {person.LastName} has been recently employed and cannot be recruited at this time.";
            }

            return message;
        }