private static TraineeshipApplicationDetail CreateApplicationDetail(Candidate candidate, TraineeshipVacancyDetail vacancyDetails)
 {
     return(new TraineeshipApplicationDetail
     {
         EntityId = Guid.NewGuid(),
         DateCreated = DateTime.UtcNow,
         CandidateId = candidate.EntityId,
         CandidateDetails = Mapper.Map <RegistrationDetails, RegistrationDetails>(candidate.RegistrationDetails),
         VacancyStatus = vacancyDetails.VacancyStatus,
         Vacancy = new TraineeshipSummary
         {
             Id = vacancyDetails.Id,
             VacancyReference = vacancyDetails.VacancyReference,
             Title = vacancyDetails.Title,
             EmployerName = vacancyDetails.IsEmployerAnonymous ?
                            vacancyDetails.AnonymousEmployerName : vacancyDetails.EmployerName,
             StartDate = vacancyDetails.StartDate,
             ClosingDate = vacancyDetails.ClosingDate,
             Description = vacancyDetails.IsEmployerAnonymous ? vacancyDetails.AnonymousAboutTheEmployer : vacancyDetails.EmployerDescription,
             NumberOfPositions = vacancyDetails.NumberOfPositions,
             Location = null // NOTE: no equivalent in legacy vacancy details.
         },
         // Populate traineeshipApplication template with candidate's most recent information.
         CandidateInformation = new ApplicationTemplate
         {
             Qualifications = candidate.ApplicationTemplate.Qualifications,
             WorkExperience = candidate.ApplicationTemplate.WorkExperience,
             TrainingCourses = candidate.ApplicationTemplate.TrainingCourses,
             AboutYou = candidate.ApplicationTemplate.AboutYou,
             DisabilityStatus = candidate.MonitoringInformation.DisabilityStatus
         },
     });
 }
        public static TraineeshipVacancyDetail GetTraineeshipVacancyDetail(Vacancy vacancy, Employer employer, Provider provider, ProviderSite providerSite, IEnumerable <Category> categories, ILogService logService)
        {
            //Manually mapping rather than using automapper as the two enties are significantly different

            var detail = new TraineeshipVacancyDetail
            {
                Id = vacancy.VacancyId,
                VacancyReference = vacancy.VacancyReferenceNumber.GetVacancyReference(),
                Title            = vacancy.Title,
                Description      = vacancy.ShortDescription,
                FullDescription  = vacancy.LongDescription,
                //SubCategory = vacancy.,
                StartDate   = vacancy.PossibleStartDate ?? DateTime.MinValue,
                ClosingDate = vacancy.ClosingDate ?? DateTime.MinValue,
                PostedDate  = vacancy.DateQAApproved ?? DateTime.MinValue,
                //TODO: Where should this come from?
                InterviewFromDate = DateTime.MinValue,
                Wage             = vacancy.Wage,
                WorkingWeek      = vacancy.WorkingWeek,
                OtherInformation = vacancy.OtherInformation,
                FutureProspects  = vacancy.FutureProspects,
                //TODO: Where from?
                //VacancyOwner = vacancy.,
                //VacancyManager = vacancy.,
                //LocalAuthority = vacancy.,
                NumberOfPositions         = vacancy.NumberOfPositions ?? 0,
                RealityCheck              = vacancy.ThingsToConsider,
                Created                   = vacancy.CreatedDateTime,
                VacancyStatus             = vacancy.Status.GetVacancyStatuses(),
                EmployerName              = string.IsNullOrEmpty(vacancy.EmployerAnonymousName) ? employer.FullName : vacancy.EmployerAnonymousName,
                AnonymousEmployerName     = vacancy.EmployerAnonymousName,
                AnonymousAboutTheEmployer = vacancy.AnonymousAboutTheEmployer,
                IsEmployerAnonymous       = !string.IsNullOrWhiteSpace(vacancy.EmployerAnonymousName),
                EmployerDescription       = vacancy.EmployerDescription,
                EmployerWebsite           = vacancy.EmployerWebsiteUrl,
                ApplyViaEmployerWebsite   = vacancy.OfflineVacancy ?? false,
                VacancyUrl                = vacancy.OfflineApplicationUrl,
                ApplicationInstructions   = vacancy.OfflineApplicationInstructions,
                IsPositiveAboutDisability = employer.IsPositiveAboutDisability,
                ExpectedDuration          = vacancy.ExpectedDuration,
                VacancyAddress            = GetVacancyAddress(vacancy.Address),
                //TODO: How is this captured in RAA?
                //IsRecruitmentAgencyAnonymous = vacancy.,
                //TODO: How is this captured in RAA?
                //IsSmallEmployerWageIncentive = vacancy.,
                SupplementaryQuestion1 = vacancy.FirstQuestion,
                SupplementaryQuestion2 = vacancy.SecondQuestion,
                //TODO: How is this captured in RAA?
                RecruitmentAgency = providerSite.TradingName,
                ProviderName      = provider.TradingName,
                TradingName       = employer.TradingName,
                //ProviderDescription = vacancy.,
                Contact = vacancy.GetContactInformation(providerSite),
                TrainingToBeProvided = vacancy.TrainingProvided,
                //TODO: How is this captured in RAA?
                //ContractOwner = vacancy.,
                //DeliveryOrganisation = vacancy.,
                //IsNasProvider = vacancy.,
                PersonalQualities             = vacancy.PersonalQualities,
                QualificationRequired         = vacancy.DesiredQualifications,
                SkillsRequired                = vacancy.DesiredSkills,
                TrainingType                  = vacancy.TrainingType.GetTrainingType(),
                AdditionalLocationInformation = vacancy.AdditionalLocationInformation
            };

            return(detail);
        }