package demoseed import ( "fmt" "lincodex/backend/internal/domain" ) // SyntheticDomain is the reserved address domain of every demo account. The // .test top-level domain never receives mail, so an account on it can only be // verified by the seed, and the domain marks the account as synthetic in // every listing and in the reset check. const SyntheticDomain = "demo.lincodex.test" // preparedCohortSize is the number of identical prepared candidates. The // anonymous card shows a quasi-identifier combination only from five // candidates on (domain.GeneralizeAnonymousCandidateCohort), so six keep the // demo search non-empty after one candidate unpublishes or hides an // organization during a session. const preparedCohortSize = 6 // accountRole tells what the seed builds for an account. type accountRole int const ( roleEmployer accountRole = iota // roleSelfService is the candidate the jury signs in with to run the // express and to start the full test: profile and questionnaire, no // attempt, no publication. roleSelfService // rolePrepared is a candidate with a prepared full attempt, its synthetic // demonstration category, and a published card. rolePrepared ) // accountSpec is one synthetic account of the seed. type accountSpec struct { local string role accountRole ordinal int fullName string } func (spec accountSpec) email() string { return spec.local + "@" + SyntheticDomain } func (spec accountSpec) scenario() domain.Scenario { if spec.role == roleEmployer { return domain.ScenarioEmployer } return domain.ScenarioCandidate } const ( alphaOwnerLocal = "employer-alpha" betaOwnerLocal = "employer-beta" selfServiceName = "candidate" preparedStem = "prepared-" ) // accounts lists every synthetic account in creation order. func accounts() []accountSpec { specs := []accountSpec{ {local: alphaOwnerLocal, role: roleEmployer}, {local: betaOwnerLocal, role: roleEmployer}, {local: selfServiceName, role: roleSelfService, fullName: "Демо-кандидат для самостоятельного прохождения (синтетический профиль)"}, } for ordinal := 1; ordinal <= preparedCohortSize; ordinal++ { specs = append(specs, accountSpec{ local: fmt.Sprintf("%s%d", preparedStem, ordinal), role: rolePrepared, ordinal: ordinal, fullName: fmt.Sprintf("Демо-кандидат %d с подготовленной попыткой (синтетический профиль)", ordinal), }) } return specs } // organizationSpec is one synthetic organization: its owner and, optionally, // a second member with a role that the minimal release denies tenant actions. type organizationSpec struct { name string description string sphere string ownerLocal string memberLocal string memberRole domain.OrganizationRole } // organizations lists the two synthetic organizations. The owner of Alpha is // a recruiter of Beta, so one account shows two different permissions: full // owner access in Alpha and the owner-only denial in Beta. func organizations() []organizationSpec { return []organizationSpec{ { name: "Демо-компания «Альфа» (синтетические данные)", description: "Синтетическая организация демонстрационного стенда. Реальной компании за ней нет.", sphere: "Демонстрационные данные", ownerLocal: alphaOwnerLocal, }, { name: "Демо-компания «Бета» (синтетические данные)", description: "Вторая синтетическая организация демонстрационного стенда. Реальной компании за ней нет.", sphere: "Демонстрационные данные", ownerLocal: betaOwnerLocal, memberLocal: alphaOwnerLocal, memberRole: domain.OrganizationRoleRecruiter, }, } } // preparedMarker is the profile text that labels the prepared attempt for // the candidate and for anyone who reads the profile or its PDF. const preparedMarker = "Синтетический профиль демонстрационного стенда. Полная попытка теста подготовлена командой demo-seed по обычным правилам теста; человек ее не проходил." const selfServiceMarker = "Синтетический профиль демонстрационного стенда для самостоятельного прохождения экспресс-теста и полного теста." // profileInput builds the manual profile of a candidate: a name, the // synthetic address as contact, one stack tag, the declared role, and one // synthetic work period. No FSP ID is linked; the profile has no place for // one. func profileInput(spec accountSpec) domain.CandidateProfileInput { marker := selfServiceMarker if spec.role == rolePrepared { marker = preparedMarker } confirmed := domain.ProfileClaimConfirmed return domain.CandidateProfileInput{ FullName: &domain.ProfileClaimInput[string]{Value: spec.fullName, Status: confirmed}, Email: &domain.ProfileClaimInput[string]{Value: spec.email(), Status: confirmed}, Stack: []domain.ProfileClaimInput[string]{{Value: "go", Status: confirmed}}, Roles: []domain.ProfileClaimInput[domain.ProfileRole]{{ Value: domain.ProfileRole{Specialization: fullSpecialization, SelfAssessedGrade: fullGrade}, Status: confirmed, }}, Experience: []domain.ProfileClaimInput[domain.ProfileExperience]{{ Value: domain.ProfileExperience{ EmployerName: "Синтетическая компания (демо)", Specialization: fullSpecialization, StartedOn: "2023-01", EndedOn: "2025-12", Summary: marker, }, Status: confirmed, }}, } } // questionnaireInput declares Backend Junior with Go and remote work, the // selection of the full category. func questionnaireInput() domain.CandidateQuestionnaireInput { return domain.CandidateQuestionnaireInput{ Specializations: []domain.QuestionnaireSpecialization{{ Specialization: fullSpecialization, SelfAssessedGrade: fullGrade, TaskLanguages: []domain.TaskLanguageCode{fullTaskLanguage}, Stack: []string{}, }}, WorkFormats: []domain.QuestionnaireWorkFormat{domain.QuestionnaireWorkFormatRemote}, } } // publishedFields are the card fields of every prepared candidate. They are // identical across the cohort, so the cards form one cohort of six. func publishedFields() []domain.CardField { return []domain.CardField{ domain.CardFieldCategories, domain.CardFieldStack, domain.CardFieldExperience, domain.CardFieldSelfAssessment, domain.CardFieldWorkFormats, } }