diff --git a/api/Makefile b/api/Makefile index 6bfbadd..529cbed 100644 --- a/api/Makefile +++ b/api/Makefile @@ -32,6 +32,7 @@ check: lint ## Build and lint both contract bundles PYTHONDONTWRITEBYTECODE=1 "$(CODEGEN_PYTHON)" -m unittest discover -s "$(ROOT_DIR)/scripts" -p 'test_merge_schemas.py' PYTHONDONTWRITEBYTECODE=1 "$(CODEGEN_PYTHON)" -m unittest discover -s "$(ROOT_DIR)/scripts" -p 'test_contract_copies.py' PYTHONDONTWRITEBYTECODE=1 "$(CODEGEN_PYTHON)" -m unittest discover -s "$(ROOT_DIR)/scripts" -p 'test_assessment_contract.py' + PYTHONDONTWRITEBYTECODE=1 "$(CODEGEN_PYTHON)" -m unittest discover -s "$(ROOT_DIR)/scripts" -p 'test_match_contract.py' .PHONY: check-compat check-compat: bundle ## Compare the public contract with API_BASE_REF diff --git a/api/core/components/examples/matches.yml b/api/core/components/examples/matches.yml new file mode 100644 index 0000000..35a7691 --- /dev/null +++ b/api/core/components/examples/matches.yml @@ -0,0 +1,259 @@ +SearchByNeed: + summary: Search against one confirmed requirements snapshot. + description: The reference is Need.requirements_version, not Need.version. + value: + need_id: 4d3a4a1b-4f60-44c1-9dc2-6c8e6c9d4c11 + requirements_version: 3 + filters: + specialization: backend + +SearchByBank: + summary: Search the organization-visible bank with separate confirmed and declared filters. + value: + filters: + specialization: backend + confirmed_grade: middle + confirmed_category: + specialization: backend + grade: middle + confirmation_status: confirmed + declared_grade: junior + stack: + - go + - postgresql + conditions: + work_formats: + - remote + salary_compatibility: compatible + +ThreeGroups: + summary: Synthetic example of main, near, and unconfirmed entries. + description: >- + Illustrative contract values only; these are not measurements from real + candidates. The same organization-scoped handle has independent Backend + and Networks states. + value: + source: + kind: bank + filters: + specialization: null + confirmed_grade: null + confirmed_category: null + confirmation_status: null + declared_grade: null + stack: null + conditions: null + groups: + main: + - candidate_handle: cv1_AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA + specialization: backend + confirmation_status: confirmed + declared_grade: middle + category: + specialization: backend + grade: middle + strength: standard + public_context: + stack: + - go + - postgresql + experience_band: "3_6" + work_formats: + - remote + salary_compatibility: compatible + evidence_summary: + - code: confirmed_category + state: supports + - code: required_skill_evidence + state: supports + - code: work_conditions_match + state: supports + components: + fit: 0.78 + coverage: 0.72 + domain: 0.75 + semantics: 0.5 + percentile: 0.61 + competition: 0.0 + freshness: 0.5 + responsiveness: 0.5 + rank_score: 0.65 + unknown_flags: [] + near: + - candidate_handle: cv1_BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB + specialization: frontend + confirmation_status: confirmed + declared_grade: junior + category: + specialization: frontend + grade: junior + strength: standard + public_context: + stack: + - docker + experience_band: null + work_formats: + - hybrid + salary_compatibility: null + evidence_summary: + - code: confirmed_category + state: supports + - code: required_skill_evidence + state: gap + components: + fit: 0.48 + coverage: 0.18 + domain: 0.5 + semantics: 0.5 + percentile: 0.42 + competition: 0.0 + freshness: 0.5 + responsiveness: 0.5 + rank_score: 0.43 + unknown_flags: + - component: experience_band + reason: not_in_public_card + - component: salary_compatibility + reason: not_in_public_card + unconfirmed: + - candidate_handle: cv1_AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA + specialization: network_engineer + confirmation_status: unconfirmed + declared_grade: junior + category: null + strength: null + public_context: + stack: null + experience_band: "1_3" + work_formats: + - remote + salary_compatibility: compatible + evidence_summary: + - code: declared_grade + state: declared_only + - code: required_skill_evidence + state: partial + components: + fit: 0.51 + coverage: 0.38 + unknown_flags: + - component: assessment + reason: no_confirmation_for_specialization + +Empty: + summary: A valid search with no eligible visible candidates. + value: + source: + kind: bank + filters: + specialization: null + confirmed_grade: null + confirmed_category: null + confirmation_status: null + declared_grade: null + stack: null + conditions: null + groups: + main: [] + near: [] + unconfirmed: [] + +MLUnavailable: + summary: Semantic similarity uses the documented neutral value while ML is unavailable. + description: Synthetic example; 0.5 is the FR09 neutral value, not an inference. + value: + source: + kind: bank + filters: + specialization: backend + confirmed_grade: null + confirmed_category: null + confirmation_status: null + declared_grade: null + stack: null + conditions: null + groups: + main: + - candidate_handle: cv1_CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC + specialization: backend + confirmation_status: confirmed + declared_grade: null + category: + specialization: backend + grade: middle + strength: strong + public_context: + stack: + - go + experience_band: 3_plus + work_formats: + - remote + salary_compatibility: compatible + evidence_summary: + - code: confirmed_category + state: supports + components: + fit: 0.7 + coverage: 0.6 + domain: 0.5 + semantics: 0.5 + percentile: 0.6 + competition: 0.0 + freshness: 0.5 + responsiveness: 0.5 + rank_score: 0.61 + unknown_flags: + - component: semantics + reason: ml_unavailable + near: [] + unconfirmed: [] + +CohortBelow30: + summary: A small comparison cohort has no published percentile. + description: Synthetic example; the exact cohort size is not disclosed. + value: + source: + kind: bank + filters: + specialization: backend + confirmed_grade: null + confirmed_category: null + confirmation_status: null + declared_grade: null + stack: null + conditions: null + groups: + main: + - candidate_handle: cv1_DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD + specialization: backend + confirmation_status: confirmed + declared_grade: middle + category: + specialization: backend + grade: middle + strength: standard + public_context: + stack: + - postgresql + experience_band: "3_6" + work_formats: + - office + salary_compatibility: null + evidence_summary: + - code: confirmed_category + state: supports + components: + fit: 0.62 + coverage: 0.55 + domain: 0.5 + semantics: 0.7 + percentile: null + competition: 0.0 + freshness: 0.5 + responsiveness: 0.5 + rank_score: 0.56 + unknown_flags: + - component: percentile + reason: cohort_below_30 + near: [] + unconfirmed: [] diff --git a/api/core/components/schemas.yml b/api/core/components/schemas.yml index 062ce31..3c92c99 100644 --- a/api/core/components/schemas.yml +++ b/api/core/components/schemas.yml @@ -4254,6 +4254,521 @@ InvitationDeclineRequest: oneOf: - $ref: '#/InvitationDeclineComment' - type: 'null' +MatchConfirmationStatus: + type: string + description: Confirmation state for this specialization only. A result for one specialization never changes the state of another specialization. + enum: + - confirmed + - unconfirmed +MatchGradeFilter: + type: object + description: A confirmed category filter, never a candidate declaration. + additionalProperties: false + required: + - specialization + - grade + properties: + specialization: + $ref: '#/SpecializationCode' + grade: + $ref: '#/GradeCode' +MatchSearchStackTag: + type: string + description: A stack code that the anonymous card may expose. Search filters do not accept arbitrary profile text or candidate-provided evidence. + enum: + - go + - postgresql + - kafka + - docker +MatchSearchConditions: + type: object + description: Filters against safe, coarse card conditions. No candidate location, salary amount, salary minimum, or salary range is accepted. + additionalProperties: false + properties: + work_formats: + type: array + minItems: 1 + maxItems: 3 + uniqueItems: true + items: + $ref: '#/WorkFormat' + salary_compatibility: + $ref: '#/CandidateSalaryCompatibility' +MatchSearchFilters: + type: object + description: Optional filters over the current organization-visible bank. An empty object means no additional filter. Confirmed and declared grades are separate fields; a declaration never satisfies a confirmed-grade or category filter. Conditions use only the safe, coarse card fields. + additionalProperties: false + properties: + specialization: + $ref: '#/SpecializationCode' + confirmed_grade: + description: Match only candidates with this currently confirmed grade in the selected specialization. It never matches a declared grade. + $ref: '#/GradeCode' + confirmed_category: + $ref: '#/MatchGradeFilter' + confirmation_status: + $ref: '#/MatchConfirmationStatus' + declared_grade: + description: Candidate-declared grade filter. This is a separate claim and cannot satisfy `confirmed_grade` or `confirmed_category`. + $ref: '#/GradeCode' + stack: + type: array + minItems: 1 + maxItems: 4 + uniqueItems: true + items: + $ref: '#/MatchSearchStackTag' + conditions: + $ref: '#/MatchSearchConditions' +MatchSearchByNeed: + type: object + description: Search one immutable set of confirmed requirements. `requirements_version` is the Need.requirements_version, not the general Need.version; text-only or suggestion-only edits do not change this search basis. + additionalProperties: false + required: + - need_id + - requirements_version + properties: + need_id: + type: string + format: uuid + description: Need owned by the organization in the path. + requirements_version: + $ref: '#/NeedVersion' + filters: + $ref: '#/MatchSearchFilters' +MatchSearchByBank: + type: object + description: Search the current organization-visible bank. An empty `filters` object includes all otherwise eligible specializations as separate entries. + additionalProperties: false + required: + - filters + properties: + filters: + $ref: '#/MatchSearchFilters' +MatchSearchRequest: + oneOf: + - $ref: '#/MatchSearchByNeed' + - $ref: '#/MatchSearchByBank' + description: Search either a Need.requirements_version snapshot or the whole organization-visible bank with explicit filters. Unknown fields are rejected by both closed request variants. +MatchSearchNeedSource: + type: object + description: The immutable need requirements snapshot used by this result. + additionalProperties: false + required: + - kind + - need_id + - requirements_version + properties: + kind: + type: string + enum: + - need + need_id: + type: string + format: uuid + requirements_version: + $ref: '#/NeedVersion' +MatchAppliedConditions: + type: object + description: Conditions echoed as a complete snapshot; null means no filter. + additionalProperties: false + required: + - work_formats + - salary_compatibility + properties: + work_formats: + oneOf: + - type: array + minItems: 1 + maxItems: 3 + uniqueItems: true + items: + $ref: '#/WorkFormat' + - type: 'null' + salary_compatibility: + oneOf: + - $ref: '#/CandidateSalaryCompatibility' + - type: 'null' +MatchAppliedFilters: + type: object + description: A normalized response snapshot of the bank filters. Each key is present; null means the corresponding request filter was omitted. This keeps a search result tied to its exact filter basis. + additionalProperties: false + required: + - specialization + - confirmed_grade + - confirmed_category + - confirmation_status + - declared_grade + - stack + - conditions + properties: + specialization: + oneOf: + - $ref: '#/SpecializationCode' + - type: 'null' + confirmed_grade: + oneOf: + - $ref: '#/GradeCode' + - type: 'null' + confirmed_category: + oneOf: + - $ref: '#/MatchGradeFilter' + - type: 'null' + confirmation_status: + oneOf: + - $ref: '#/MatchConfirmationStatus' + - type: 'null' + declared_grade: + oneOf: + - $ref: '#/GradeCode' + - type: 'null' + stack: + oneOf: + - type: array + minItems: 1 + maxItems: 4 + uniqueItems: true + items: + $ref: '#/MatchSearchStackTag' + - type: 'null' + conditions: + oneOf: + - $ref: '#/MatchAppliedConditions' + - type: 'null' +MatchSearchBankSource: + type: object + description: The normalized filters used for a bank search. + additionalProperties: false + required: + - kind + - filters + properties: + kind: + type: string + enum: + - bank + filters: + $ref: '#/MatchAppliedFilters' +MatchSearchSource: + oneOf: + - $ref: '#/MatchSearchNeedSource' + - $ref: '#/MatchSearchBankSource' + description: Search basis echoed with the response so the displayed result remains tied to its need requirements version or bank filters. +MatchStrength: + type: string + description: Coarse strength of a confirmed assessment for this specialization. + enum: + - standard + - strong +MatchCategory: + type: object + description: A confirmed category. Its specialization must equal the enclosing match entry's specialization. + additionalProperties: false + required: + - specialization + - grade + properties: + specialization: + $ref: '#/SpecializationCode' + grade: + $ref: '#/GradeCode' +MatchScore: + type: number + format: double + minimum: 0 + maximum: 1 + description: A normalized FR09 ranking component from 0 to 1. +MatchNullableScore: + description: A score from a versioned ranking component, or null when it is not available. Any null component has a matching bounded entry in `unknown_flags`. + oneOf: + - type: number + format: double + minimum: 0 + maximum: 1 + - type: 'null' +MatchUnknownComponent: + type: string + description: Ranking or public-card component whose value is unknown. + enum: + - semantics + - percentile + - assessment + - freshness + - responsiveness + - experience_band + - work_formats + - salary_compatibility + - domain +MatchUnknownReason: + type: string + description: Bounded explanation for an unknown component, not a hiding reason. + enum: + - ml_unavailable + - cohort_below_30 + - no_confirmation_for_specialization + - not_in_public_card + - need_field_unconfirmed + - no_freshness_history + - no_response_history +MatchUnknownFlag: + type: object + description: A safe, bounded explanation for one unavailable component. + additionalProperties: false + required: + - component + - reason + properties: + component: + $ref: '#/MatchUnknownComponent' + reason: + $ref: '#/MatchUnknownReason' +MatchUnknownFlags: + type: array + maxItems: 9 + items: + $ref: '#/MatchUnknownFlag' +MatchEvidenceCode: + type: string + description: Template code for an explanation derived from allowed evidence. It carries no free text, raw answer, or reason for withheld FSP data. + enum: + - confirmed_category + - required_skill_evidence + - desired_skill_evidence + - domain_alignment + - task_alignment + - work_conditions_match + - salary_compatibility + - declared_grade +MatchEvidenceState: + type: string + enum: + - supports + - partial + - gap + - declared_only +MatchEvidenceSummaryItem: + type: object + description: A templated, non-text evidence explanation. + additionalProperties: false + required: + - code + - state + properties: + code: + $ref: '#/MatchEvidenceCode' + state: + $ref: '#/MatchEvidenceState' +MatchEvidenceSummary: + type: array + maxItems: 12 + items: + $ref: '#/MatchEvidenceSummaryItem' +MatchPublicStack: + type: array + maxItems: 4 + uniqueItems: true + items: + $ref: '#/MatchSearchStackTag' +MatchPublicContext: + type: object + description: Safe anonymous-card context only. A null value means that the value is not in the public card or is not present; the response does not reveal which. It contains no contact, candidate location, or salary amount. + additionalProperties: false + required: + - stack + - experience_band + - work_formats + - salary_compatibility + properties: + stack: + oneOf: + - $ref: '#/MatchPublicStack' + - type: 'null' + experience_band: + oneOf: + - $ref: '#/CandidateExperienceBand' + - type: 'null' + work_formats: + oneOf: + - type: array + maxItems: 3 + uniqueItems: true + items: + $ref: '#/WorkFormat' + - type: 'null' + salary_compatibility: + oneOf: + - $ref: '#/CandidateSalaryCompatibility' + - type: 'null' +MatchConfirmedComponents: + type: object + description: Components from the FR09 ranking model for a confirmed category. `percentile` is null when fewer than 30 comparable real candidates are available; the ranking uses neutral T = 0.5 and does not publish a percentile. If ML is unavailable, `semantics` uses neutral 0.5 and the reason appears in `unknown_flags`. + additionalProperties: false + required: + - fit + - coverage + - domain + - semantics + - percentile + - competition + - freshness + - responsiveness + - rank_score + properties: + fit: + $ref: '#/MatchScore' + coverage: + $ref: '#/MatchScore' + domain: + $ref: '#/MatchScore' + semantics: + $ref: '#/MatchScore' + percentile: + $ref: '#/MatchNullableScore' + competition: + $ref: '#/MatchScore' + freshness: + $ref: '#/MatchScore' + responsiveness: + $ref: '#/MatchScore' + rank_score: + $ref: '#/MatchScore' +MatchUnconfirmedComponents: + type: object + description: Unconfirmed entries are ordered only by Fit and coverage. This strict component object has no theta, T, P, test percentile, or confirmed assessment score. + additionalProperties: false + required: + - fit + - coverage + properties: + fit: + type: number + format: double + minimum: 0 + maximum: 1 + description: Job fit for this specialization, never an assessment score. + coverage: + type: number + format: double + minimum: 0 + maximum: 1 + description: Coverage of confirmed need skills by allowed public evidence. +MatchConfirmedCandidate: + type: object + description: One confirmed specialization entry in the `main` or `near` group. The group containing it supplies the group label. A candidate may have a separate entry for another specialization. + additionalProperties: false + required: + - candidate_handle + - specialization + - confirmation_status + - declared_grade + - category + - strength + - public_context + - evidence_summary + - components + - unknown_flags + properties: + candidate_handle: + $ref: '#/CandidateHandle' + specialization: + $ref: '#/SpecializationCode' + confirmation_status: + type: string + enum: + - confirmed + declared_grade: + oneOf: + - $ref: '#/GradeCode' + - type: 'null' + description: Candidate-declared grade for this specialization, never a confirmation. + category: + $ref: '#/MatchCategory' + strength: + $ref: '#/MatchStrength' + public_context: + $ref: '#/MatchPublicContext' + evidence_summary: + $ref: '#/MatchEvidenceSummary' + components: + $ref: '#/MatchConfirmedComponents' + unknown_flags: + $ref: '#/MatchUnknownFlags' +MatchUnconfirmedCandidate: + type: object + description: One specialization with no confirmed category. `category` and `strength` remain present and null. A confirmation in another specialization never changes this entry. The schema intentionally has no assessment measurement fields. + additionalProperties: false + required: + - candidate_handle + - specialization + - confirmation_status + - declared_grade + - category + - strength + - public_context + - evidence_summary + - components + - unknown_flags + properties: + candidate_handle: + $ref: '#/CandidateHandle' + specialization: + $ref: '#/SpecializationCode' + confirmation_status: + type: string + enum: + - unconfirmed + declared_grade: + oneOf: + - $ref: '#/GradeCode' + - type: 'null' + description: Candidate-declared grade, separate from assessment confirmation. + category: + type: 'null' + description: There is no confirmed category for this specialization. + strength: + type: 'null' + description: Assessment strength is not measured for this specialization. + public_context: + $ref: '#/MatchPublicContext' + evidence_summary: + $ref: '#/MatchEvidenceSummary' + components: + $ref: '#/MatchUnconfirmedComponents' + unknown_flags: + $ref: '#/MatchUnknownFlags' +MatchSearchGroups: + type: object + description: Separate ranking groups. Confirmed categories appear in main and near; unconfirmed specializations appear only in the lower unconfirmed group. + additionalProperties: false + required: + - main + - near + - unconfirmed + properties: + main: + type: array + items: + $ref: '#/MatchConfirmedCandidate' + near: + type: array + items: + $ref: '#/MatchConfirmedCandidate' + unconfirmed: + type: array + items: + $ref: '#/MatchUnconfirmedCandidate' +MatchSearchResponse: + type: object + description: Anonymous search result grouped by specialization state. Repeated organization-scoped handles are allowed when the same candidate has different specialization entries; entries never transfer confirmation between specializations. + additionalProperties: false + required: + - source + - groups + properties: + source: + $ref: '#/MatchSearchSource' + groups: + $ref: '#/MatchSearchGroups' NeedVersion: type: integer format: int64 diff --git a/api/core/components/schemas/common_schemas.yml b/api/core/components/schemas/common_schemas.yml index 1768181..b7125da 100644 --- a/api/core/components/schemas/common_schemas.yml +++ b/api/core/components/schemas/common_schemas.yml @@ -36,7 +36,7 @@ schemas: type: string minLength: 47 maxLength: 47 - pattern: '^cv1_[A-Za-z0-9_-]{43}$' + pattern: "^cv1_[A-Za-z0-9_-]{43}$" description: >- Opaque reference to a candidate as one organization sees it, taken from the organization-scoped anonymous card. It is a versioned HMAC diff --git a/api/core/components/schemas/match_schemas.yml b/api/core/components/schemas/match_schemas.yml new file mode 100644 index 0000000..47da798 --- /dev/null +++ b/api/core/components/schemas/match_schemas.yml @@ -0,0 +1,574 @@ +schemas: + MatchConfirmationStatus: + type: string + description: >- + Confirmation state for this specialization only. A result for one + specialization never changes the state of another specialization. + enum: + - confirmed + - unconfirmed + MatchGradeFilter: + type: object + description: A confirmed category filter, never a candidate declaration. + additionalProperties: false + required: + - specialization + - grade + properties: + specialization: + $ref: "./catalog_schemas.yml#/schemas/SpecializationCode" + grade: + $ref: "./catalog_schemas.yml#/schemas/GradeCode" + MatchSearchStackTag: + type: string + description: >- + A stack code that the anonymous card may expose. Search filters do not + accept arbitrary profile text or candidate-provided evidence. + enum: + - go + - postgresql + - kafka + - docker + MatchSearchConditions: + type: object + description: >- + Filters against safe, coarse card conditions. No candidate location, + salary amount, salary minimum, or salary range is accepted. + additionalProperties: false + properties: + work_formats: + type: array + minItems: 1 + maxItems: 3 + uniqueItems: true + items: + $ref: "./questionnaire_schemas.yml#/schemas/WorkFormat" + salary_compatibility: + $ref: "./privacy_schemas.yml#/schemas/CandidateSalaryCompatibility" + MatchSearchFilters: + type: object + description: >- + Optional filters over the current organization-visible bank. An empty + object means no additional filter. Confirmed and declared grades are + separate fields; a declaration never satisfies a confirmed-grade or + category filter. Conditions use only the safe, coarse card fields. + additionalProperties: false + properties: + specialization: + $ref: "./catalog_schemas.yml#/schemas/SpecializationCode" + confirmed_grade: + description: >- + Match only candidates with this currently confirmed grade in the + selected specialization. It never matches a declared grade. + $ref: "./catalog_schemas.yml#/schemas/GradeCode" + confirmed_category: + $ref: "#/schemas/MatchGradeFilter" + confirmation_status: + $ref: "#/schemas/MatchConfirmationStatus" + declared_grade: + description: >- + Candidate-declared grade filter. This is a separate claim and + cannot satisfy `confirmed_grade` or `confirmed_category`. + $ref: "./catalog_schemas.yml#/schemas/GradeCode" + stack: + type: array + minItems: 1 + maxItems: 4 + uniqueItems: true + items: + $ref: "#/schemas/MatchSearchStackTag" + conditions: + $ref: "#/schemas/MatchSearchConditions" + MatchSearchByNeed: + type: object + description: >- + Search one immutable set of confirmed requirements. `requirements_version` + is the Need.requirements_version, not the general Need.version; text-only + or suggestion-only edits do not change this search basis. + additionalProperties: false + required: + - need_id + - requirements_version + properties: + need_id: + type: string + format: uuid + description: Need owned by the organization in the path. + requirements_version: + $ref: "./need_schemas.yml#/schemas/NeedVersion" + filters: + $ref: "#/schemas/MatchSearchFilters" + MatchSearchByBank: + type: object + description: >- + Search the current organization-visible bank. An empty `filters` object + includes all otherwise eligible specializations as separate entries. + additionalProperties: false + required: + - filters + properties: + filters: + $ref: "#/schemas/MatchSearchFilters" + MatchSearchRequest: + oneOf: + - $ref: "#/schemas/MatchSearchByNeed" + - $ref: "#/schemas/MatchSearchByBank" + description: >- + Search either a Need.requirements_version snapshot or the whole + organization-visible bank with explicit filters. Unknown fields are + rejected by both closed request variants. + MatchSearchNeedSource: + type: object + description: The immutable need requirements snapshot used by this result. + additionalProperties: false + required: + - kind + - need_id + - requirements_version + properties: + kind: + type: string + enum: + - need + need_id: + type: string + format: uuid + requirements_version: + $ref: "./need_schemas.yml#/schemas/NeedVersion" + MatchAppliedConditions: + type: object + description: Conditions echoed as a complete snapshot; null means no filter. + additionalProperties: false + required: + - work_formats + - salary_compatibility + properties: + work_formats: + oneOf: + - type: array + minItems: 1 + maxItems: 3 + uniqueItems: true + items: + $ref: "./questionnaire_schemas.yml#/schemas/WorkFormat" + - type: "null" + salary_compatibility: + oneOf: + - $ref: "./privacy_schemas.yml#/schemas/CandidateSalaryCompatibility" + - type: "null" + MatchAppliedFilters: + type: object + description: >- + A normalized response snapshot of the bank filters. Each key is present; + null means the corresponding request filter was omitted. This keeps a + search result tied to its exact filter basis. + additionalProperties: false + required: + - specialization + - confirmed_grade + - confirmed_category + - confirmation_status + - declared_grade + - stack + - conditions + properties: + specialization: + oneOf: + - $ref: "./catalog_schemas.yml#/schemas/SpecializationCode" + - type: "null" + confirmed_grade: + oneOf: + - $ref: "./catalog_schemas.yml#/schemas/GradeCode" + - type: "null" + confirmed_category: + oneOf: + - $ref: "#/schemas/MatchGradeFilter" + - type: "null" + confirmation_status: + oneOf: + - $ref: "#/schemas/MatchConfirmationStatus" + - type: "null" + declared_grade: + oneOf: + - $ref: "./catalog_schemas.yml#/schemas/GradeCode" + - type: "null" + stack: + oneOf: + - type: array + minItems: 1 + maxItems: 4 + uniqueItems: true + items: + $ref: "#/schemas/MatchSearchStackTag" + - type: "null" + conditions: + oneOf: + - $ref: "#/schemas/MatchAppliedConditions" + - type: "null" + MatchSearchBankSource: + type: object + description: The normalized filters used for a bank search. + additionalProperties: false + required: + - kind + - filters + properties: + kind: + type: string + enum: + - bank + filters: + $ref: "#/schemas/MatchAppliedFilters" + MatchSearchSource: + oneOf: + - $ref: "#/schemas/MatchSearchNeedSource" + - $ref: "#/schemas/MatchSearchBankSource" + description: >- + Search basis echoed with the response so the displayed result remains + tied to its need requirements version or bank filters. + MatchStrength: + type: string + description: Coarse strength of a confirmed assessment for this specialization. + enum: + - standard + - strong + MatchCategory: + type: object + description: >- + A confirmed category. Its specialization must equal the enclosing + match entry's specialization. + additionalProperties: false + required: + - specialization + - grade + properties: + specialization: + $ref: "./catalog_schemas.yml#/schemas/SpecializationCode" + grade: + $ref: "./catalog_schemas.yml#/schemas/GradeCode" + MatchScore: + type: number + format: double + minimum: 0 + maximum: 1 + description: A normalized FR09 ranking component from 0 to 1. + MatchNullableScore: + description: >- + A score from a versioned ranking component, or null when it is not + available. Any null component has a matching bounded entry in + `unknown_flags`. + oneOf: + - type: number + format: double + minimum: 0 + maximum: 1 + - type: "null" + MatchUnknownComponent: + type: string + description: Ranking or public-card component whose value is unknown. + enum: + - semantics + - percentile + - assessment + - freshness + - responsiveness + - experience_band + - work_formats + - salary_compatibility + - domain + MatchUnknownReason: + type: string + description: Bounded explanation for an unknown component, not a hiding reason. + enum: + - ml_unavailable + - cohort_below_30 + - no_confirmation_for_specialization + - not_in_public_card + - need_field_unconfirmed + - no_freshness_history + - no_response_history + MatchUnknownFlag: + type: object + description: A safe, bounded explanation for one unavailable component. + additionalProperties: false + required: + - component + - reason + properties: + component: + $ref: "#/schemas/MatchUnknownComponent" + reason: + $ref: "#/schemas/MatchUnknownReason" + MatchUnknownFlags: + type: array + maxItems: 9 + items: + $ref: "#/schemas/MatchUnknownFlag" + MatchEvidenceCode: + type: string + description: >- + Template code for an explanation derived from allowed evidence. It + carries no free text, raw answer, or reason for withheld FSP data. + enum: + - confirmed_category + - required_skill_evidence + - desired_skill_evidence + - domain_alignment + - task_alignment + - work_conditions_match + - salary_compatibility + - declared_grade + MatchEvidenceState: + type: string + enum: + - supports + - partial + - gap + - declared_only + MatchEvidenceSummaryItem: + type: object + description: A templated, non-text evidence explanation. + additionalProperties: false + required: + - code + - state + properties: + code: + $ref: "#/schemas/MatchEvidenceCode" + state: + $ref: "#/schemas/MatchEvidenceState" + MatchEvidenceSummary: + type: array + maxItems: 12 + items: + $ref: "#/schemas/MatchEvidenceSummaryItem" + MatchPublicStack: + type: array + maxItems: 4 + uniqueItems: true + items: + $ref: "#/schemas/MatchSearchStackTag" + MatchPublicContext: + type: object + description: >- + Safe anonymous-card context only. A null value means that the value is + not in the public card or is not present; the response does not reveal + which. It contains no contact, candidate location, or salary amount. + additionalProperties: false + required: + - stack + - experience_band + - work_formats + - salary_compatibility + properties: + stack: + oneOf: + - $ref: "#/schemas/MatchPublicStack" + - type: "null" + experience_band: + oneOf: + - $ref: "./privacy_schemas.yml#/schemas/CandidateExperienceBand" + - type: "null" + work_formats: + oneOf: + - type: array + maxItems: 3 + uniqueItems: true + items: + $ref: "./questionnaire_schemas.yml#/schemas/WorkFormat" + - type: "null" + salary_compatibility: + oneOf: + - $ref: "./privacy_schemas.yml#/schemas/CandidateSalaryCompatibility" + - type: "null" + MatchConfirmedComponents: + type: object + description: >- + Components from the FR09 ranking model for a confirmed category. + `percentile` is null when fewer than 30 comparable real candidates are + available; the ranking uses neutral T = 0.5 and does not publish a + percentile. If ML is unavailable, `semantics` uses neutral 0.5 and the + reason appears in `unknown_flags`. + additionalProperties: false + required: + - fit + - coverage + - domain + - semantics + - percentile + - competition + - freshness + - responsiveness + - rank_score + properties: + fit: + $ref: "#/schemas/MatchScore" + coverage: + $ref: "#/schemas/MatchScore" + domain: + $ref: "#/schemas/MatchScore" + semantics: + $ref: "#/schemas/MatchScore" + percentile: + $ref: "#/schemas/MatchNullableScore" + competition: + $ref: "#/schemas/MatchScore" + freshness: + $ref: "#/schemas/MatchScore" + responsiveness: + $ref: "#/schemas/MatchScore" + rank_score: + $ref: "#/schemas/MatchScore" + MatchUnconfirmedComponents: + type: object + description: >- + Unconfirmed entries are ordered only by Fit and coverage. This strict + component object has no theta, T, P, test percentile, or confirmed + assessment score. + additionalProperties: false + required: + - fit + - coverage + properties: + fit: + type: number + format: double + minimum: 0 + maximum: 1 + description: Job fit for this specialization, never an assessment score. + coverage: + type: number + format: double + minimum: 0 + maximum: 1 + description: Coverage of confirmed need skills by allowed public evidence. + MatchConfirmedCandidate: + type: object + description: >- + One confirmed specialization entry in the `main` or `near` group. The + group containing it supplies the group label. A candidate may have a + separate entry for another specialization. + additionalProperties: false + required: + - candidate_handle + - specialization + - confirmation_status + - declared_grade + - category + - strength + - public_context + - evidence_summary + - components + - unknown_flags + properties: + candidate_handle: + $ref: "./common_schemas.yml#/schemas/CandidateHandle" + specialization: + $ref: "./catalog_schemas.yml#/schemas/SpecializationCode" + confirmation_status: + type: string + enum: + - confirmed + declared_grade: + oneOf: + - $ref: "./catalog_schemas.yml#/schemas/GradeCode" + - type: "null" + description: Candidate-declared grade for this specialization, never a confirmation. + category: + $ref: "#/schemas/MatchCategory" + strength: + $ref: "#/schemas/MatchStrength" + public_context: + $ref: "#/schemas/MatchPublicContext" + evidence_summary: + $ref: "#/schemas/MatchEvidenceSummary" + components: + $ref: "#/schemas/MatchConfirmedComponents" + unknown_flags: + $ref: "#/schemas/MatchUnknownFlags" + MatchUnconfirmedCandidate: + type: object + description: >- + One specialization with no confirmed category. `category` and + `strength` remain present and null. A confirmation in another + specialization never changes this entry. The schema intentionally has + no assessment measurement fields. + additionalProperties: false + required: + - candidate_handle + - specialization + - confirmation_status + - declared_grade + - category + - strength + - public_context + - evidence_summary + - components + - unknown_flags + properties: + candidate_handle: + $ref: "./common_schemas.yml#/schemas/CandidateHandle" + specialization: + $ref: "./catalog_schemas.yml#/schemas/SpecializationCode" + confirmation_status: + type: string + enum: + - unconfirmed + declared_grade: + oneOf: + - $ref: "./catalog_schemas.yml#/schemas/GradeCode" + - type: "null" + description: Candidate-declared grade, separate from assessment confirmation. + category: + type: "null" + description: There is no confirmed category for this specialization. + strength: + type: "null" + description: Assessment strength is not measured for this specialization. + public_context: + $ref: "#/schemas/MatchPublicContext" + evidence_summary: + $ref: "#/schemas/MatchEvidenceSummary" + components: + $ref: "#/schemas/MatchUnconfirmedComponents" + unknown_flags: + $ref: "#/schemas/MatchUnknownFlags" + MatchSearchGroups: + type: object + description: >- + Separate ranking groups. Confirmed categories appear in main and near; + unconfirmed specializations appear only in the lower unconfirmed group. + additionalProperties: false + required: + - main + - near + - unconfirmed + properties: + main: + type: array + items: + $ref: "#/schemas/MatchConfirmedCandidate" + near: + type: array + items: + $ref: "#/schemas/MatchConfirmedCandidate" + unconfirmed: + type: array + items: + $ref: "#/schemas/MatchUnconfirmedCandidate" + MatchSearchResponse: + type: object + description: >- + Anonymous search result grouped by specialization state. Repeated + organization-scoped handles are allowed when the same candidate has + different specialization entries; entries never transfer confirmation + between specializations. + additionalProperties: false + required: + - source + - groups + properties: + source: + $ref: "#/schemas/MatchSearchSource" + groups: + $ref: "#/schemas/MatchSearchGroups" diff --git a/api/core/components/schemas/privacy_schemas.yml b/api/core/components/schemas/privacy_schemas.yml index aaa4ede..12cec93 100644 --- a/api/core/components/schemas/privacy_schemas.yml +++ b/api/core/components/schemas/privacy_schemas.yml @@ -408,7 +408,7 @@ schemas: type: string minLength: 47 maxLength: 47 - pattern: '^cv1_[A-Za-z0-9_-]{43}$' + pattern: "^cv1_[A-Za-z0-9_-]{43}$" description: >- Stable opaque alias scoped to the reading organization. It is not an account or profile identifier and changes across organizations. diff --git a/api/core/openapi.bundle.yml b/api/core/openapi.bundle.yml index 59d2b8a..a1b87b6 100644 --- a/api/core/openapi.bundle.yml +++ b/api/core/openapi.bundle.yml @@ -1522,6 +1522,67 @@ paths: $ref: '#/components/responses/TooManyRequests' default: $ref: '#/components/responses/Problem' + /api/v1/organizations/{org_id}/matches: + post: + operationId: SearchOrganizationMatches + summary: Search the current organization-visible candidate bank. + description: |- + Requires the session cookie of an employer account with an active owner membership in `org_id`, the CSRF token of that session in X-CSRF-Token, and an allowed Origin. The organization comes from the path and the active server-side membership. Hidden profiles, revoked or missing C2 publication, and the organization's visibility restrictions are applied before any result is returned. + + The body selects either a Need's `requirements_version` snapshot or the current organization-visible bank with explicit filters. A need reference uses `Need.requirements_version`, not the general `Need.version`; title or suggestion-only edits do not change the confirmed-requirements snapshot. An empty bank filter searches all otherwise eligible specializations, returning each specialization separately. + + Every entry is one candidate specialization. A confirmed result in Backend never confirms Networks for the same candidate. The `main`, `near`, and `unconfirmed` arrays are separate groups. A confirmed category with required-skill coverage below 0.25 belongs to `near`; other confirmed entries belong to `main` (FR09). Entries in `unconfirmed` are ordered by Fit, then coverage, then a stable internal tie-breaker that is never returned. Their category and strength remain null, and they have no theta, T, P, or test percentile. The search result uses the organization-scoped opaque `candidate_handle` as its display pseudonym and invitation reference, never a candidate account or profile identifier. + + The card context is limited to safe public fields: recognized stack tags, coarse experience, accepted work formats, and coarse salary compatibility. It contains no contact, candidate location, salary amount or minimum, raw answer, arbitrary profile text, or reason for withheld FSP data. Evidence explanations use bounded codes, not free text. When ML is unavailable, semantic similarity uses the neutral 0.5 specified by FR09 and `unknown_flags` names `ml_unavailable`. For fewer than 30 comparable real candidates, the search uses neutral T = 0.5, returns no percentile value, and names `cohort_below_30`. + + A missing, unknown, expired, or revoked session answers 401 unauthenticated; a candidate account answers 403 forbidden; an unknown organization or account without active membership answers 404 not_found. The response is `Cache-Control: no-store`. + security: + - sessionCookie: [] + sessionCsrf: [] + tags: + - organization + parameters: + - $ref: '#/components/parameters/OrganizationId' + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/MatchSearchRequest' + examples: + by_need: + $ref: '#/components/examples/SearchByNeed' + by_bank_filters: + $ref: '#/components/examples/SearchByBank' + responses: + '200': + description: Organization-visible candidates in separate match groups. + headers: + Cache-Control: + $ref: '#/components/headers/CacheControlNoStore' + content: + application/json: + schema: + $ref: '#/components/schemas/MatchSearchResponse' + examples: + three_groups: + $ref: '#/components/examples/ThreeGroups' + empty: + $ref: '#/components/examples/Empty' + ml_unavailable: + $ref: '#/components/examples/MLUnavailable' + cohort_below_30: + $ref: '#/components/examples/CohortBelow30' + '400': + $ref: '#/components/responses/ValidationFailed' + '401': + $ref: '#/components/responses/Unauthenticated' + '403': + $ref: '#/components/responses/CsrfCheckFailedOrForbidden' + '404': + $ref: '#/components/responses/NotFound' + default: + $ref: '#/components/responses/Problem' /api/v1/organizations/{org_id}/candidate-cards/{candidate_handle}: get: operationId: GetOrganizationCandidateCard @@ -9744,6 +9805,537 @@ components: description: Short educational feedback about this training run. decided_at: $ref: '#/components/schemas/Timestamp' + MatchGradeFilter: + type: object + description: A confirmed category filter, never a candidate declaration. + additionalProperties: false + required: + - specialization + - grade + properties: + specialization: + $ref: '#/components/schemas/SpecializationCode' + grade: + $ref: '#/components/schemas/GradeCode' + MatchConfirmationStatus: + type: string + description: Confirmation state for this specialization only. A result for one specialization never changes the state of another specialization. + enum: + - confirmed + - unconfirmed + MatchSearchStackTag: + type: string + description: A stack code that the anonymous card may expose. Search filters do not accept arbitrary profile text or candidate-provided evidence. + enum: + - go + - postgresql + - kafka + - docker + CandidateSalaryCompatibility: + type: string + description: A coarse compatibility result only. No salary amount, minimum, range, or threshold is part of the anonymous card. + enum: + - compatible + - not_compatible + MatchSearchConditions: + type: object + description: Filters against safe, coarse card conditions. No candidate location, salary amount, salary minimum, or salary range is accepted. + additionalProperties: false + properties: + work_formats: + type: array + minItems: 1 + maxItems: 3 + uniqueItems: true + items: + $ref: '#/components/schemas/WorkFormat' + salary_compatibility: + $ref: '#/components/schemas/CandidateSalaryCompatibility' + MatchSearchFilters: + type: object + description: Optional filters over the current organization-visible bank. An empty object means no additional filter. Confirmed and declared grades are separate fields; a declaration never satisfies a confirmed-grade or category filter. Conditions use only the safe, coarse card fields. + additionalProperties: false + properties: + specialization: + $ref: '#/components/schemas/SpecializationCode' + confirmed_grade: + description: Match only candidates with this currently confirmed grade in the selected specialization. It never matches a declared grade. + $ref: '#/components/schemas/GradeCode' + confirmed_category: + $ref: '#/components/schemas/MatchGradeFilter' + confirmation_status: + $ref: '#/components/schemas/MatchConfirmationStatus' + declared_grade: + description: Candidate-declared grade filter. This is a separate claim and cannot satisfy `confirmed_grade` or `confirmed_category`. + $ref: '#/components/schemas/GradeCode' + stack: + type: array + minItems: 1 + maxItems: 4 + uniqueItems: true + items: + $ref: '#/components/schemas/MatchSearchStackTag' + conditions: + $ref: '#/components/schemas/MatchSearchConditions' + MatchSearchByNeed: + type: object + description: Search one immutable set of confirmed requirements. `requirements_version` is the Need.requirements_version, not the general Need.version; text-only or suggestion-only edits do not change this search basis. + additionalProperties: false + required: + - need_id + - requirements_version + properties: + need_id: + type: string + format: uuid + description: Need owned by the organization in the path. + requirements_version: + $ref: '#/components/schemas/NeedVersion' + filters: + $ref: '#/components/schemas/MatchSearchFilters' + MatchSearchByBank: + type: object + description: Search the current organization-visible bank. An empty `filters` object includes all otherwise eligible specializations as separate entries. + additionalProperties: false + required: + - filters + properties: + filters: + $ref: '#/components/schemas/MatchSearchFilters' + MatchSearchRequest: + oneOf: + - $ref: '#/components/schemas/MatchSearchByNeed' + - $ref: '#/components/schemas/MatchSearchByBank' + description: Search either a Need.requirements_version snapshot or the whole organization-visible bank with explicit filters. Unknown fields are rejected by both closed request variants. + MatchSearchNeedSource: + type: object + description: The immutable need requirements snapshot used by this result. + additionalProperties: false + required: + - kind + - need_id + - requirements_version + properties: + kind: + type: string + enum: + - need + need_id: + type: string + format: uuid + requirements_version: + $ref: '#/components/schemas/NeedVersion' + MatchAppliedConditions: + type: object + description: Conditions echoed as a complete snapshot; null means no filter. + additionalProperties: false + required: + - work_formats + - salary_compatibility + properties: + work_formats: + oneOf: + - type: array + minItems: 1 + maxItems: 3 + uniqueItems: true + items: + $ref: '#/components/schemas/WorkFormat' + - type: 'null' + salary_compatibility: + oneOf: + - $ref: '#/components/schemas/CandidateSalaryCompatibility' + - type: 'null' + MatchAppliedFilters: + type: object + description: A normalized response snapshot of the bank filters. Each key is present; null means the corresponding request filter was omitted. This keeps a search result tied to its exact filter basis. + additionalProperties: false + required: + - specialization + - confirmed_grade + - confirmed_category + - confirmation_status + - declared_grade + - stack + - conditions + properties: + specialization: + oneOf: + - $ref: '#/components/schemas/SpecializationCode' + - type: 'null' + confirmed_grade: + oneOf: + - $ref: '#/components/schemas/GradeCode' + - type: 'null' + confirmed_category: + oneOf: + - $ref: '#/components/schemas/MatchGradeFilter' + - type: 'null' + confirmation_status: + oneOf: + - $ref: '#/components/schemas/MatchConfirmationStatus' + - type: 'null' + declared_grade: + oneOf: + - $ref: '#/components/schemas/GradeCode' + - type: 'null' + stack: + oneOf: + - type: array + minItems: 1 + maxItems: 4 + uniqueItems: true + items: + $ref: '#/components/schemas/MatchSearchStackTag' + - type: 'null' + conditions: + oneOf: + - $ref: '#/components/schemas/MatchAppliedConditions' + - type: 'null' + MatchSearchBankSource: + type: object + description: The normalized filters used for a bank search. + additionalProperties: false + required: + - kind + - filters + properties: + kind: + type: string + enum: + - bank + filters: + $ref: '#/components/schemas/MatchAppliedFilters' + MatchSearchSource: + oneOf: + - $ref: '#/components/schemas/MatchSearchNeedSource' + - $ref: '#/components/schemas/MatchSearchBankSource' + description: Search basis echoed with the response so the displayed result remains tied to its need requirements version or bank filters. + MatchCategory: + type: object + description: A confirmed category. Its specialization must equal the enclosing match entry's specialization. + additionalProperties: false + required: + - specialization + - grade + properties: + specialization: + $ref: '#/components/schemas/SpecializationCode' + grade: + $ref: '#/components/schemas/GradeCode' + MatchStrength: + type: string + description: Coarse strength of a confirmed assessment for this specialization. + enum: + - standard + - strong + MatchPublicStack: + type: array + maxItems: 4 + uniqueItems: true + items: + $ref: '#/components/schemas/MatchSearchStackTag' + CandidateExperienceBand: + type: string + description: Coarse total experience bucket. Rare combinations may be generalized to 0_3 or 3_plus before they are returned. + enum: + - '0_1' + - '1_3' + - '3_6' + - 6_plus + - '0_3' + - 3_plus + MatchPublicContext: + type: object + description: Safe anonymous-card context only. A null value means that the value is not in the public card or is not present; the response does not reveal which. It contains no contact, candidate location, or salary amount. + additionalProperties: false + required: + - stack + - experience_band + - work_formats + - salary_compatibility + properties: + stack: + oneOf: + - $ref: '#/components/schemas/MatchPublicStack' + - type: 'null' + experience_band: + oneOf: + - $ref: '#/components/schemas/CandidateExperienceBand' + - type: 'null' + work_formats: + oneOf: + - type: array + maxItems: 3 + uniqueItems: true + items: + $ref: '#/components/schemas/WorkFormat' + - type: 'null' + salary_compatibility: + oneOf: + - $ref: '#/components/schemas/CandidateSalaryCompatibility' + - type: 'null' + MatchEvidenceCode: + type: string + description: Template code for an explanation derived from allowed evidence. It carries no free text, raw answer, or reason for withheld FSP data. + enum: + - confirmed_category + - required_skill_evidence + - desired_skill_evidence + - domain_alignment + - task_alignment + - work_conditions_match + - salary_compatibility + - declared_grade + MatchEvidenceState: + type: string + enum: + - supports + - partial + - gap + - declared_only + MatchEvidenceSummaryItem: + type: object + description: A templated, non-text evidence explanation. + additionalProperties: false + required: + - code + - state + properties: + code: + $ref: '#/components/schemas/MatchEvidenceCode' + state: + $ref: '#/components/schemas/MatchEvidenceState' + MatchEvidenceSummary: + type: array + maxItems: 12 + items: + $ref: '#/components/schemas/MatchEvidenceSummaryItem' + MatchScore: + type: number + format: double + minimum: 0 + maximum: 1 + description: A normalized FR09 ranking component from 0 to 1. + MatchNullableScore: + description: A score from a versioned ranking component, or null when it is not available. Any null component has a matching bounded entry in `unknown_flags`. + oneOf: + - type: number + format: double + minimum: 0 + maximum: 1 + - type: 'null' + MatchConfirmedComponents: + type: object + description: Components from the FR09 ranking model for a confirmed category. `percentile` is null when fewer than 30 comparable real candidates are available; the ranking uses neutral T = 0.5 and does not publish a percentile. If ML is unavailable, `semantics` uses neutral 0.5 and the reason appears in `unknown_flags`. + additionalProperties: false + required: + - fit + - coverage + - domain + - semantics + - percentile + - competition + - freshness + - responsiveness + - rank_score + properties: + fit: + $ref: '#/components/schemas/MatchScore' + coverage: + $ref: '#/components/schemas/MatchScore' + domain: + $ref: '#/components/schemas/MatchScore' + semantics: + $ref: '#/components/schemas/MatchScore' + percentile: + $ref: '#/components/schemas/MatchNullableScore' + competition: + $ref: '#/components/schemas/MatchScore' + freshness: + $ref: '#/components/schemas/MatchScore' + responsiveness: + $ref: '#/components/schemas/MatchScore' + rank_score: + $ref: '#/components/schemas/MatchScore' + MatchUnknownComponent: + type: string + description: Ranking or public-card component whose value is unknown. + enum: + - semantics + - percentile + - assessment + - freshness + - responsiveness + - experience_band + - work_formats + - salary_compatibility + - domain + MatchUnknownReason: + type: string + description: Bounded explanation for an unknown component, not a hiding reason. + enum: + - ml_unavailable + - cohort_below_30 + - no_confirmation_for_specialization + - not_in_public_card + - need_field_unconfirmed + - no_freshness_history + - no_response_history + MatchUnknownFlag: + type: object + description: A safe, bounded explanation for one unavailable component. + additionalProperties: false + required: + - component + - reason + properties: + component: + $ref: '#/components/schemas/MatchUnknownComponent' + reason: + $ref: '#/components/schemas/MatchUnknownReason' + MatchUnknownFlags: + type: array + maxItems: 9 + items: + $ref: '#/components/schemas/MatchUnknownFlag' + MatchConfirmedCandidate: + type: object + description: One confirmed specialization entry in the `main` or `near` group. The group containing it supplies the group label. A candidate may have a separate entry for another specialization. + additionalProperties: false + required: + - candidate_handle + - specialization + - confirmation_status + - declared_grade + - category + - strength + - public_context + - evidence_summary + - components + - unknown_flags + properties: + candidate_handle: + $ref: '#/components/schemas/CandidateHandle' + specialization: + $ref: '#/components/schemas/SpecializationCode' + confirmation_status: + type: string + enum: + - confirmed + declared_grade: + oneOf: + - $ref: '#/components/schemas/GradeCode' + - type: 'null' + description: Candidate-declared grade for this specialization, never a confirmation. + category: + $ref: '#/components/schemas/MatchCategory' + strength: + $ref: '#/components/schemas/MatchStrength' + public_context: + $ref: '#/components/schemas/MatchPublicContext' + evidence_summary: + $ref: '#/components/schemas/MatchEvidenceSummary' + components: + $ref: '#/components/schemas/MatchConfirmedComponents' + unknown_flags: + $ref: '#/components/schemas/MatchUnknownFlags' + MatchUnconfirmedComponents: + type: object + description: Unconfirmed entries are ordered only by Fit and coverage. This strict component object has no theta, T, P, test percentile, or confirmed assessment score. + additionalProperties: false + required: + - fit + - coverage + properties: + fit: + type: number + format: double + minimum: 0 + maximum: 1 + description: Job fit for this specialization, never an assessment score. + coverage: + type: number + format: double + minimum: 0 + maximum: 1 + description: Coverage of confirmed need skills by allowed public evidence. + MatchUnconfirmedCandidate: + type: object + description: One specialization with no confirmed category. `category` and `strength` remain present and null. A confirmation in another specialization never changes this entry. The schema intentionally has no assessment measurement fields. + additionalProperties: false + required: + - candidate_handle + - specialization + - confirmation_status + - declared_grade + - category + - strength + - public_context + - evidence_summary + - components + - unknown_flags + properties: + candidate_handle: + $ref: '#/components/schemas/CandidateHandle' + specialization: + $ref: '#/components/schemas/SpecializationCode' + confirmation_status: + type: string + enum: + - unconfirmed + declared_grade: + oneOf: + - $ref: '#/components/schemas/GradeCode' + - type: 'null' + description: Candidate-declared grade, separate from assessment confirmation. + category: + type: 'null' + description: There is no confirmed category for this specialization. + strength: + type: 'null' + description: Assessment strength is not measured for this specialization. + public_context: + $ref: '#/components/schemas/MatchPublicContext' + evidence_summary: + $ref: '#/components/schemas/MatchEvidenceSummary' + components: + $ref: '#/components/schemas/MatchUnconfirmedComponents' + unknown_flags: + $ref: '#/components/schemas/MatchUnknownFlags' + MatchSearchGroups: + type: object + description: Separate ranking groups. Confirmed categories appear in main and near; unconfirmed specializations appear only in the lower unconfirmed group. + additionalProperties: false + required: + - main + - near + - unconfirmed + properties: + main: + type: array + items: + $ref: '#/components/schemas/MatchConfirmedCandidate' + near: + type: array + items: + $ref: '#/components/schemas/MatchConfirmedCandidate' + unconfirmed: + type: array + items: + $ref: '#/components/schemas/MatchUnconfirmedCandidate' + MatchSearchResponse: + type: object + description: Anonymous search result grouped by specialization state. Repeated organization-scoped handles are allowed when the same candidate has different specialization entries; entries never transfer confirmation between specializations. + additionalProperties: false + required: + - source + - groups + properties: + source: + $ref: '#/components/schemas/MatchSearchSource' + groups: + $ref: '#/components/schemas/MatchSearchGroups' CardSelfAssessment: type: object description: Candidate-declared specialization and optional grade. This is never an assessment result. @@ -9763,28 +10355,12 @@ components: oneOf: - $ref: '#/components/schemas/GradeCode' - type: 'null' - CandidateExperienceBand: - type: string - description: Coarse total experience bucket. Rare combinations may be generalized to 0_3 or 3_plus before they are returned. - enum: - - '0_1' - - '1_3' - - '3_6' - - 6_plus - - '0_3' - - 3_plus CandidateWorkFormat: type: string enum: - remote - office - hybrid - CandidateSalaryCompatibility: - type: string - description: A coarse compatibility result only. No salary amount, minimum, range, or threshold is part of the anonymous card. - enum: - - compatible - - not_compatible parameters: IdempotencyKey: name: Idempotency-Key @@ -13091,6 +13667,257 @@ components: code: version_conflict detail: The resource changed after it was read. Read it again before retrying. trace_id: 0f1a2b3c-4d5e-4f6a-8b7c-8d9e0f1a2b3d + SearchByNeed: + summary: Search against one confirmed requirements snapshot. + description: The reference is Need.requirements_version, not Need.version. + value: + need_id: 4d3a4a1b-4f60-44c1-9dc2-6c8e6c9d4c11 + requirements_version: 3 + filters: + specialization: backend + SearchByBank: + summary: Search the organization-visible bank with separate confirmed and declared filters. + value: + filters: + specialization: backend + confirmed_grade: middle + confirmed_category: + specialization: backend + grade: middle + confirmation_status: confirmed + declared_grade: junior + stack: + - go + - postgresql + conditions: + work_formats: + - remote + salary_compatibility: compatible + ThreeGroups: + summary: Synthetic example of main, near, and unconfirmed entries. + description: Illustrative contract values only; these are not measurements from real candidates. The same organization-scoped handle has independent Backend and Networks states. + value: + source: + kind: bank + filters: + specialization: null + confirmed_grade: null + confirmed_category: null + confirmation_status: null + declared_grade: null + stack: null + conditions: null + groups: + main: + - candidate_handle: cv1_AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA + specialization: backend + confirmation_status: confirmed + declared_grade: middle + category: + specialization: backend + grade: middle + strength: standard + public_context: + stack: + - go + - postgresql + experience_band: '3_6' + work_formats: + - remote + salary_compatibility: compatible + evidence_summary: + - code: confirmed_category + state: supports + - code: required_skill_evidence + state: supports + - code: work_conditions_match + state: supports + components: + fit: 0.78 + coverage: 0.72 + domain: 0.75 + semantics: 0.5 + percentile: 0.61 + competition: 0 + freshness: 0.5 + responsiveness: 0.5 + rank_score: 0.65 + unknown_flags: [] + near: + - candidate_handle: cv1_BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB + specialization: frontend + confirmation_status: confirmed + declared_grade: junior + category: + specialization: frontend + grade: junior + strength: standard + public_context: + stack: + - docker + experience_band: null + work_formats: + - hybrid + salary_compatibility: null + evidence_summary: + - code: confirmed_category + state: supports + - code: required_skill_evidence + state: gap + components: + fit: 0.48 + coverage: 0.18 + domain: 0.5 + semantics: 0.5 + percentile: 0.42 + competition: 0 + freshness: 0.5 + responsiveness: 0.5 + rank_score: 0.43 + unknown_flags: + - component: experience_band + reason: not_in_public_card + - component: salary_compatibility + reason: not_in_public_card + unconfirmed: + - candidate_handle: cv1_AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA + specialization: network_engineer + confirmation_status: unconfirmed + declared_grade: junior + category: null + strength: null + public_context: + stack: null + experience_band: '1_3' + work_formats: + - remote + salary_compatibility: compatible + evidence_summary: + - code: declared_grade + state: declared_only + - code: required_skill_evidence + state: partial + components: + fit: 0.51 + coverage: 0.38 + unknown_flags: + - component: assessment + reason: no_confirmation_for_specialization + Empty: + summary: A valid search with no eligible visible candidates. + value: + source: + kind: bank + filters: + specialization: null + confirmed_grade: null + confirmed_category: null + confirmation_status: null + declared_grade: null + stack: null + conditions: null + groups: + main: [] + near: [] + unconfirmed: [] + MLUnavailable: + summary: Semantic similarity uses the documented neutral value while ML is unavailable. + description: Synthetic example; 0.5 is the FR09 neutral value, not an inference. + value: + source: + kind: bank + filters: + specialization: backend + confirmed_grade: null + confirmed_category: null + confirmation_status: null + declared_grade: null + stack: null + conditions: null + groups: + main: + - candidate_handle: cv1_CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC + specialization: backend + confirmation_status: confirmed + declared_grade: null + category: + specialization: backend + grade: middle + strength: strong + public_context: + stack: + - go + experience_band: 3_plus + work_formats: + - remote + salary_compatibility: compatible + evidence_summary: + - code: confirmed_category + state: supports + components: + fit: 0.7 + coverage: 0.6 + domain: 0.5 + semantics: 0.5 + percentile: 0.6 + competition: 0 + freshness: 0.5 + responsiveness: 0.5 + rank_score: 0.61 + unknown_flags: + - component: semantics + reason: ml_unavailable + near: [] + unconfirmed: [] + CohortBelow30: + summary: A small comparison cohort has no published percentile. + description: Synthetic example; the exact cohort size is not disclosed. + value: + source: + kind: bank + filters: + specialization: backend + confirmed_grade: null + confirmed_category: null + confirmation_status: null + declared_grade: null + stack: null + conditions: null + groups: + main: + - candidate_handle: cv1_DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD + specialization: backend + confirmation_status: confirmed + declared_grade: middle + category: + specialization: backend + grade: middle + strength: standard + public_context: + stack: + - postgresql + experience_band: '3_6' + work_formats: + - office + salary_compatibility: null + evidence_summary: + - code: confirmed_category + state: supports + components: + fit: 0.62 + coverage: 0.55 + domain: 0.5 + semantics: 0.7 + percentile: null + competition: 0 + freshness: 0.5 + responsiveness: 0.5 + rank_score: 0.56 + unknown_flags: + - component: percentile + reason: cohort_below_30 + near: [] + unconfirmed: [] OrganizationAnonymousCandidateCard: summary: An anonymous card currently visible to one organization description: The alias is scoped to the reading organization; no contact values are included. diff --git a/api/core/openapi.yml b/api/core/openapi.yml index 6ce1d3b..80df6b5 100644 --- a/api/core/openapi.yml +++ b/api/core/openapi.yml @@ -127,6 +127,8 @@ paths: $ref: ./routes/organization_needs.yml /api/v1/organizations/{org_id}/needs/{need_id}: $ref: ./routes/organization_need.yml + /api/v1/organizations/{org_id}/matches: + $ref: ./routes/matches.yml /api/v1/organizations/{org_id}/candidate-cards/{candidate_handle}: $ref: ./routes/organization_candidate_card.yml /api/v1/organizations/{org_id}/invitations: diff --git a/api/core/routes/matches.yml b/api/core/routes/matches.yml new file mode 100644 index 0000000..d58eeb2 --- /dev/null +++ b/api/core/routes/matches.yml @@ -0,0 +1,60 @@ +post: + operationId: SearchOrganizationMatches + summary: Search the current organization-visible candidate bank. + description: |- + Requires the session cookie of an employer account with an active owner membership in `org_id`, the CSRF token of that session in X-CSRF-Token, and an allowed Origin. The organization comes from the path and the active server-side membership. Hidden profiles, revoked or missing C2 publication, and the organization's visibility restrictions are applied before any result is returned. + + The body selects either a Need's `requirements_version` snapshot or the current organization-visible bank with explicit filters. A need reference uses `Need.requirements_version`, not the general `Need.version`; title or suggestion-only edits do not change the confirmed-requirements snapshot. An empty bank filter searches all otherwise eligible specializations, returning each specialization separately. + + Every entry is one candidate specialization. A confirmed result in Backend never confirms Networks for the same candidate. The `main`, `near`, and `unconfirmed` arrays are separate groups. A confirmed category with required-skill coverage below 0.25 belongs to `near`; other confirmed entries belong to `main` (FR09). Entries in `unconfirmed` are ordered by Fit, then coverage, then a stable internal tie-breaker that is never returned. Their category and strength remain null, and they have no theta, T, P, or test percentile. The search result uses the organization-scoped opaque `candidate_handle` as its display pseudonym and invitation reference, never a candidate account or profile identifier. + + The card context is limited to safe public fields: recognized stack tags, coarse experience, accepted work formats, and coarse salary compatibility. It contains no contact, candidate location, salary amount or minimum, raw answer, arbitrary profile text, or reason for withheld FSP data. Evidence explanations use bounded codes, not free text. When ML is unavailable, semantic similarity uses the neutral 0.5 specified by FR09 and `unknown_flags` names `ml_unavailable`. For fewer than 30 comparable real candidates, the search uses neutral T = 0.5, returns no percentile value, and names `cohort_below_30`. + + A missing, unknown, expired, or revoked session answers 401 unauthenticated; a candidate account answers 403 forbidden; an unknown organization or account without active membership answers 404 not_found. The response is `Cache-Control: no-store`. + security: + - sessionCookie: [] + sessionCsrf: [] + tags: + - organization + parameters: + - $ref: ../components/parameters.yml#/OrganizationId + requestBody: + required: true + content: + application/json: + schema: + $ref: ../components/schemas.yml#/MatchSearchRequest + examples: + by_need: + $ref: ../components/examples/matches.yml#/SearchByNeed + by_bank_filters: + $ref: ../components/examples/matches.yml#/SearchByBank + responses: + "200": + description: Organization-visible candidates in separate match groups. + headers: + Cache-Control: + $ref: ../components/headers.yml#/CacheControlNoStore + content: + application/json: + schema: + $ref: ../components/schemas.yml#/MatchSearchResponse + examples: + three_groups: + $ref: ../components/examples/matches.yml#/ThreeGroups + empty: + $ref: ../components/examples/matches.yml#/Empty + ml_unavailable: + $ref: ../components/examples/matches.yml#/MLUnavailable + cohort_below_30: + $ref: ../components/examples/matches.yml#/CohortBelow30 + "400": + $ref: ../components/responses.yml#/ValidationFailed + "401": + $ref: ../components/responses.yml#/Unauthenticated + "403": + $ref: ../components/responses.yml#/CsrfCheckFailedOrForbidden + "404": + $ref: ../components/responses.yml#/NotFound + default: + $ref: ../components/responses.yml#/Problem diff --git a/backend/internal/adapter/primary/http/api/oas_handlers_gen.go b/backend/internal/adapter/primary/http/api/oas_handlers_gen.go index 96fa5f7..6f92374 100644 --- a/backend/internal/adapter/primary/http/api/oas_handlers_gen.go +++ b/backend/internal/adapter/primary/http/api/oas_handlers_gen.go @@ -11712,6 +11712,269 @@ func (s *Server) handleSaveMyQuestionnaireRequest(args [0]string, argsEscaped bo } } +// handleSearchOrganizationMatchesRequest handles SearchOrganizationMatches operation. +// +// Requires the session cookie of an employer account with an active owner membership in `org_id`, the +// CSRF token of that session in X-CSRF-Token, and an allowed Origin. The organization comes from the +// path and the active server-side membership. Hidden profiles, revoked or missing C2 publication, and +// the organization's visibility restrictions are applied before any result is returned. +// +// The body selects either a Need's `requirements_version` snapshot or the current organization-visible +// bank with explicit filters. A need reference uses `Need.requirements_version`, not the general +// `Need.version`; title or suggestion-only edits do not change the confirmed-requirements snapshot. An +// empty bank filter searches all otherwise eligible specializations, returning each specialization +// separately. +// +// Every entry is one candidate specialization. A confirmed result in Backend never confirms Networks +// for the same candidate. The `main`, `near`, and `unconfirmed` arrays are separate groups. A +// confirmed category with required-skill coverage below 0.25 belongs to `near`; other confirmed +// entries belong to `main` (FR09). Entries in `unconfirmed` are ordered by Fit, then coverage, then a +// stable internal tie-breaker that is never returned. Their category and strength remain null, and +// they have no theta, T, P, or test percentile. The search result uses the organization-scoped opaque +// `candidate_handle` as its display pseudonym and invitation reference, never a candidate account or +// profile identifier. +// +// The card context is limited to safe public fields: recognized stack tags, coarse experience, +// accepted work formats, and coarse salary compatibility. It contains no contact, candidate location, +// salary amount or minimum, raw answer, arbitrary profile text, or reason for withheld FSP data. +// Evidence explanations use bounded codes, not free text. When ML is unavailable, semantic similarity +// uses the neutral 0.5 specified by FR09 and `unknown_flags` names `ml_unavailable`. For fewer than 30 +// comparable real candidates, the search uses neutral T = 0.5, returns no percentile value, and names +// `cohort_below_30`. +// +// A missing, unknown, expired, or revoked session answers 401 unauthenticated; a candidate account +// answers 403 forbidden; an unknown organization or account without active membership answers 404 +// not_found. The response is `Cache-Control: no-store`. +// +// POST /api/v1/organizations/{org_id}/matches +func (s *Server) handleSearchOrganizationMatchesRequest(args [1]string, argsEscaped bool, w http.ResponseWriter, r *http.Request) { + statusWriter := &codeRecorder{ResponseWriter: w} + w = statusWriter + otelAttrs := []attribute.KeyValue{ + otelogen.OperationID("SearchOrganizationMatches"), + semconv.HTTPRequestMethodKey.String("POST"), + semconv.HTTPRouteKey.String("/api/v1/organizations/{org_id}/matches"), + } + // Add attributes from config. + otelAttrs = append(otelAttrs, s.cfg.Attributes...) + + // Start a span for this request. + ctx, span := s.cfg.Tracer.Start(r.Context(), SearchOrganizationMatchesOperation, + trace.WithAttributes(otelAttrs...), + serverSpanKind, + ) + defer span.End() + + // Add Labeler to context. + labeler := &Labeler{attrs: otelAttrs} + ctx = contextWithLabeler(ctx, labeler) + + // Run stopwatch. + startTime := time.Now() + defer func() { + elapsedDuration := time.Since(startTime) + + attrSet := labeler.AttributeSet() + attrs := attrSet.ToSlice() + code := statusWriter.status + if code != 0 { + codeAttr := semconv.HTTPResponseStatusCode(code) + attrs = append(attrs, codeAttr) + span.SetAttributes(attrs...) + } + attrOpt := metric.WithAttributes(attrs...) + + // Increment request counter. + s.requests.Add(ctx, 1, attrOpt) + + // Use floating point division here for higher precision (instead of Millisecond method). + s.duration.Record(ctx, float64(elapsedDuration)/float64(time.Millisecond), attrOpt) + }() + + var ( + recordError = func(stage string, err error) { + span.RecordError(err) + + // https://opentelemetry.io/docs/specs/semconv/http/http-spans/#status + // Span Status MUST be left unset if HTTP status code was in the 1xx, 2xx or 3xx ranges, + // unless there was another error (e.g., network error receiving the response body; or 3xx codes with + // max redirects exceeded), in which case status MUST be set to Error. + code := statusWriter.status + if code < 100 || code >= 500 { + span.SetStatus(codes.Error, stage) + } + + attrSet := labeler.AttributeSet() + attrs := attrSet.ToSlice() + if code != 0 { + attrs = append(attrs, semconv.HTTPResponseStatusCode(code)) + } + + s.errors.Add(ctx, 1, metric.WithAttributes(attrs...)) + } + err error + opErrContext = ogenerrors.OperationContext{ + Name: SearchOrganizationMatchesOperation, + ID: "SearchOrganizationMatches", + } + ) + { + type bitset = [1]uint8 + var satisfied bitset + { + sctx, ok, err := s.securitySessionCookie(ctx, SearchOrganizationMatchesOperation, r) + if err != nil { + err = &ogenerrors.SecurityError{ + OperationContext: opErrContext, + Security: "SessionCookie", + Err: err, + } + if encodeErr := encodeErrorResponse(s.h.NewError(ctx, err), w, span); encodeErr != nil { + defer recordError("Security:SessionCookie", err) + } + return + } + if ok { + satisfied[0] |= 1 << 0 + ctx = sctx + } + } + { + sctx, ok, err := s.securitySessionCsrf(ctx, SearchOrganizationMatchesOperation, r) + if err != nil { + err = &ogenerrors.SecurityError{ + OperationContext: opErrContext, + Security: "SessionCsrf", + Err: err, + } + if encodeErr := encodeErrorResponse(s.h.NewError(ctx, err), w, span); encodeErr != nil { + defer recordError("Security:SessionCsrf", err) + } + return + } + if ok { + satisfied[0] |= 1 << 1 + ctx = sctx + } + } + + if ok := func() bool { + nextRequirement: + for _, requirement := range []bitset{ + {0b00000011}, + } { + for i, mask := range requirement { + if satisfied[i]&mask != mask { + continue nextRequirement + } + } + return true + } + return false + }(); !ok { + err = &ogenerrors.SecurityError{ + OperationContext: opErrContext, + Err: ogenerrors.ErrSecurityRequirementIsNotSatisfied, + } + if encodeErr := encodeErrorResponse(s.h.NewError(ctx, err), w, span); encodeErr != nil { + defer recordError("Security", err) + } + return + } + } + params, err := decodeSearchOrganizationMatchesParams(args, argsEscaped, r) + if err != nil { + err = &ogenerrors.DecodeParamsError{ + OperationContext: opErrContext, + Err: err, + } + defer recordError("DecodeParams", err) + s.cfg.ErrorHandler(ctx, w, r, err) + return + } + + var rawBody []byte + request, rawBody, close, err := s.decodeSearchOrganizationMatchesRequest(r) + if err != nil { + err = &ogenerrors.DecodeRequestError{ + OperationContext: opErrContext, + Err: err, + } + defer recordError("DecodeRequest", err) + s.cfg.ErrorHandler(ctx, w, r, err) + return + } + defer func() { + if err := close(); err != nil { + recordError("CloseRequest", err) + } + }() + + var response SearchOrganizationMatchesRes + if m := s.cfg.Middleware; m != nil { + mreq := middleware.Request{ + Context: ctx, + OperationName: SearchOrganizationMatchesOperation, + OperationSummary: "Search the current organization-visible candidate bank.", + OperationID: "SearchOrganizationMatches", + Body: request, + RawBody: rawBody, + Params: middleware.Parameters{ + { + Name: "org_id", + In: "path", + }: params.OrgID, + }, + Raw: r, + } + + type ( + Request = MatchSearchRequest + Params = SearchOrganizationMatchesParams + Response = SearchOrganizationMatchesRes + ) + response, err = middleware.HookMiddleware[ + Request, + Params, + Response, + ]( + m, + mreq, + unpackSearchOrganizationMatchesParams, + func(ctx context.Context, request Request, params Params) (response Response, err error) { + response, err = s.h.SearchOrganizationMatches(ctx, request, params) + return response, err + }, + ) + } else { + response, err = s.h.SearchOrganizationMatches(ctx, request, params) + } + if err != nil { + if errRes, ok := errors.Into[*ProblemStatusCode](err); ok { + if err := encodeErrorResponse(errRes, w, span); err != nil { + defer recordError("Internal", err) + } + return + } + if errors.Is(err, ht.ErrNotImplemented) { + s.cfg.ErrorHandler(ctx, w, r, err) + return + } + if err := encodeErrorResponse(s.h.NewError(ctx, err), w, span); err != nil { + defer recordError("Internal", err) + } + return + } + + if err := encodeSearchOrganizationMatchesResponse(response, w, span); err != nil { + defer recordError("EncodeResponse", err) + if !errors.Is(err, ht.ErrInternalServerErrorResponse) { + s.cfg.ErrorHandler(ctx, w, r, err) + } + return + } +} + // handleSendOrganizationInvitationRequest handles SendOrganizationInvitation operation. // // Requires the session cookie of an employer account with an active membership in `org_id`, the CSRF diff --git a/backend/internal/adapter/primary/http/api/oas_interfaces_gen.go b/backend/internal/adapter/primary/http/api/oas_interfaces_gen.go index ac39259..79d761c 100644 --- a/backend/internal/adapter/primary/http/api/oas_interfaces_gen.go +++ b/backend/internal/adapter/primary/http/api/oas_interfaces_gen.go @@ -201,6 +201,10 @@ type SaveMyQuestionnaireRes interface { saveMyQuestionnaireRes() } +type SearchOrganizationMatchesRes interface { + searchOrganizationMatchesRes() +} + type SendOrganizationInvitationRes interface { sendOrganizationInvitationRes() } diff --git a/backend/internal/adapter/primary/http/api/oas_json_gen.go b/backend/internal/adapter/primary/http/api/oas_json_gen.go index a65eb35..fc0bd6c 100644 --- a/backend/internal/adapter/primary/http/api/oas_json_gen.go +++ b/backend/internal/adapter/primary/http/api/oas_json_gen.go @@ -25679,6 +25679,3632 @@ func (s *LoginUnauthorized) UnmarshalJSON(data []byte) error { return s.Decode(d) } +// Encode implements json.Marshaler. +func (s *MatchAppliedConditions) Encode(e *jx.Encoder) { + e.ObjStart() + s.encodeFields(e) + e.ObjEnd() +} + +// encodeFields encodes fields. +func (s *MatchAppliedConditions) encodeFields(e *jx.Encoder) { + { + e.FieldStart("work_formats") + if s.WorkFormats == nil { + e.Null() + } else { + e.ArrStart() + for _, elem := range s.WorkFormats { + elem.Encode(e) + } + e.ArrEnd() + } + } + { + e.FieldStart("salary_compatibility") + s.SalaryCompatibility.Encode(e) + } +} + +var jsonFieldsNameOfMatchAppliedConditions = [2]string{ + 0: "work_formats", + 1: "salary_compatibility", +} + +// Decode decodes MatchAppliedConditions from json. +func (s *MatchAppliedConditions) Decode(d *jx.Decoder) error { + if s == nil { + return errors.New("invalid: unable to decode MatchAppliedConditions to nil") + } + var requiredBitSet [1]uint8 + + if err := d.ObjBytes(func(d *jx.Decoder, k []byte) error { + switch string(k) { + case "work_formats": + requiredBitSet[0] |= 1 << 0 + if err := func() error { + switch tt := d.Next(); tt { + case jx.Null: + if err := d.Skip(); err != nil { + return err + } + default: + s.WorkFormats = make([]WorkFormat, 0) + if err := d.Arr(func(d *jx.Decoder) error { + var elem WorkFormat + if err := elem.Decode(d); err != nil { + return err + } + s.WorkFormats = append(s.WorkFormats, elem) + return nil + }); err != nil { + return err + } + } + return nil + }(); err != nil { + return errors.Wrap(err, "decode field \"work_formats\"") + } + case "salary_compatibility": + requiredBitSet[0] |= 1 << 1 + if err := func() error { + if err := s.SalaryCompatibility.Decode(d); err != nil { + return err + } + return nil + }(); err != nil { + return errors.Wrap(err, "decode field \"salary_compatibility\"") + } + default: + return errors.Errorf("unexpected field %q", k) + } + return nil + }); err != nil { + return errors.Wrap(err, "decode MatchAppliedConditions") + } + // Validate required fields. + var failures []validate.FieldError + for i, mask := range [1]uint8{ + 0b00000011, + } { + if result := (requiredBitSet[i] & mask) ^ mask; result != 0 { + // Mask only required fields and check equality to mask using XOR. + // + // If XOR result is not zero, result is not equal to expected, so some fields are missed. + // Bits of fields which would be set are actually bits of missed fields. + missed := bits.OnesCount8(result) + for bitN := 0; bitN < missed; bitN++ { + bitIdx := bits.TrailingZeros8(result) + fieldIdx := i*8 + bitIdx + var name string + if fieldIdx < len(jsonFieldsNameOfMatchAppliedConditions) { + name = jsonFieldsNameOfMatchAppliedConditions[fieldIdx] + } else { + name = strconv.Itoa(fieldIdx) + } + failures = append(failures, validate.FieldError{ + Name: name, + Error: validate.ErrFieldRequired, + }) + // Reset bit. + result &^= 1 << bitIdx + } + } + } + if len(failures) > 0 { + return &validate.Error{Fields: failures} + } + + return nil +} + +// MarshalJSON implements stdjson.Marshaler. +func (s *MatchAppliedConditions) MarshalJSON() ([]byte, error) { + e := jx.Encoder{} + s.Encode(&e) + return e.Bytes(), nil +} + +// UnmarshalJSON implements stdjson.Unmarshaler. +func (s *MatchAppliedConditions) UnmarshalJSON(data []byte) error { + d := jx.DecodeBytes(data) + return s.Decode(d) +} + +// Encode implements json.Marshaler. +func (s *MatchAppliedFilters) Encode(e *jx.Encoder) { + e.ObjStart() + s.encodeFields(e) + e.ObjEnd() +} + +// encodeFields encodes fields. +func (s *MatchAppliedFilters) encodeFields(e *jx.Encoder) { + { + e.FieldStart("specialization") + s.Specialization.Encode(e) + } + { + e.FieldStart("confirmed_grade") + s.ConfirmedGrade.Encode(e) + } + { + e.FieldStart("confirmed_category") + s.ConfirmedCategory.Encode(e) + } + { + e.FieldStart("confirmation_status") + s.ConfirmationStatus.Encode(e) + } + { + e.FieldStart("declared_grade") + s.DeclaredGrade.Encode(e) + } + { + e.FieldStart("stack") + if s.Stack == nil { + e.Null() + } else { + e.ArrStart() + for _, elem := range s.Stack { + elem.Encode(e) + } + e.ArrEnd() + } + } + { + e.FieldStart("conditions") + s.Conditions.Encode(e) + } +} + +var jsonFieldsNameOfMatchAppliedFilters = [7]string{ + 0: "specialization", + 1: "confirmed_grade", + 2: "confirmed_category", + 3: "confirmation_status", + 4: "declared_grade", + 5: "stack", + 6: "conditions", +} + +// Decode decodes MatchAppliedFilters from json. +func (s *MatchAppliedFilters) Decode(d *jx.Decoder) error { + if s == nil { + return errors.New("invalid: unable to decode MatchAppliedFilters to nil") + } + var requiredBitSet [1]uint8 + + if err := d.ObjBytes(func(d *jx.Decoder, k []byte) error { + switch string(k) { + case "specialization": + requiredBitSet[0] |= 1 << 0 + if err := func() error { + if err := s.Specialization.Decode(d); err != nil { + return err + } + return nil + }(); err != nil { + return errors.Wrap(err, "decode field \"specialization\"") + } + case "confirmed_grade": + requiredBitSet[0] |= 1 << 1 + if err := func() error { + if err := s.ConfirmedGrade.Decode(d); err != nil { + return err + } + return nil + }(); err != nil { + return errors.Wrap(err, "decode field \"confirmed_grade\"") + } + case "confirmed_category": + requiredBitSet[0] |= 1 << 2 + if err := func() error { + if err := s.ConfirmedCategory.Decode(d); err != nil { + return err + } + return nil + }(); err != nil { + return errors.Wrap(err, "decode field \"confirmed_category\"") + } + case "confirmation_status": + requiredBitSet[0] |= 1 << 3 + if err := func() error { + if err := s.ConfirmationStatus.Decode(d); err != nil { + return err + } + return nil + }(); err != nil { + return errors.Wrap(err, "decode field \"confirmation_status\"") + } + case "declared_grade": + requiredBitSet[0] |= 1 << 4 + if err := func() error { + if err := s.DeclaredGrade.Decode(d); err != nil { + return err + } + return nil + }(); err != nil { + return errors.Wrap(err, "decode field \"declared_grade\"") + } + case "stack": + requiredBitSet[0] |= 1 << 5 + if err := func() error { + switch tt := d.Next(); tt { + case jx.Null: + if err := d.Skip(); err != nil { + return err + } + default: + s.Stack = make([]MatchSearchStackTag, 0) + if err := d.Arr(func(d *jx.Decoder) error { + var elem MatchSearchStackTag + if err := elem.Decode(d); err != nil { + return err + } + s.Stack = append(s.Stack, elem) + return nil + }); err != nil { + return err + } + } + return nil + }(); err != nil { + return errors.Wrap(err, "decode field \"stack\"") + } + case "conditions": + requiredBitSet[0] |= 1 << 6 + if err := func() error { + if err := s.Conditions.Decode(d); err != nil { + return err + } + return nil + }(); err != nil { + return errors.Wrap(err, "decode field \"conditions\"") + } + default: + return errors.Errorf("unexpected field %q", k) + } + return nil + }); err != nil { + return errors.Wrap(err, "decode MatchAppliedFilters") + } + // Validate required fields. + var failures []validate.FieldError + for i, mask := range [1]uint8{ + 0b01111111, + } { + if result := (requiredBitSet[i] & mask) ^ mask; result != 0 { + // Mask only required fields and check equality to mask using XOR. + // + // If XOR result is not zero, result is not equal to expected, so some fields are missed. + // Bits of fields which would be set are actually bits of missed fields. + missed := bits.OnesCount8(result) + for bitN := 0; bitN < missed; bitN++ { + bitIdx := bits.TrailingZeros8(result) + fieldIdx := i*8 + bitIdx + var name string + if fieldIdx < len(jsonFieldsNameOfMatchAppliedFilters) { + name = jsonFieldsNameOfMatchAppliedFilters[fieldIdx] + } else { + name = strconv.Itoa(fieldIdx) + } + failures = append(failures, validate.FieldError{ + Name: name, + Error: validate.ErrFieldRequired, + }) + // Reset bit. + result &^= 1 << bitIdx + } + } + } + if len(failures) > 0 { + return &validate.Error{Fields: failures} + } + + return nil +} + +// MarshalJSON implements stdjson.Marshaler. +func (s *MatchAppliedFilters) MarshalJSON() ([]byte, error) { + e := jx.Encoder{} + s.Encode(&e) + return e.Bytes(), nil +} + +// UnmarshalJSON implements stdjson.Unmarshaler. +func (s *MatchAppliedFilters) UnmarshalJSON(data []byte) error { + d := jx.DecodeBytes(data) + return s.Decode(d) +} + +// Encode implements json.Marshaler. +func (s *MatchCategory) Encode(e *jx.Encoder) { + e.ObjStart() + s.encodeFields(e) + e.ObjEnd() +} + +// encodeFields encodes fields. +func (s *MatchCategory) encodeFields(e *jx.Encoder) { + { + e.FieldStart("specialization") + s.Specialization.Encode(e) + } + { + e.FieldStart("grade") + s.Grade.Encode(e) + } +} + +var jsonFieldsNameOfMatchCategory = [2]string{ + 0: "specialization", + 1: "grade", +} + +// Decode decodes MatchCategory from json. +func (s *MatchCategory) Decode(d *jx.Decoder) error { + if s == nil { + return errors.New("invalid: unable to decode MatchCategory to nil") + } + var requiredBitSet [1]uint8 + + if err := d.ObjBytes(func(d *jx.Decoder, k []byte) error { + switch string(k) { + case "specialization": + requiredBitSet[0] |= 1 << 0 + if err := func() error { + if err := s.Specialization.Decode(d); err != nil { + return err + } + return nil + }(); err != nil { + return errors.Wrap(err, "decode field \"specialization\"") + } + case "grade": + requiredBitSet[0] |= 1 << 1 + if err := func() error { + if err := s.Grade.Decode(d); err != nil { + return err + } + return nil + }(); err != nil { + return errors.Wrap(err, "decode field \"grade\"") + } + default: + return errors.Errorf("unexpected field %q", k) + } + return nil + }); err != nil { + return errors.Wrap(err, "decode MatchCategory") + } + // Validate required fields. + var failures []validate.FieldError + for i, mask := range [1]uint8{ + 0b00000011, + } { + if result := (requiredBitSet[i] & mask) ^ mask; result != 0 { + // Mask only required fields and check equality to mask using XOR. + // + // If XOR result is not zero, result is not equal to expected, so some fields are missed. + // Bits of fields which would be set are actually bits of missed fields. + missed := bits.OnesCount8(result) + for bitN := 0; bitN < missed; bitN++ { + bitIdx := bits.TrailingZeros8(result) + fieldIdx := i*8 + bitIdx + var name string + if fieldIdx < len(jsonFieldsNameOfMatchCategory) { + name = jsonFieldsNameOfMatchCategory[fieldIdx] + } else { + name = strconv.Itoa(fieldIdx) + } + failures = append(failures, validate.FieldError{ + Name: name, + Error: validate.ErrFieldRequired, + }) + // Reset bit. + result &^= 1 << bitIdx + } + } + } + if len(failures) > 0 { + return &validate.Error{Fields: failures} + } + + return nil +} + +// MarshalJSON implements stdjson.Marshaler. +func (s *MatchCategory) MarshalJSON() ([]byte, error) { + e := jx.Encoder{} + s.Encode(&e) + return e.Bytes(), nil +} + +// UnmarshalJSON implements stdjson.Unmarshaler. +func (s *MatchCategory) UnmarshalJSON(data []byte) error { + d := jx.DecodeBytes(data) + return s.Decode(d) +} + +// Encode encodes MatchConfirmationStatus as json. +func (s MatchConfirmationStatus) Encode(e *jx.Encoder) { + e.Str(string(s)) +} + +// Decode decodes MatchConfirmationStatus from json. +func (s *MatchConfirmationStatus) Decode(d *jx.Decoder) error { + if s == nil { + return errors.New("invalid: unable to decode MatchConfirmationStatus to nil") + } + v, err := d.StrBytes() + if err != nil { + return err + } + // Try to use constant string. + switch MatchConfirmationStatus(v) { + case MatchConfirmationStatusConfirmed: + *s = MatchConfirmationStatusConfirmed + case MatchConfirmationStatusUnconfirmed: + *s = MatchConfirmationStatusUnconfirmed + default: + *s = MatchConfirmationStatus(v) + } + + return nil +} + +// MarshalJSON implements stdjson.Marshaler. +func (s MatchConfirmationStatus) MarshalJSON() ([]byte, error) { + e := jx.Encoder{} + s.Encode(&e) + return e.Bytes(), nil +} + +// UnmarshalJSON implements stdjson.Unmarshaler. +func (s *MatchConfirmationStatus) UnmarshalJSON(data []byte) error { + d := jx.DecodeBytes(data) + return s.Decode(d) +} + +// Encode implements json.Marshaler. +func (s *MatchConfirmedCandidate) Encode(e *jx.Encoder) { + e.ObjStart() + s.encodeFields(e) + e.ObjEnd() +} + +// encodeFields encodes fields. +func (s *MatchConfirmedCandidate) encodeFields(e *jx.Encoder) { + { + e.FieldStart("candidate_handle") + s.CandidateHandle.Encode(e) + } + { + e.FieldStart("specialization") + s.Specialization.Encode(e) + } + { + e.FieldStart("confirmation_status") + s.ConfirmationStatus.Encode(e) + } + { + e.FieldStart("declared_grade") + s.DeclaredGrade.Encode(e) + } + { + e.FieldStart("category") + s.Category.Encode(e) + } + { + e.FieldStart("strength") + s.Strength.Encode(e) + } + { + e.FieldStart("public_context") + s.PublicContext.Encode(e) + } + { + e.FieldStart("evidence_summary") + s.EvidenceSummary.Encode(e) + } + { + e.FieldStart("components") + s.Components.Encode(e) + } + { + e.FieldStart("unknown_flags") + s.UnknownFlags.Encode(e) + } +} + +var jsonFieldsNameOfMatchConfirmedCandidate = [10]string{ + 0: "candidate_handle", + 1: "specialization", + 2: "confirmation_status", + 3: "declared_grade", + 4: "category", + 5: "strength", + 6: "public_context", + 7: "evidence_summary", + 8: "components", + 9: "unknown_flags", +} + +// Decode decodes MatchConfirmedCandidate from json. +func (s *MatchConfirmedCandidate) Decode(d *jx.Decoder) error { + if s == nil { + return errors.New("invalid: unable to decode MatchConfirmedCandidate to nil") + } + var requiredBitSet [2]uint8 + + if err := d.ObjBytes(func(d *jx.Decoder, k []byte) error { + switch string(k) { + case "candidate_handle": + requiredBitSet[0] |= 1 << 0 + if err := func() error { + if err := s.CandidateHandle.Decode(d); err != nil { + return err + } + return nil + }(); err != nil { + return errors.Wrap(err, "decode field \"candidate_handle\"") + } + case "specialization": + requiredBitSet[0] |= 1 << 1 + if err := func() error { + if err := s.Specialization.Decode(d); err != nil { + return err + } + return nil + }(); err != nil { + return errors.Wrap(err, "decode field \"specialization\"") + } + case "confirmation_status": + requiredBitSet[0] |= 1 << 2 + if err := func() error { + if err := s.ConfirmationStatus.Decode(d); err != nil { + return err + } + return nil + }(); err != nil { + return errors.Wrap(err, "decode field \"confirmation_status\"") + } + case "declared_grade": + requiredBitSet[0] |= 1 << 3 + if err := func() error { + if err := s.DeclaredGrade.Decode(d); err != nil { + return err + } + return nil + }(); err != nil { + return errors.Wrap(err, "decode field \"declared_grade\"") + } + case "category": + requiredBitSet[0] |= 1 << 4 + if err := func() error { + if err := s.Category.Decode(d); err != nil { + return err + } + return nil + }(); err != nil { + return errors.Wrap(err, "decode field \"category\"") + } + case "strength": + requiredBitSet[0] |= 1 << 5 + if err := func() error { + if err := s.Strength.Decode(d); err != nil { + return err + } + return nil + }(); err != nil { + return errors.Wrap(err, "decode field \"strength\"") + } + case "public_context": + requiredBitSet[0] |= 1 << 6 + if err := func() error { + if err := s.PublicContext.Decode(d); err != nil { + return err + } + return nil + }(); err != nil { + return errors.Wrap(err, "decode field \"public_context\"") + } + case "evidence_summary": + requiredBitSet[0] |= 1 << 7 + if err := func() error { + if err := s.EvidenceSummary.Decode(d); err != nil { + return err + } + return nil + }(); err != nil { + return errors.Wrap(err, "decode field \"evidence_summary\"") + } + case "components": + requiredBitSet[1] |= 1 << 0 + if err := func() error { + if err := s.Components.Decode(d); err != nil { + return err + } + return nil + }(); err != nil { + return errors.Wrap(err, "decode field \"components\"") + } + case "unknown_flags": + requiredBitSet[1] |= 1 << 1 + if err := func() error { + if err := s.UnknownFlags.Decode(d); err != nil { + return err + } + return nil + }(); err != nil { + return errors.Wrap(err, "decode field \"unknown_flags\"") + } + default: + return errors.Errorf("unexpected field %q", k) + } + return nil + }); err != nil { + return errors.Wrap(err, "decode MatchConfirmedCandidate") + } + // Validate required fields. + var failures []validate.FieldError + for i, mask := range [2]uint8{ + 0b11111111, + 0b00000011, + } { + if result := (requiredBitSet[i] & mask) ^ mask; result != 0 { + // Mask only required fields and check equality to mask using XOR. + // + // If XOR result is not zero, result is not equal to expected, so some fields are missed. + // Bits of fields which would be set are actually bits of missed fields. + missed := bits.OnesCount8(result) + for bitN := 0; bitN < missed; bitN++ { + bitIdx := bits.TrailingZeros8(result) + fieldIdx := i*8 + bitIdx + var name string + if fieldIdx < len(jsonFieldsNameOfMatchConfirmedCandidate) { + name = jsonFieldsNameOfMatchConfirmedCandidate[fieldIdx] + } else { + name = strconv.Itoa(fieldIdx) + } + failures = append(failures, validate.FieldError{ + Name: name, + Error: validate.ErrFieldRequired, + }) + // Reset bit. + result &^= 1 << bitIdx + } + } + } + if len(failures) > 0 { + return &validate.Error{Fields: failures} + } + + return nil +} + +// MarshalJSON implements stdjson.Marshaler. +func (s *MatchConfirmedCandidate) MarshalJSON() ([]byte, error) { + e := jx.Encoder{} + s.Encode(&e) + return e.Bytes(), nil +} + +// UnmarshalJSON implements stdjson.Unmarshaler. +func (s *MatchConfirmedCandidate) UnmarshalJSON(data []byte) error { + d := jx.DecodeBytes(data) + return s.Decode(d) +} + +// Encode encodes MatchConfirmedCandidateConfirmationStatus as json. +func (s MatchConfirmedCandidateConfirmationStatus) Encode(e *jx.Encoder) { + e.Str(string(s)) +} + +// Decode decodes MatchConfirmedCandidateConfirmationStatus from json. +func (s *MatchConfirmedCandidateConfirmationStatus) Decode(d *jx.Decoder) error { + if s == nil { + return errors.New("invalid: unable to decode MatchConfirmedCandidateConfirmationStatus to nil") + } + v, err := d.StrBytes() + if err != nil { + return err + } + // Try to use constant string. + switch MatchConfirmedCandidateConfirmationStatus(v) { + case MatchConfirmedCandidateConfirmationStatusConfirmed: + *s = MatchConfirmedCandidateConfirmationStatusConfirmed + default: + *s = MatchConfirmedCandidateConfirmationStatus(v) + } + + return nil +} + +// MarshalJSON implements stdjson.Marshaler. +func (s MatchConfirmedCandidateConfirmationStatus) MarshalJSON() ([]byte, error) { + e := jx.Encoder{} + s.Encode(&e) + return e.Bytes(), nil +} + +// UnmarshalJSON implements stdjson.Unmarshaler. +func (s *MatchConfirmedCandidateConfirmationStatus) UnmarshalJSON(data []byte) error { + d := jx.DecodeBytes(data) + return s.Decode(d) +} + +// Encode implements json.Marshaler. +func (s *MatchConfirmedComponents) Encode(e *jx.Encoder) { + e.ObjStart() + s.encodeFields(e) + e.ObjEnd() +} + +// encodeFields encodes fields. +func (s *MatchConfirmedComponents) encodeFields(e *jx.Encoder) { + { + e.FieldStart("fit") + s.Fit.Encode(e) + } + { + e.FieldStart("coverage") + s.Coverage.Encode(e) + } + { + e.FieldStart("domain") + s.Domain.Encode(e) + } + { + e.FieldStart("semantics") + s.Semantics.Encode(e) + } + { + e.FieldStart("percentile") + s.Percentile.Encode(e) + } + { + e.FieldStart("competition") + s.Competition.Encode(e) + } + { + e.FieldStart("freshness") + s.Freshness.Encode(e) + } + { + e.FieldStart("responsiveness") + s.Responsiveness.Encode(e) + } + { + e.FieldStart("rank_score") + s.RankScore.Encode(e) + } +} + +var jsonFieldsNameOfMatchConfirmedComponents = [9]string{ + 0: "fit", + 1: "coverage", + 2: "domain", + 3: "semantics", + 4: "percentile", + 5: "competition", + 6: "freshness", + 7: "responsiveness", + 8: "rank_score", +} + +// Decode decodes MatchConfirmedComponents from json. +func (s *MatchConfirmedComponents) Decode(d *jx.Decoder) error { + if s == nil { + return errors.New("invalid: unable to decode MatchConfirmedComponents to nil") + } + var requiredBitSet [2]uint8 + + if err := d.ObjBytes(func(d *jx.Decoder, k []byte) error { + switch string(k) { + case "fit": + requiredBitSet[0] |= 1 << 0 + if err := func() error { + if err := s.Fit.Decode(d); err != nil { + return err + } + return nil + }(); err != nil { + return errors.Wrap(err, "decode field \"fit\"") + } + case "coverage": + requiredBitSet[0] |= 1 << 1 + if err := func() error { + if err := s.Coverage.Decode(d); err != nil { + return err + } + return nil + }(); err != nil { + return errors.Wrap(err, "decode field \"coverage\"") + } + case "domain": + requiredBitSet[0] |= 1 << 2 + if err := func() error { + if err := s.Domain.Decode(d); err != nil { + return err + } + return nil + }(); err != nil { + return errors.Wrap(err, "decode field \"domain\"") + } + case "semantics": + requiredBitSet[0] |= 1 << 3 + if err := func() error { + if err := s.Semantics.Decode(d); err != nil { + return err + } + return nil + }(); err != nil { + return errors.Wrap(err, "decode field \"semantics\"") + } + case "percentile": + requiredBitSet[0] |= 1 << 4 + if err := func() error { + if err := s.Percentile.Decode(d); err != nil { + return err + } + return nil + }(); err != nil { + return errors.Wrap(err, "decode field \"percentile\"") + } + case "competition": + requiredBitSet[0] |= 1 << 5 + if err := func() error { + if err := s.Competition.Decode(d); err != nil { + return err + } + return nil + }(); err != nil { + return errors.Wrap(err, "decode field \"competition\"") + } + case "freshness": + requiredBitSet[0] |= 1 << 6 + if err := func() error { + if err := s.Freshness.Decode(d); err != nil { + return err + } + return nil + }(); err != nil { + return errors.Wrap(err, "decode field \"freshness\"") + } + case "responsiveness": + requiredBitSet[0] |= 1 << 7 + if err := func() error { + if err := s.Responsiveness.Decode(d); err != nil { + return err + } + return nil + }(); err != nil { + return errors.Wrap(err, "decode field \"responsiveness\"") + } + case "rank_score": + requiredBitSet[1] |= 1 << 0 + if err := func() error { + if err := s.RankScore.Decode(d); err != nil { + return err + } + return nil + }(); err != nil { + return errors.Wrap(err, "decode field \"rank_score\"") + } + default: + return errors.Errorf("unexpected field %q", k) + } + return nil + }); err != nil { + return errors.Wrap(err, "decode MatchConfirmedComponents") + } + // Validate required fields. + var failures []validate.FieldError + for i, mask := range [2]uint8{ + 0b11111111, + 0b00000001, + } { + if result := (requiredBitSet[i] & mask) ^ mask; result != 0 { + // Mask only required fields and check equality to mask using XOR. + // + // If XOR result is not zero, result is not equal to expected, so some fields are missed. + // Bits of fields which would be set are actually bits of missed fields. + missed := bits.OnesCount8(result) + for bitN := 0; bitN < missed; bitN++ { + bitIdx := bits.TrailingZeros8(result) + fieldIdx := i*8 + bitIdx + var name string + if fieldIdx < len(jsonFieldsNameOfMatchConfirmedComponents) { + name = jsonFieldsNameOfMatchConfirmedComponents[fieldIdx] + } else { + name = strconv.Itoa(fieldIdx) + } + failures = append(failures, validate.FieldError{ + Name: name, + Error: validate.ErrFieldRequired, + }) + // Reset bit. + result &^= 1 << bitIdx + } + } + } + if len(failures) > 0 { + return &validate.Error{Fields: failures} + } + + return nil +} + +// MarshalJSON implements stdjson.Marshaler. +func (s *MatchConfirmedComponents) MarshalJSON() ([]byte, error) { + e := jx.Encoder{} + s.Encode(&e) + return e.Bytes(), nil +} + +// UnmarshalJSON implements stdjson.Unmarshaler. +func (s *MatchConfirmedComponents) UnmarshalJSON(data []byte) error { + d := jx.DecodeBytes(data) + return s.Decode(d) +} + +// Encode encodes MatchEvidenceCode as json. +func (s MatchEvidenceCode) Encode(e *jx.Encoder) { + e.Str(string(s)) +} + +// Decode decodes MatchEvidenceCode from json. +func (s *MatchEvidenceCode) Decode(d *jx.Decoder) error { + if s == nil { + return errors.New("invalid: unable to decode MatchEvidenceCode to nil") + } + v, err := d.StrBytes() + if err != nil { + return err + } + // Try to use constant string. + switch MatchEvidenceCode(v) { + case MatchEvidenceCodeConfirmedCategory: + *s = MatchEvidenceCodeConfirmedCategory + case MatchEvidenceCodeRequiredSkillEvidence: + *s = MatchEvidenceCodeRequiredSkillEvidence + case MatchEvidenceCodeDesiredSkillEvidence: + *s = MatchEvidenceCodeDesiredSkillEvidence + case MatchEvidenceCodeDomainAlignment: + *s = MatchEvidenceCodeDomainAlignment + case MatchEvidenceCodeTaskAlignment: + *s = MatchEvidenceCodeTaskAlignment + case MatchEvidenceCodeWorkConditionsMatch: + *s = MatchEvidenceCodeWorkConditionsMatch + case MatchEvidenceCodeSalaryCompatibility: + *s = MatchEvidenceCodeSalaryCompatibility + case MatchEvidenceCodeDeclaredGrade: + *s = MatchEvidenceCodeDeclaredGrade + default: + *s = MatchEvidenceCode(v) + } + + return nil +} + +// MarshalJSON implements stdjson.Marshaler. +func (s MatchEvidenceCode) MarshalJSON() ([]byte, error) { + e := jx.Encoder{} + s.Encode(&e) + return e.Bytes(), nil +} + +// UnmarshalJSON implements stdjson.Unmarshaler. +func (s *MatchEvidenceCode) UnmarshalJSON(data []byte) error { + d := jx.DecodeBytes(data) + return s.Decode(d) +} + +// Encode encodes MatchEvidenceState as json. +func (s MatchEvidenceState) Encode(e *jx.Encoder) { + e.Str(string(s)) +} + +// Decode decodes MatchEvidenceState from json. +func (s *MatchEvidenceState) Decode(d *jx.Decoder) error { + if s == nil { + return errors.New("invalid: unable to decode MatchEvidenceState to nil") + } + v, err := d.StrBytes() + if err != nil { + return err + } + // Try to use constant string. + switch MatchEvidenceState(v) { + case MatchEvidenceStateSupports: + *s = MatchEvidenceStateSupports + case MatchEvidenceStatePartial: + *s = MatchEvidenceStatePartial + case MatchEvidenceStateGap: + *s = MatchEvidenceStateGap + case MatchEvidenceStateDeclaredOnly: + *s = MatchEvidenceStateDeclaredOnly + default: + *s = MatchEvidenceState(v) + } + + return nil +} + +// MarshalJSON implements stdjson.Marshaler. +func (s MatchEvidenceState) MarshalJSON() ([]byte, error) { + e := jx.Encoder{} + s.Encode(&e) + return e.Bytes(), nil +} + +// UnmarshalJSON implements stdjson.Unmarshaler. +func (s *MatchEvidenceState) UnmarshalJSON(data []byte) error { + d := jx.DecodeBytes(data) + return s.Decode(d) +} + +// Encode encodes MatchEvidenceSummary as json. +func (s MatchEvidenceSummary) Encode(e *jx.Encoder) { + unwrapped := []MatchEvidenceSummaryItem(s) + + e.ArrStart() + for _, elem := range unwrapped { + elem.Encode(e) + } + e.ArrEnd() +} + +// Decode decodes MatchEvidenceSummary from json. +func (s *MatchEvidenceSummary) Decode(d *jx.Decoder) error { + if s == nil { + return errors.New("invalid: unable to decode MatchEvidenceSummary to nil") + } + var unwrapped []MatchEvidenceSummaryItem + if err := func() error { + unwrapped = make([]MatchEvidenceSummaryItem, 0) + if err := d.Arr(func(d *jx.Decoder) error { + var elem MatchEvidenceSummaryItem + if err := elem.Decode(d); err != nil { + return err + } + unwrapped = append(unwrapped, elem) + return nil + }); err != nil { + return err + } + return nil + }(); err != nil { + return errors.Wrap(err, "alias") + } + *s = MatchEvidenceSummary(unwrapped) + return nil +} + +// MarshalJSON implements stdjson.Marshaler. +func (s MatchEvidenceSummary) MarshalJSON() ([]byte, error) { + e := jx.Encoder{} + s.Encode(&e) + return e.Bytes(), nil +} + +// UnmarshalJSON implements stdjson.Unmarshaler. +func (s *MatchEvidenceSummary) UnmarshalJSON(data []byte) error { + d := jx.DecodeBytes(data) + return s.Decode(d) +} + +// Encode implements json.Marshaler. +func (s *MatchEvidenceSummaryItem) Encode(e *jx.Encoder) { + e.ObjStart() + s.encodeFields(e) + e.ObjEnd() +} + +// encodeFields encodes fields. +func (s *MatchEvidenceSummaryItem) encodeFields(e *jx.Encoder) { + { + e.FieldStart("code") + s.Code.Encode(e) + } + { + e.FieldStart("state") + s.State.Encode(e) + } +} + +var jsonFieldsNameOfMatchEvidenceSummaryItem = [2]string{ + 0: "code", + 1: "state", +} + +// Decode decodes MatchEvidenceSummaryItem from json. +func (s *MatchEvidenceSummaryItem) Decode(d *jx.Decoder) error { + if s == nil { + return errors.New("invalid: unable to decode MatchEvidenceSummaryItem to nil") + } + var requiredBitSet [1]uint8 + + if err := d.ObjBytes(func(d *jx.Decoder, k []byte) error { + switch string(k) { + case "code": + requiredBitSet[0] |= 1 << 0 + if err := func() error { + if err := s.Code.Decode(d); err != nil { + return err + } + return nil + }(); err != nil { + return errors.Wrap(err, "decode field \"code\"") + } + case "state": + requiredBitSet[0] |= 1 << 1 + if err := func() error { + if err := s.State.Decode(d); err != nil { + return err + } + return nil + }(); err != nil { + return errors.Wrap(err, "decode field \"state\"") + } + default: + return errors.Errorf("unexpected field %q", k) + } + return nil + }); err != nil { + return errors.Wrap(err, "decode MatchEvidenceSummaryItem") + } + // Validate required fields. + var failures []validate.FieldError + for i, mask := range [1]uint8{ + 0b00000011, + } { + if result := (requiredBitSet[i] & mask) ^ mask; result != 0 { + // Mask only required fields and check equality to mask using XOR. + // + // If XOR result is not zero, result is not equal to expected, so some fields are missed. + // Bits of fields which would be set are actually bits of missed fields. + missed := bits.OnesCount8(result) + for bitN := 0; bitN < missed; bitN++ { + bitIdx := bits.TrailingZeros8(result) + fieldIdx := i*8 + bitIdx + var name string + if fieldIdx < len(jsonFieldsNameOfMatchEvidenceSummaryItem) { + name = jsonFieldsNameOfMatchEvidenceSummaryItem[fieldIdx] + } else { + name = strconv.Itoa(fieldIdx) + } + failures = append(failures, validate.FieldError{ + Name: name, + Error: validate.ErrFieldRequired, + }) + // Reset bit. + result &^= 1 << bitIdx + } + } + } + if len(failures) > 0 { + return &validate.Error{Fields: failures} + } + + return nil +} + +// MarshalJSON implements stdjson.Marshaler. +func (s *MatchEvidenceSummaryItem) MarshalJSON() ([]byte, error) { + e := jx.Encoder{} + s.Encode(&e) + return e.Bytes(), nil +} + +// UnmarshalJSON implements stdjson.Unmarshaler. +func (s *MatchEvidenceSummaryItem) UnmarshalJSON(data []byte) error { + d := jx.DecodeBytes(data) + return s.Decode(d) +} + +// Encode implements json.Marshaler. +func (s *MatchGradeFilter) Encode(e *jx.Encoder) { + e.ObjStart() + s.encodeFields(e) + e.ObjEnd() +} + +// encodeFields encodes fields. +func (s *MatchGradeFilter) encodeFields(e *jx.Encoder) { + { + e.FieldStart("specialization") + s.Specialization.Encode(e) + } + { + e.FieldStart("grade") + s.Grade.Encode(e) + } +} + +var jsonFieldsNameOfMatchGradeFilter = [2]string{ + 0: "specialization", + 1: "grade", +} + +// Decode decodes MatchGradeFilter from json. +func (s *MatchGradeFilter) Decode(d *jx.Decoder) error { + if s == nil { + return errors.New("invalid: unable to decode MatchGradeFilter to nil") + } + var requiredBitSet [1]uint8 + + if err := d.ObjBytes(func(d *jx.Decoder, k []byte) error { + switch string(k) { + case "specialization": + requiredBitSet[0] |= 1 << 0 + if err := func() error { + if err := s.Specialization.Decode(d); err != nil { + return err + } + return nil + }(); err != nil { + return errors.Wrap(err, "decode field \"specialization\"") + } + case "grade": + requiredBitSet[0] |= 1 << 1 + if err := func() error { + if err := s.Grade.Decode(d); err != nil { + return err + } + return nil + }(); err != nil { + return errors.Wrap(err, "decode field \"grade\"") + } + default: + return errors.Errorf("unexpected field %q", k) + } + return nil + }); err != nil { + return errors.Wrap(err, "decode MatchGradeFilter") + } + // Validate required fields. + var failures []validate.FieldError + for i, mask := range [1]uint8{ + 0b00000011, + } { + if result := (requiredBitSet[i] & mask) ^ mask; result != 0 { + // Mask only required fields and check equality to mask using XOR. + // + // If XOR result is not zero, result is not equal to expected, so some fields are missed. + // Bits of fields which would be set are actually bits of missed fields. + missed := bits.OnesCount8(result) + for bitN := 0; bitN < missed; bitN++ { + bitIdx := bits.TrailingZeros8(result) + fieldIdx := i*8 + bitIdx + var name string + if fieldIdx < len(jsonFieldsNameOfMatchGradeFilter) { + name = jsonFieldsNameOfMatchGradeFilter[fieldIdx] + } else { + name = strconv.Itoa(fieldIdx) + } + failures = append(failures, validate.FieldError{ + Name: name, + Error: validate.ErrFieldRequired, + }) + // Reset bit. + result &^= 1 << bitIdx + } + } + } + if len(failures) > 0 { + return &validate.Error{Fields: failures} + } + + return nil +} + +// MarshalJSON implements stdjson.Marshaler. +func (s *MatchGradeFilter) MarshalJSON() ([]byte, error) { + e := jx.Encoder{} + s.Encode(&e) + return e.Bytes(), nil +} + +// UnmarshalJSON implements stdjson.Unmarshaler. +func (s *MatchGradeFilter) UnmarshalJSON(data []byte) error { + d := jx.DecodeBytes(data) + return s.Decode(d) +} + +// Encode implements json.Marshaler. +func (s *MatchPublicContext) Encode(e *jx.Encoder) { + e.ObjStart() + s.encodeFields(e) + e.ObjEnd() +} + +// encodeFields encodes fields. +func (s *MatchPublicContext) encodeFields(e *jx.Encoder) { + { + e.FieldStart("stack") + if s.Stack == nil { + e.Null() + } else { + s.Stack.Encode(e) + } + } + { + e.FieldStart("experience_band") + s.ExperienceBand.Encode(e) + } + { + e.FieldStart("work_formats") + if s.WorkFormats == nil { + e.Null() + } else { + e.ArrStart() + for _, elem := range s.WorkFormats { + elem.Encode(e) + } + e.ArrEnd() + } + } + { + e.FieldStart("salary_compatibility") + s.SalaryCompatibility.Encode(e) + } +} + +var jsonFieldsNameOfMatchPublicContext = [4]string{ + 0: "stack", + 1: "experience_band", + 2: "work_formats", + 3: "salary_compatibility", +} + +// Decode decodes MatchPublicContext from json. +func (s *MatchPublicContext) Decode(d *jx.Decoder) error { + if s == nil { + return errors.New("invalid: unable to decode MatchPublicContext to nil") + } + var requiredBitSet [1]uint8 + + if err := d.ObjBytes(func(d *jx.Decoder, k []byte) error { + switch string(k) { + case "stack": + requiredBitSet[0] |= 1 << 0 + if err := func() error { + if err := s.Stack.Decode(d); err != nil { + return err + } + return nil + }(); err != nil { + return errors.Wrap(err, "decode field \"stack\"") + } + case "experience_band": + requiredBitSet[0] |= 1 << 1 + if err := func() error { + if err := s.ExperienceBand.Decode(d); err != nil { + return err + } + return nil + }(); err != nil { + return errors.Wrap(err, "decode field \"experience_band\"") + } + case "work_formats": + requiredBitSet[0] |= 1 << 2 + if err := func() error { + switch tt := d.Next(); tt { + case jx.Null: + if err := d.Skip(); err != nil { + return err + } + default: + s.WorkFormats = make([]WorkFormat, 0) + if err := d.Arr(func(d *jx.Decoder) error { + var elem WorkFormat + if err := elem.Decode(d); err != nil { + return err + } + s.WorkFormats = append(s.WorkFormats, elem) + return nil + }); err != nil { + return err + } + } + return nil + }(); err != nil { + return errors.Wrap(err, "decode field \"work_formats\"") + } + case "salary_compatibility": + requiredBitSet[0] |= 1 << 3 + if err := func() error { + if err := s.SalaryCompatibility.Decode(d); err != nil { + return err + } + return nil + }(); err != nil { + return errors.Wrap(err, "decode field \"salary_compatibility\"") + } + default: + return errors.Errorf("unexpected field %q", k) + } + return nil + }); err != nil { + return errors.Wrap(err, "decode MatchPublicContext") + } + // Validate required fields. + var failures []validate.FieldError + for i, mask := range [1]uint8{ + 0b00001111, + } { + if result := (requiredBitSet[i] & mask) ^ mask; result != 0 { + // Mask only required fields and check equality to mask using XOR. + // + // If XOR result is not zero, result is not equal to expected, so some fields are missed. + // Bits of fields which would be set are actually bits of missed fields. + missed := bits.OnesCount8(result) + for bitN := 0; bitN < missed; bitN++ { + bitIdx := bits.TrailingZeros8(result) + fieldIdx := i*8 + bitIdx + var name string + if fieldIdx < len(jsonFieldsNameOfMatchPublicContext) { + name = jsonFieldsNameOfMatchPublicContext[fieldIdx] + } else { + name = strconv.Itoa(fieldIdx) + } + failures = append(failures, validate.FieldError{ + Name: name, + Error: validate.ErrFieldRequired, + }) + // Reset bit. + result &^= 1 << bitIdx + } + } + } + if len(failures) > 0 { + return &validate.Error{Fields: failures} + } + + return nil +} + +// MarshalJSON implements stdjson.Marshaler. +func (s *MatchPublicContext) MarshalJSON() ([]byte, error) { + e := jx.Encoder{} + s.Encode(&e) + return e.Bytes(), nil +} + +// UnmarshalJSON implements stdjson.Unmarshaler. +func (s *MatchPublicContext) UnmarshalJSON(data []byte) error { + d := jx.DecodeBytes(data) + return s.Decode(d) +} + +// Encode encodes MatchPublicStack as json. +func (s MatchPublicStack) Encode(e *jx.Encoder) { + unwrapped := []MatchSearchStackTag(s) + + if unwrapped == nil { + e.Null() + } else { + e.ArrStart() + for _, elem := range unwrapped { + elem.Encode(e) + } + e.ArrEnd() + } +} + +// Decode decodes MatchPublicStack from json. +func (s *MatchPublicStack) Decode(d *jx.Decoder) error { + if s == nil { + return errors.New("invalid: unable to decode MatchPublicStack to nil") + } + var unwrapped []MatchSearchStackTag + if err := func() error { + switch tt := d.Next(); tt { + case jx.Null: + if err := d.Skip(); err != nil { + return err + } + default: + unwrapped = make([]MatchSearchStackTag, 0) + if err := d.Arr(func(d *jx.Decoder) error { + var elem MatchSearchStackTag + if err := elem.Decode(d); err != nil { + return err + } + unwrapped = append(unwrapped, elem) + return nil + }); err != nil { + return err + } + } + return nil + }(); err != nil { + return errors.Wrap(err, "alias") + } + *s = MatchPublicStack(unwrapped) + return nil +} + +// MarshalJSON implements stdjson.Marshaler. +func (s MatchPublicStack) MarshalJSON() ([]byte, error) { + e := jx.Encoder{} + s.Encode(&e) + return e.Bytes(), nil +} + +// UnmarshalJSON implements stdjson.Unmarshaler. +func (s *MatchPublicStack) UnmarshalJSON(data []byte) error { + d := jx.DecodeBytes(data) + return s.Decode(d) +} + +// Encode encodes MatchScore as json. +func (s MatchScore) Encode(e *jx.Encoder) { + unwrapped := float64(s) + + e.Float64(unwrapped) +} + +// Decode decodes MatchScore from json. +func (s *MatchScore) Decode(d *jx.Decoder) error { + if s == nil { + return errors.New("invalid: unable to decode MatchScore to nil") + } + var unwrapped float64 + if err := func() error { + v, err := d.Float64() + unwrapped = float64(v) + if err != nil { + return err + } + return nil + }(); err != nil { + return errors.Wrap(err, "alias") + } + *s = MatchScore(unwrapped) + return nil +} + +// MarshalJSON implements stdjson.Marshaler. +func (s MatchScore) MarshalJSON() ([]byte, error) { + e := jx.Encoder{} + s.Encode(&e) + return e.Bytes(), nil +} + +// UnmarshalJSON implements stdjson.Unmarshaler. +func (s *MatchScore) UnmarshalJSON(data []byte) error { + d := jx.DecodeBytes(data) + return s.Decode(d) +} + +// Encode implements json.Marshaler. +func (s *MatchSearchBankSource) Encode(e *jx.Encoder) { + e.ObjStart() + s.encodeFields(e) + e.ObjEnd() +} + +// encodeFields encodes fields. +func (s *MatchSearchBankSource) encodeFields(e *jx.Encoder) { + { + e.FieldStart("kind") + s.Kind.Encode(e) + } + { + e.FieldStart("filters") + s.Filters.Encode(e) + } +} + +var jsonFieldsNameOfMatchSearchBankSource = [2]string{ + 0: "kind", + 1: "filters", +} + +// Decode decodes MatchSearchBankSource from json. +func (s *MatchSearchBankSource) Decode(d *jx.Decoder) error { + if s == nil { + return errors.New("invalid: unable to decode MatchSearchBankSource to nil") + } + var requiredBitSet [1]uint8 + + if err := d.ObjBytes(func(d *jx.Decoder, k []byte) error { + switch string(k) { + case "kind": + requiredBitSet[0] |= 1 << 0 + if err := func() error { + if err := s.Kind.Decode(d); err != nil { + return err + } + return nil + }(); err != nil { + return errors.Wrap(err, "decode field \"kind\"") + } + case "filters": + requiredBitSet[0] |= 1 << 1 + if err := func() error { + if err := s.Filters.Decode(d); err != nil { + return err + } + return nil + }(); err != nil { + return errors.Wrap(err, "decode field \"filters\"") + } + default: + return errors.Errorf("unexpected field %q", k) + } + return nil + }); err != nil { + return errors.Wrap(err, "decode MatchSearchBankSource") + } + // Validate required fields. + var failures []validate.FieldError + for i, mask := range [1]uint8{ + 0b00000011, + } { + if result := (requiredBitSet[i] & mask) ^ mask; result != 0 { + // Mask only required fields and check equality to mask using XOR. + // + // If XOR result is not zero, result is not equal to expected, so some fields are missed. + // Bits of fields which would be set are actually bits of missed fields. + missed := bits.OnesCount8(result) + for bitN := 0; bitN < missed; bitN++ { + bitIdx := bits.TrailingZeros8(result) + fieldIdx := i*8 + bitIdx + var name string + if fieldIdx < len(jsonFieldsNameOfMatchSearchBankSource) { + name = jsonFieldsNameOfMatchSearchBankSource[fieldIdx] + } else { + name = strconv.Itoa(fieldIdx) + } + failures = append(failures, validate.FieldError{ + Name: name, + Error: validate.ErrFieldRequired, + }) + // Reset bit. + result &^= 1 << bitIdx + } + } + } + if len(failures) > 0 { + return &validate.Error{Fields: failures} + } + + return nil +} + +// MarshalJSON implements stdjson.Marshaler. +func (s *MatchSearchBankSource) MarshalJSON() ([]byte, error) { + e := jx.Encoder{} + s.Encode(&e) + return e.Bytes(), nil +} + +// UnmarshalJSON implements stdjson.Unmarshaler. +func (s *MatchSearchBankSource) UnmarshalJSON(data []byte) error { + d := jx.DecodeBytes(data) + return s.Decode(d) +} + +// Encode encodes MatchSearchBankSourceKind as json. +func (s MatchSearchBankSourceKind) Encode(e *jx.Encoder) { + e.Str(string(s)) +} + +// Decode decodes MatchSearchBankSourceKind from json. +func (s *MatchSearchBankSourceKind) Decode(d *jx.Decoder) error { + if s == nil { + return errors.New("invalid: unable to decode MatchSearchBankSourceKind to nil") + } + v, err := d.StrBytes() + if err != nil { + return err + } + // Try to use constant string. + switch MatchSearchBankSourceKind(v) { + case MatchSearchBankSourceKindBank: + *s = MatchSearchBankSourceKindBank + default: + *s = MatchSearchBankSourceKind(v) + } + + return nil +} + +// MarshalJSON implements stdjson.Marshaler. +func (s MatchSearchBankSourceKind) MarshalJSON() ([]byte, error) { + e := jx.Encoder{} + s.Encode(&e) + return e.Bytes(), nil +} + +// UnmarshalJSON implements stdjson.Unmarshaler. +func (s *MatchSearchBankSourceKind) UnmarshalJSON(data []byte) error { + d := jx.DecodeBytes(data) + return s.Decode(d) +} + +// Encode implements json.Marshaler. +func (s *MatchSearchByBank) Encode(e *jx.Encoder) { + e.ObjStart() + s.encodeFields(e) + e.ObjEnd() +} + +// encodeFields encodes fields. +func (s *MatchSearchByBank) encodeFields(e *jx.Encoder) { + { + e.FieldStart("filters") + s.Filters.Encode(e) + } +} + +var jsonFieldsNameOfMatchSearchByBank = [1]string{ + 0: "filters", +} + +// Decode decodes MatchSearchByBank from json. +func (s *MatchSearchByBank) Decode(d *jx.Decoder) error { + if s == nil { + return errors.New("invalid: unable to decode MatchSearchByBank to nil") + } + var requiredBitSet [1]uint8 + + if err := d.ObjBytes(func(d *jx.Decoder, k []byte) error { + switch string(k) { + case "filters": + requiredBitSet[0] |= 1 << 0 + if err := func() error { + if err := s.Filters.Decode(d); err != nil { + return err + } + return nil + }(); err != nil { + return errors.Wrap(err, "decode field \"filters\"") + } + default: + return errors.Errorf("unexpected field %q", k) + } + return nil + }); err != nil { + return errors.Wrap(err, "decode MatchSearchByBank") + } + // Validate required fields. + var failures []validate.FieldError + for i, mask := range [1]uint8{ + 0b00000001, + } { + if result := (requiredBitSet[i] & mask) ^ mask; result != 0 { + // Mask only required fields and check equality to mask using XOR. + // + // If XOR result is not zero, result is not equal to expected, so some fields are missed. + // Bits of fields which would be set are actually bits of missed fields. + missed := bits.OnesCount8(result) + for bitN := 0; bitN < missed; bitN++ { + bitIdx := bits.TrailingZeros8(result) + fieldIdx := i*8 + bitIdx + var name string + if fieldIdx < len(jsonFieldsNameOfMatchSearchByBank) { + name = jsonFieldsNameOfMatchSearchByBank[fieldIdx] + } else { + name = strconv.Itoa(fieldIdx) + } + failures = append(failures, validate.FieldError{ + Name: name, + Error: validate.ErrFieldRequired, + }) + // Reset bit. + result &^= 1 << bitIdx + } + } + } + if len(failures) > 0 { + return &validate.Error{Fields: failures} + } + + return nil +} + +// MarshalJSON implements stdjson.Marshaler. +func (s *MatchSearchByBank) MarshalJSON() ([]byte, error) { + e := jx.Encoder{} + s.Encode(&e) + return e.Bytes(), nil +} + +// UnmarshalJSON implements stdjson.Unmarshaler. +func (s *MatchSearchByBank) UnmarshalJSON(data []byte) error { + d := jx.DecodeBytes(data) + return s.Decode(d) +} + +// Encode implements json.Marshaler. +func (s *MatchSearchByNeed) Encode(e *jx.Encoder) { + e.ObjStart() + s.encodeFields(e) + e.ObjEnd() +} + +// encodeFields encodes fields. +func (s *MatchSearchByNeed) encodeFields(e *jx.Encoder) { + { + e.FieldStart("need_id") + json.EncodeUUID(e, s.NeedID) + } + { + e.FieldStart("requirements_version") + s.RequirementsVersion.Encode(e) + } + { + if s.Filters.Set { + e.FieldStart("filters") + s.Filters.Encode(e) + } + } +} + +var jsonFieldsNameOfMatchSearchByNeed = [3]string{ + 0: "need_id", + 1: "requirements_version", + 2: "filters", +} + +// Decode decodes MatchSearchByNeed from json. +func (s *MatchSearchByNeed) Decode(d *jx.Decoder) error { + if s == nil { + return errors.New("invalid: unable to decode MatchSearchByNeed to nil") + } + var requiredBitSet [1]uint8 + + if err := d.ObjBytes(func(d *jx.Decoder, k []byte) error { + switch string(k) { + case "need_id": + requiredBitSet[0] |= 1 << 0 + if err := func() error { + v, err := json.DecodeUUID(d) + s.NeedID = v + if err != nil { + return err + } + return nil + }(); err != nil { + return errors.Wrap(err, "decode field \"need_id\"") + } + case "requirements_version": + requiredBitSet[0] |= 1 << 1 + if err := func() error { + if err := s.RequirementsVersion.Decode(d); err != nil { + return err + } + return nil + }(); err != nil { + return errors.Wrap(err, "decode field \"requirements_version\"") + } + case "filters": + if err := func() error { + s.Filters.Reset() + if err := s.Filters.Decode(d); err != nil { + return err + } + return nil + }(); err != nil { + return errors.Wrap(err, "decode field \"filters\"") + } + default: + return errors.Errorf("unexpected field %q", k) + } + return nil + }); err != nil { + return errors.Wrap(err, "decode MatchSearchByNeed") + } + // Validate required fields. + var failures []validate.FieldError + for i, mask := range [1]uint8{ + 0b00000011, + } { + if result := (requiredBitSet[i] & mask) ^ mask; result != 0 { + // Mask only required fields and check equality to mask using XOR. + // + // If XOR result is not zero, result is not equal to expected, so some fields are missed. + // Bits of fields which would be set are actually bits of missed fields. + missed := bits.OnesCount8(result) + for bitN := 0; bitN < missed; bitN++ { + bitIdx := bits.TrailingZeros8(result) + fieldIdx := i*8 + bitIdx + var name string + if fieldIdx < len(jsonFieldsNameOfMatchSearchByNeed) { + name = jsonFieldsNameOfMatchSearchByNeed[fieldIdx] + } else { + name = strconv.Itoa(fieldIdx) + } + failures = append(failures, validate.FieldError{ + Name: name, + Error: validate.ErrFieldRequired, + }) + // Reset bit. + result &^= 1 << bitIdx + } + } + } + if len(failures) > 0 { + return &validate.Error{Fields: failures} + } + + return nil +} + +// MarshalJSON implements stdjson.Marshaler. +func (s *MatchSearchByNeed) MarshalJSON() ([]byte, error) { + e := jx.Encoder{} + s.Encode(&e) + return e.Bytes(), nil +} + +// UnmarshalJSON implements stdjson.Unmarshaler. +func (s *MatchSearchByNeed) UnmarshalJSON(data []byte) error { + d := jx.DecodeBytes(data) + return s.Decode(d) +} + +// Encode implements json.Marshaler. +func (s *MatchSearchConditions) Encode(e *jx.Encoder) { + e.ObjStart() + s.encodeFields(e) + e.ObjEnd() +} + +// encodeFields encodes fields. +func (s *MatchSearchConditions) encodeFields(e *jx.Encoder) { + { + if s.WorkFormats != nil { + e.FieldStart("work_formats") + e.ArrStart() + for _, elem := range s.WorkFormats { + elem.Encode(e) + } + e.ArrEnd() + } + } + { + if s.SalaryCompatibility.Set { + e.FieldStart("salary_compatibility") + s.SalaryCompatibility.Encode(e) + } + } +} + +var jsonFieldsNameOfMatchSearchConditions = [2]string{ + 0: "work_formats", + 1: "salary_compatibility", +} + +// Decode decodes MatchSearchConditions from json. +func (s *MatchSearchConditions) Decode(d *jx.Decoder) error { + if s == nil { + return errors.New("invalid: unable to decode MatchSearchConditions to nil") + } + + if err := d.ObjBytes(func(d *jx.Decoder, k []byte) error { + switch string(k) { + case "work_formats": + if err := func() error { + s.WorkFormats = make([]WorkFormat, 0) + if err := d.Arr(func(d *jx.Decoder) error { + var elem WorkFormat + if err := elem.Decode(d); err != nil { + return err + } + s.WorkFormats = append(s.WorkFormats, elem) + return nil + }); err != nil { + return err + } + return nil + }(); err != nil { + return errors.Wrap(err, "decode field \"work_formats\"") + } + case "salary_compatibility": + if err := func() error { + s.SalaryCompatibility.Reset() + if err := s.SalaryCompatibility.Decode(d); err != nil { + return err + } + return nil + }(); err != nil { + return errors.Wrap(err, "decode field \"salary_compatibility\"") + } + default: + return errors.Errorf("unexpected field %q", k) + } + return nil + }); err != nil { + return errors.Wrap(err, "decode MatchSearchConditions") + } + + return nil +} + +// MarshalJSON implements stdjson.Marshaler. +func (s *MatchSearchConditions) MarshalJSON() ([]byte, error) { + e := jx.Encoder{} + s.Encode(&e) + return e.Bytes(), nil +} + +// UnmarshalJSON implements stdjson.Unmarshaler. +func (s *MatchSearchConditions) UnmarshalJSON(data []byte) error { + d := jx.DecodeBytes(data) + return s.Decode(d) +} + +// Encode implements json.Marshaler. +func (s *MatchSearchFilters) Encode(e *jx.Encoder) { + e.ObjStart() + s.encodeFields(e) + e.ObjEnd() +} + +// encodeFields encodes fields. +func (s *MatchSearchFilters) encodeFields(e *jx.Encoder) { + { + if s.Specialization.Set { + e.FieldStart("specialization") + s.Specialization.Encode(e) + } + } + { + if s.ConfirmedGrade.Set { + e.FieldStart("confirmed_grade") + s.ConfirmedGrade.Encode(e) + } + } + { + if s.ConfirmedCategory.Set { + e.FieldStart("confirmed_category") + s.ConfirmedCategory.Encode(e) + } + } + { + if s.ConfirmationStatus.Set { + e.FieldStart("confirmation_status") + s.ConfirmationStatus.Encode(e) + } + } + { + if s.DeclaredGrade.Set { + e.FieldStart("declared_grade") + s.DeclaredGrade.Encode(e) + } + } + { + if s.Stack != nil { + e.FieldStart("stack") + e.ArrStart() + for _, elem := range s.Stack { + elem.Encode(e) + } + e.ArrEnd() + } + } + { + if s.Conditions.Set { + e.FieldStart("conditions") + s.Conditions.Encode(e) + } + } +} + +var jsonFieldsNameOfMatchSearchFilters = [7]string{ + 0: "specialization", + 1: "confirmed_grade", + 2: "confirmed_category", + 3: "confirmation_status", + 4: "declared_grade", + 5: "stack", + 6: "conditions", +} + +// Decode decodes MatchSearchFilters from json. +func (s *MatchSearchFilters) Decode(d *jx.Decoder) error { + if s == nil { + return errors.New("invalid: unable to decode MatchSearchFilters to nil") + } + + if err := d.ObjBytes(func(d *jx.Decoder, k []byte) error { + switch string(k) { + case "specialization": + if err := func() error { + s.Specialization.Reset() + if err := s.Specialization.Decode(d); err != nil { + return err + } + return nil + }(); err != nil { + return errors.Wrap(err, "decode field \"specialization\"") + } + case "confirmed_grade": + if err := func() error { + s.ConfirmedGrade.Reset() + if err := s.ConfirmedGrade.Decode(d); err != nil { + return err + } + return nil + }(); err != nil { + return errors.Wrap(err, "decode field \"confirmed_grade\"") + } + case "confirmed_category": + if err := func() error { + s.ConfirmedCategory.Reset() + if err := s.ConfirmedCategory.Decode(d); err != nil { + return err + } + return nil + }(); err != nil { + return errors.Wrap(err, "decode field \"confirmed_category\"") + } + case "confirmation_status": + if err := func() error { + s.ConfirmationStatus.Reset() + if err := s.ConfirmationStatus.Decode(d); err != nil { + return err + } + return nil + }(); err != nil { + return errors.Wrap(err, "decode field \"confirmation_status\"") + } + case "declared_grade": + if err := func() error { + s.DeclaredGrade.Reset() + if err := s.DeclaredGrade.Decode(d); err != nil { + return err + } + return nil + }(); err != nil { + return errors.Wrap(err, "decode field \"declared_grade\"") + } + case "stack": + if err := func() error { + s.Stack = make([]MatchSearchStackTag, 0) + if err := d.Arr(func(d *jx.Decoder) error { + var elem MatchSearchStackTag + if err := elem.Decode(d); err != nil { + return err + } + s.Stack = append(s.Stack, elem) + return nil + }); err != nil { + return err + } + return nil + }(); err != nil { + return errors.Wrap(err, "decode field \"stack\"") + } + case "conditions": + if err := func() error { + s.Conditions.Reset() + if err := s.Conditions.Decode(d); err != nil { + return err + } + return nil + }(); err != nil { + return errors.Wrap(err, "decode field \"conditions\"") + } + default: + return errors.Errorf("unexpected field %q", k) + } + return nil + }); err != nil { + return errors.Wrap(err, "decode MatchSearchFilters") + } + + return nil +} + +// MarshalJSON implements stdjson.Marshaler. +func (s *MatchSearchFilters) MarshalJSON() ([]byte, error) { + e := jx.Encoder{} + s.Encode(&e) + return e.Bytes(), nil +} + +// UnmarshalJSON implements stdjson.Unmarshaler. +func (s *MatchSearchFilters) UnmarshalJSON(data []byte) error { + d := jx.DecodeBytes(data) + return s.Decode(d) +} + +// Encode implements json.Marshaler. +func (s *MatchSearchGroups) Encode(e *jx.Encoder) { + e.ObjStart() + s.encodeFields(e) + e.ObjEnd() +} + +// encodeFields encodes fields. +func (s *MatchSearchGroups) encodeFields(e *jx.Encoder) { + { + e.FieldStart("main") + e.ArrStart() + for _, elem := range s.Main { + elem.Encode(e) + } + e.ArrEnd() + } + { + e.FieldStart("near") + e.ArrStart() + for _, elem := range s.Near { + elem.Encode(e) + } + e.ArrEnd() + } + { + e.FieldStart("unconfirmed") + e.ArrStart() + for _, elem := range s.Unconfirmed { + elem.Encode(e) + } + e.ArrEnd() + } +} + +var jsonFieldsNameOfMatchSearchGroups = [3]string{ + 0: "main", + 1: "near", + 2: "unconfirmed", +} + +// Decode decodes MatchSearchGroups from json. +func (s *MatchSearchGroups) Decode(d *jx.Decoder) error { + if s == nil { + return errors.New("invalid: unable to decode MatchSearchGroups to nil") + } + var requiredBitSet [1]uint8 + + if err := d.ObjBytes(func(d *jx.Decoder, k []byte) error { + switch string(k) { + case "main": + requiredBitSet[0] |= 1 << 0 + if err := func() error { + s.Main = make([]MatchConfirmedCandidate, 0) + if err := d.Arr(func(d *jx.Decoder) error { + var elem MatchConfirmedCandidate + if err := elem.Decode(d); err != nil { + return err + } + s.Main = append(s.Main, elem) + return nil + }); err != nil { + return err + } + return nil + }(); err != nil { + return errors.Wrap(err, "decode field \"main\"") + } + case "near": + requiredBitSet[0] |= 1 << 1 + if err := func() error { + s.Near = make([]MatchConfirmedCandidate, 0) + if err := d.Arr(func(d *jx.Decoder) error { + var elem MatchConfirmedCandidate + if err := elem.Decode(d); err != nil { + return err + } + s.Near = append(s.Near, elem) + return nil + }); err != nil { + return err + } + return nil + }(); err != nil { + return errors.Wrap(err, "decode field \"near\"") + } + case "unconfirmed": + requiredBitSet[0] |= 1 << 2 + if err := func() error { + s.Unconfirmed = make([]MatchUnconfirmedCandidate, 0) + if err := d.Arr(func(d *jx.Decoder) error { + var elem MatchUnconfirmedCandidate + if err := elem.Decode(d); err != nil { + return err + } + s.Unconfirmed = append(s.Unconfirmed, elem) + return nil + }); err != nil { + return err + } + return nil + }(); err != nil { + return errors.Wrap(err, "decode field \"unconfirmed\"") + } + default: + return errors.Errorf("unexpected field %q", k) + } + return nil + }); err != nil { + return errors.Wrap(err, "decode MatchSearchGroups") + } + // Validate required fields. + var failures []validate.FieldError + for i, mask := range [1]uint8{ + 0b00000111, + } { + if result := (requiredBitSet[i] & mask) ^ mask; result != 0 { + // Mask only required fields and check equality to mask using XOR. + // + // If XOR result is not zero, result is not equal to expected, so some fields are missed. + // Bits of fields which would be set are actually bits of missed fields. + missed := bits.OnesCount8(result) + for bitN := 0; bitN < missed; bitN++ { + bitIdx := bits.TrailingZeros8(result) + fieldIdx := i*8 + bitIdx + var name string + if fieldIdx < len(jsonFieldsNameOfMatchSearchGroups) { + name = jsonFieldsNameOfMatchSearchGroups[fieldIdx] + } else { + name = strconv.Itoa(fieldIdx) + } + failures = append(failures, validate.FieldError{ + Name: name, + Error: validate.ErrFieldRequired, + }) + // Reset bit. + result &^= 1 << bitIdx + } + } + } + if len(failures) > 0 { + return &validate.Error{Fields: failures} + } + + return nil +} + +// MarshalJSON implements stdjson.Marshaler. +func (s *MatchSearchGroups) MarshalJSON() ([]byte, error) { + e := jx.Encoder{} + s.Encode(&e) + return e.Bytes(), nil +} + +// UnmarshalJSON implements stdjson.Unmarshaler. +func (s *MatchSearchGroups) UnmarshalJSON(data []byte) error { + d := jx.DecodeBytes(data) + return s.Decode(d) +} + +// Encode implements json.Marshaler. +func (s *MatchSearchNeedSource) Encode(e *jx.Encoder) { + e.ObjStart() + s.encodeFields(e) + e.ObjEnd() +} + +// encodeFields encodes fields. +func (s *MatchSearchNeedSource) encodeFields(e *jx.Encoder) { + { + e.FieldStart("kind") + s.Kind.Encode(e) + } + { + e.FieldStart("need_id") + json.EncodeUUID(e, s.NeedID) + } + { + e.FieldStart("requirements_version") + s.RequirementsVersion.Encode(e) + } +} + +var jsonFieldsNameOfMatchSearchNeedSource = [3]string{ + 0: "kind", + 1: "need_id", + 2: "requirements_version", +} + +// Decode decodes MatchSearchNeedSource from json. +func (s *MatchSearchNeedSource) Decode(d *jx.Decoder) error { + if s == nil { + return errors.New("invalid: unable to decode MatchSearchNeedSource to nil") + } + var requiredBitSet [1]uint8 + + if err := d.ObjBytes(func(d *jx.Decoder, k []byte) error { + switch string(k) { + case "kind": + requiredBitSet[0] |= 1 << 0 + if err := func() error { + if err := s.Kind.Decode(d); err != nil { + return err + } + return nil + }(); err != nil { + return errors.Wrap(err, "decode field \"kind\"") + } + case "need_id": + requiredBitSet[0] |= 1 << 1 + if err := func() error { + v, err := json.DecodeUUID(d) + s.NeedID = v + if err != nil { + return err + } + return nil + }(); err != nil { + return errors.Wrap(err, "decode field \"need_id\"") + } + case "requirements_version": + requiredBitSet[0] |= 1 << 2 + if err := func() error { + if err := s.RequirementsVersion.Decode(d); err != nil { + return err + } + return nil + }(); err != nil { + return errors.Wrap(err, "decode field \"requirements_version\"") + } + default: + return errors.Errorf("unexpected field %q", k) + } + return nil + }); err != nil { + return errors.Wrap(err, "decode MatchSearchNeedSource") + } + // Validate required fields. + var failures []validate.FieldError + for i, mask := range [1]uint8{ + 0b00000111, + } { + if result := (requiredBitSet[i] & mask) ^ mask; result != 0 { + // Mask only required fields and check equality to mask using XOR. + // + // If XOR result is not zero, result is not equal to expected, so some fields are missed. + // Bits of fields which would be set are actually bits of missed fields. + missed := bits.OnesCount8(result) + for bitN := 0; bitN < missed; bitN++ { + bitIdx := bits.TrailingZeros8(result) + fieldIdx := i*8 + bitIdx + var name string + if fieldIdx < len(jsonFieldsNameOfMatchSearchNeedSource) { + name = jsonFieldsNameOfMatchSearchNeedSource[fieldIdx] + } else { + name = strconv.Itoa(fieldIdx) + } + failures = append(failures, validate.FieldError{ + Name: name, + Error: validate.ErrFieldRequired, + }) + // Reset bit. + result &^= 1 << bitIdx + } + } + } + if len(failures) > 0 { + return &validate.Error{Fields: failures} + } + + return nil +} + +// MarshalJSON implements stdjson.Marshaler. +func (s *MatchSearchNeedSource) MarshalJSON() ([]byte, error) { + e := jx.Encoder{} + s.Encode(&e) + return e.Bytes(), nil +} + +// UnmarshalJSON implements stdjson.Unmarshaler. +func (s *MatchSearchNeedSource) UnmarshalJSON(data []byte) error { + d := jx.DecodeBytes(data) + return s.Decode(d) +} + +// Encode encodes MatchSearchNeedSourceKind as json. +func (s MatchSearchNeedSourceKind) Encode(e *jx.Encoder) { + e.Str(string(s)) +} + +// Decode decodes MatchSearchNeedSourceKind from json. +func (s *MatchSearchNeedSourceKind) Decode(d *jx.Decoder) error { + if s == nil { + return errors.New("invalid: unable to decode MatchSearchNeedSourceKind to nil") + } + v, err := d.StrBytes() + if err != nil { + return err + } + // Try to use constant string. + switch MatchSearchNeedSourceKind(v) { + case MatchSearchNeedSourceKindNeed: + *s = MatchSearchNeedSourceKindNeed + default: + *s = MatchSearchNeedSourceKind(v) + } + + return nil +} + +// MarshalJSON implements stdjson.Marshaler. +func (s MatchSearchNeedSourceKind) MarshalJSON() ([]byte, error) { + e := jx.Encoder{} + s.Encode(&e) + return e.Bytes(), nil +} + +// UnmarshalJSON implements stdjson.Unmarshaler. +func (s *MatchSearchNeedSourceKind) UnmarshalJSON(data []byte) error { + d := jx.DecodeBytes(data) + return s.Decode(d) +} + +// Encode encodes MatchSearchRequest as json. +func (s MatchSearchRequest) Encode(e *jx.Encoder) { + switch s.Type { + case MatchSearchByNeedMatchSearchRequest: + s.MatchSearchByNeed.Encode(e) + case MatchSearchByBankMatchSearchRequest: + s.MatchSearchByBank.Encode(e) + } +} + +func (s MatchSearchRequest) encodeFields(e *jx.Encoder) { + switch s.Type { + case MatchSearchByNeedMatchSearchRequest: + s.MatchSearchByNeed.encodeFields(e) + case MatchSearchByBankMatchSearchRequest: + s.MatchSearchByBank.encodeFields(e) + } +} + +// Decode decodes MatchSearchRequest from json. +func (s *MatchSearchRequest) Decode(d *jx.Decoder) error { + if s == nil { + return errors.New("invalid: unable to decode MatchSearchRequest to nil") + } + // Sum type fields. + if typ := d.Next(); typ != jx.Object { + return errors.Errorf("unexpected json type %q", typ) + } + + var found bool + if err := d.Capture(func(d *jx.Decoder) error { + return d.ObjBytes(func(d *jx.Decoder, key []byte) error { + switch string(key) { + case "need_id": + match := MatchSearchByNeedMatchSearchRequest + if found && s.Type != match { + s.Type = "" + return errors.Errorf("multiple oneOf matches: (%v, %v)", s.Type, match) + } + found = true + s.Type = match + case "requirements_version": + // Type-based discrimination: check if field has expected JSON type + if typ := d.Next(); typ != jx.Number { + // Field exists but has wrong type, not a match for this variant + return d.Skip() + } + match := MatchSearchByNeedMatchSearchRequest + if found && s.Type != match { + s.Type = "" + return errors.Errorf("multiple oneOf matches: (%v, %v)", s.Type, match) + } + found = true + s.Type = match + } + return d.Skip() + }) + }); err != nil { + return errors.Wrap(err, "capture") + } + if !found { + s.Type = MatchSearchByBankMatchSearchRequest + } + switch s.Type { + case MatchSearchByNeedMatchSearchRequest: + if err := s.MatchSearchByNeed.Decode(d); err != nil { + return err + } + case MatchSearchByBankMatchSearchRequest: + if err := s.MatchSearchByBank.Decode(d); err != nil { + return err + } + default: + return errors.Errorf("inferred invalid type: %s", s.Type) + } + return nil +} + +// MarshalJSON implements stdjson.Marshaler. +func (s MatchSearchRequest) MarshalJSON() ([]byte, error) { + e := jx.Encoder{} + s.Encode(&e) + return e.Bytes(), nil +} + +// UnmarshalJSON implements stdjson.Unmarshaler. +func (s *MatchSearchRequest) UnmarshalJSON(data []byte) error { + d := jx.DecodeBytes(data) + return s.Decode(d) +} + +// Encode implements json.Marshaler. +func (s *MatchSearchResponse) Encode(e *jx.Encoder) { + e.ObjStart() + s.encodeFields(e) + e.ObjEnd() +} + +// encodeFields encodes fields. +func (s *MatchSearchResponse) encodeFields(e *jx.Encoder) { + { + e.FieldStart("source") + s.Source.Encode(e) + } + { + e.FieldStart("groups") + s.Groups.Encode(e) + } +} + +var jsonFieldsNameOfMatchSearchResponse = [2]string{ + 0: "source", + 1: "groups", +} + +// Decode decodes MatchSearchResponse from json. +func (s *MatchSearchResponse) Decode(d *jx.Decoder) error { + if s == nil { + return errors.New("invalid: unable to decode MatchSearchResponse to nil") + } + var requiredBitSet [1]uint8 + + if err := d.ObjBytes(func(d *jx.Decoder, k []byte) error { + switch string(k) { + case "source": + requiredBitSet[0] |= 1 << 0 + if err := func() error { + if err := s.Source.Decode(d); err != nil { + return err + } + return nil + }(); err != nil { + return errors.Wrap(err, "decode field \"source\"") + } + case "groups": + requiredBitSet[0] |= 1 << 1 + if err := func() error { + if err := s.Groups.Decode(d); err != nil { + return err + } + return nil + }(); err != nil { + return errors.Wrap(err, "decode field \"groups\"") + } + default: + return errors.Errorf("unexpected field %q", k) + } + return nil + }); err != nil { + return errors.Wrap(err, "decode MatchSearchResponse") + } + // Validate required fields. + var failures []validate.FieldError + for i, mask := range [1]uint8{ + 0b00000011, + } { + if result := (requiredBitSet[i] & mask) ^ mask; result != 0 { + // Mask only required fields and check equality to mask using XOR. + // + // If XOR result is not zero, result is not equal to expected, so some fields are missed. + // Bits of fields which would be set are actually bits of missed fields. + missed := bits.OnesCount8(result) + for bitN := 0; bitN < missed; bitN++ { + bitIdx := bits.TrailingZeros8(result) + fieldIdx := i*8 + bitIdx + var name string + if fieldIdx < len(jsonFieldsNameOfMatchSearchResponse) { + name = jsonFieldsNameOfMatchSearchResponse[fieldIdx] + } else { + name = strconv.Itoa(fieldIdx) + } + failures = append(failures, validate.FieldError{ + Name: name, + Error: validate.ErrFieldRequired, + }) + // Reset bit. + result &^= 1 << bitIdx + } + } + } + if len(failures) > 0 { + return &validate.Error{Fields: failures} + } + + return nil +} + +// MarshalJSON implements stdjson.Marshaler. +func (s *MatchSearchResponse) MarshalJSON() ([]byte, error) { + e := jx.Encoder{} + s.Encode(&e) + return e.Bytes(), nil +} + +// UnmarshalJSON implements stdjson.Unmarshaler. +func (s *MatchSearchResponse) UnmarshalJSON(data []byte) error { + d := jx.DecodeBytes(data) + return s.Decode(d) +} + +// Encode encodes MatchSearchSource as json. +func (s MatchSearchSource) Encode(e *jx.Encoder) { + switch s.Type { + case MatchSearchNeedSourceMatchSearchSource: + s.MatchSearchNeedSource.Encode(e) + case MatchSearchBankSourceMatchSearchSource: + s.MatchSearchBankSource.Encode(e) + } +} + +func (s MatchSearchSource) encodeFields(e *jx.Encoder) { + switch s.Type { + case MatchSearchNeedSourceMatchSearchSource: + s.MatchSearchNeedSource.encodeFields(e) + case MatchSearchBankSourceMatchSearchSource: + s.MatchSearchBankSource.encodeFields(e) + } +} + +// Decode decodes MatchSearchSource from json. +func (s *MatchSearchSource) Decode(d *jx.Decoder) error { + if s == nil { + return errors.New("invalid: unable to decode MatchSearchSource to nil") + } + // Sum type fields. + if typ := d.Next(); typ != jx.Object { + return errors.Errorf("unexpected json type %q", typ) + } + + var found bool + if err := d.Capture(func(d *jx.Decoder) error { + return d.ObjBytes(func(d *jx.Decoder, key []byte) error { + switch string(key) { + case "filters": + // Type-based discrimination: check if field has expected JSON type + if typ := d.Next(); typ != jx.Object { + // Field exists but has wrong type, not a match for this variant + return d.Skip() + } + match := MatchSearchBankSourceMatchSearchSource + if found && s.Type != match { + s.Type = "" + return errors.Errorf("multiple oneOf matches: (%v, %v)", s.Type, match) + } + found = true + s.Type = match + case "need_id": + match := MatchSearchNeedSourceMatchSearchSource + if found && s.Type != match { + s.Type = "" + return errors.Errorf("multiple oneOf matches: (%v, %v)", s.Type, match) + } + found = true + s.Type = match + case "requirements_version": + // Type-based discrimination: check if field has expected JSON type + if typ := d.Next(); typ != jx.Number { + // Field exists but has wrong type, not a match for this variant + return d.Skip() + } + match := MatchSearchNeedSourceMatchSearchSource + if found && s.Type != match { + s.Type = "" + return errors.Errorf("multiple oneOf matches: (%v, %v)", s.Type, match) + } + found = true + s.Type = match + case "kind": + // Value-based discrimination: check enum value + if typ := d.Next(); typ != jx.String { + return d.Skip() + } + value, err := d.StrBytes() + if err != nil { + return err + } + switch string(value) { + case "bank": + match := MatchSearchBankSourceMatchSearchSource + if found && s.Type != match { + s.Type = "" + return errors.Errorf("multiple oneOf matches: (%v, %v)", s.Type, match) + } + found = true + s.Type = match + case "need": + match := MatchSearchNeedSourceMatchSearchSource + if found && s.Type != match { + s.Type = "" + return errors.Errorf("multiple oneOf matches: (%v, %v)", s.Type, match) + } + found = true + s.Type = match + default: + // Unknown enum value, ignore and continue + } + return nil + } + return d.Skip() + }) + }); err != nil { + return errors.Wrap(err, "capture") + } + if !found { + return errors.New("unable to detect sum type variant") + } + switch s.Type { + case MatchSearchNeedSourceMatchSearchSource: + if err := s.MatchSearchNeedSource.Decode(d); err != nil { + return err + } + case MatchSearchBankSourceMatchSearchSource: + if err := s.MatchSearchBankSource.Decode(d); err != nil { + return err + } + default: + return errors.Errorf("inferred invalid type: %s", s.Type) + } + return nil +} + +// MarshalJSON implements stdjson.Marshaler. +func (s MatchSearchSource) MarshalJSON() ([]byte, error) { + e := jx.Encoder{} + s.Encode(&e) + return e.Bytes(), nil +} + +// UnmarshalJSON implements stdjson.Unmarshaler. +func (s *MatchSearchSource) UnmarshalJSON(data []byte) error { + d := jx.DecodeBytes(data) + return s.Decode(d) +} + +// Encode encodes MatchSearchStackTag as json. +func (s MatchSearchStackTag) Encode(e *jx.Encoder) { + e.Str(string(s)) +} + +// Decode decodes MatchSearchStackTag from json. +func (s *MatchSearchStackTag) Decode(d *jx.Decoder) error { + if s == nil { + return errors.New("invalid: unable to decode MatchSearchStackTag to nil") + } + v, err := d.StrBytes() + if err != nil { + return err + } + // Try to use constant string. + switch MatchSearchStackTag(v) { + case MatchSearchStackTagGo: + *s = MatchSearchStackTagGo + case MatchSearchStackTagPostgresql: + *s = MatchSearchStackTagPostgresql + case MatchSearchStackTagKafka: + *s = MatchSearchStackTagKafka + case MatchSearchStackTagDocker: + *s = MatchSearchStackTagDocker + default: + *s = MatchSearchStackTag(v) + } + + return nil +} + +// MarshalJSON implements stdjson.Marshaler. +func (s MatchSearchStackTag) MarshalJSON() ([]byte, error) { + e := jx.Encoder{} + s.Encode(&e) + return e.Bytes(), nil +} + +// UnmarshalJSON implements stdjson.Unmarshaler. +func (s *MatchSearchStackTag) UnmarshalJSON(data []byte) error { + d := jx.DecodeBytes(data) + return s.Decode(d) +} + +// Encode encodes MatchStrength as json. +func (s MatchStrength) Encode(e *jx.Encoder) { + e.Str(string(s)) +} + +// Decode decodes MatchStrength from json. +func (s *MatchStrength) Decode(d *jx.Decoder) error { + if s == nil { + return errors.New("invalid: unable to decode MatchStrength to nil") + } + v, err := d.StrBytes() + if err != nil { + return err + } + // Try to use constant string. + switch MatchStrength(v) { + case MatchStrengthStandard: + *s = MatchStrengthStandard + case MatchStrengthStrong: + *s = MatchStrengthStrong + default: + *s = MatchStrength(v) + } + + return nil +} + +// MarshalJSON implements stdjson.Marshaler. +func (s MatchStrength) MarshalJSON() ([]byte, error) { + e := jx.Encoder{} + s.Encode(&e) + return e.Bytes(), nil +} + +// UnmarshalJSON implements stdjson.Unmarshaler. +func (s *MatchStrength) UnmarshalJSON(data []byte) error { + d := jx.DecodeBytes(data) + return s.Decode(d) +} + +// Encode implements json.Marshaler. +func (s *MatchUnconfirmedCandidate) Encode(e *jx.Encoder) { + e.ObjStart() + s.encodeFields(e) + e.ObjEnd() +} + +// encodeFields encodes fields. +func (s *MatchUnconfirmedCandidate) encodeFields(e *jx.Encoder) { + { + e.FieldStart("candidate_handle") + s.CandidateHandle.Encode(e) + } + { + e.FieldStart("specialization") + s.Specialization.Encode(e) + } + { + e.FieldStart("confirmation_status") + s.ConfirmationStatus.Encode(e) + } + { + e.FieldStart("declared_grade") + s.DeclaredGrade.Encode(e) + } + { + _ = s.Category + e.FieldStart("category") + e.Null() + } + { + _ = s.Strength + e.FieldStart("strength") + e.Null() + } + { + e.FieldStart("public_context") + s.PublicContext.Encode(e) + } + { + e.FieldStart("evidence_summary") + s.EvidenceSummary.Encode(e) + } + { + e.FieldStart("components") + s.Components.Encode(e) + } + { + e.FieldStart("unknown_flags") + s.UnknownFlags.Encode(e) + } +} + +var jsonFieldsNameOfMatchUnconfirmedCandidate = [10]string{ + 0: "candidate_handle", + 1: "specialization", + 2: "confirmation_status", + 3: "declared_grade", + 4: "category", + 5: "strength", + 6: "public_context", + 7: "evidence_summary", + 8: "components", + 9: "unknown_flags", +} + +// Decode decodes MatchUnconfirmedCandidate from json. +func (s *MatchUnconfirmedCandidate) Decode(d *jx.Decoder) error { + if s == nil { + return errors.New("invalid: unable to decode MatchUnconfirmedCandidate to nil") + } + var requiredBitSet [2]uint8 + + if err := d.ObjBytes(func(d *jx.Decoder, k []byte) error { + switch string(k) { + case "candidate_handle": + requiredBitSet[0] |= 1 << 0 + if err := func() error { + if err := s.CandidateHandle.Decode(d); err != nil { + return err + } + return nil + }(); err != nil { + return errors.Wrap(err, "decode field \"candidate_handle\"") + } + case "specialization": + requiredBitSet[0] |= 1 << 1 + if err := func() error { + if err := s.Specialization.Decode(d); err != nil { + return err + } + return nil + }(); err != nil { + return errors.Wrap(err, "decode field \"specialization\"") + } + case "confirmation_status": + requiredBitSet[0] |= 1 << 2 + if err := func() error { + if err := s.ConfirmationStatus.Decode(d); err != nil { + return err + } + return nil + }(); err != nil { + return errors.Wrap(err, "decode field \"confirmation_status\"") + } + case "declared_grade": + requiredBitSet[0] |= 1 << 3 + if err := func() error { + if err := s.DeclaredGrade.Decode(d); err != nil { + return err + } + return nil + }(); err != nil { + return errors.Wrap(err, "decode field \"declared_grade\"") + } + case "category": + requiredBitSet[0] |= 1 << 4 + if err := func() error { + if err := d.Null(); err != nil { + return err + } + return nil + }(); err != nil { + return errors.Wrap(err, "decode field \"category\"") + } + case "strength": + requiredBitSet[0] |= 1 << 5 + if err := func() error { + if err := d.Null(); err != nil { + return err + } + return nil + }(); err != nil { + return errors.Wrap(err, "decode field \"strength\"") + } + case "public_context": + requiredBitSet[0] |= 1 << 6 + if err := func() error { + if err := s.PublicContext.Decode(d); err != nil { + return err + } + return nil + }(); err != nil { + return errors.Wrap(err, "decode field \"public_context\"") + } + case "evidence_summary": + requiredBitSet[0] |= 1 << 7 + if err := func() error { + if err := s.EvidenceSummary.Decode(d); err != nil { + return err + } + return nil + }(); err != nil { + return errors.Wrap(err, "decode field \"evidence_summary\"") + } + case "components": + requiredBitSet[1] |= 1 << 0 + if err := func() error { + if err := s.Components.Decode(d); err != nil { + return err + } + return nil + }(); err != nil { + return errors.Wrap(err, "decode field \"components\"") + } + case "unknown_flags": + requiredBitSet[1] |= 1 << 1 + if err := func() error { + if err := s.UnknownFlags.Decode(d); err != nil { + return err + } + return nil + }(); err != nil { + return errors.Wrap(err, "decode field \"unknown_flags\"") + } + default: + return errors.Errorf("unexpected field %q", k) + } + return nil + }); err != nil { + return errors.Wrap(err, "decode MatchUnconfirmedCandidate") + } + // Validate required fields. + var failures []validate.FieldError + for i, mask := range [2]uint8{ + 0b11111111, + 0b00000011, + } { + if result := (requiredBitSet[i] & mask) ^ mask; result != 0 { + // Mask only required fields and check equality to mask using XOR. + // + // If XOR result is not zero, result is not equal to expected, so some fields are missed. + // Bits of fields which would be set are actually bits of missed fields. + missed := bits.OnesCount8(result) + for bitN := 0; bitN < missed; bitN++ { + bitIdx := bits.TrailingZeros8(result) + fieldIdx := i*8 + bitIdx + var name string + if fieldIdx < len(jsonFieldsNameOfMatchUnconfirmedCandidate) { + name = jsonFieldsNameOfMatchUnconfirmedCandidate[fieldIdx] + } else { + name = strconv.Itoa(fieldIdx) + } + failures = append(failures, validate.FieldError{ + Name: name, + Error: validate.ErrFieldRequired, + }) + // Reset bit. + result &^= 1 << bitIdx + } + } + } + if len(failures) > 0 { + return &validate.Error{Fields: failures} + } + + return nil +} + +// MarshalJSON implements stdjson.Marshaler. +func (s *MatchUnconfirmedCandidate) MarshalJSON() ([]byte, error) { + e := jx.Encoder{} + s.Encode(&e) + return e.Bytes(), nil +} + +// UnmarshalJSON implements stdjson.Unmarshaler. +func (s *MatchUnconfirmedCandidate) UnmarshalJSON(data []byte) error { + d := jx.DecodeBytes(data) + return s.Decode(d) +} + +// Encode encodes MatchUnconfirmedCandidateConfirmationStatus as json. +func (s MatchUnconfirmedCandidateConfirmationStatus) Encode(e *jx.Encoder) { + e.Str(string(s)) +} + +// Decode decodes MatchUnconfirmedCandidateConfirmationStatus from json. +func (s *MatchUnconfirmedCandidateConfirmationStatus) Decode(d *jx.Decoder) error { + if s == nil { + return errors.New("invalid: unable to decode MatchUnconfirmedCandidateConfirmationStatus to nil") + } + v, err := d.StrBytes() + if err != nil { + return err + } + // Try to use constant string. + switch MatchUnconfirmedCandidateConfirmationStatus(v) { + case MatchUnconfirmedCandidateConfirmationStatusUnconfirmed: + *s = MatchUnconfirmedCandidateConfirmationStatusUnconfirmed + default: + *s = MatchUnconfirmedCandidateConfirmationStatus(v) + } + + return nil +} + +// MarshalJSON implements stdjson.Marshaler. +func (s MatchUnconfirmedCandidateConfirmationStatus) MarshalJSON() ([]byte, error) { + e := jx.Encoder{} + s.Encode(&e) + return e.Bytes(), nil +} + +// UnmarshalJSON implements stdjson.Unmarshaler. +func (s *MatchUnconfirmedCandidateConfirmationStatus) UnmarshalJSON(data []byte) error { + d := jx.DecodeBytes(data) + return s.Decode(d) +} + +// Encode implements json.Marshaler. +func (s *MatchUnconfirmedComponents) Encode(e *jx.Encoder) { + e.ObjStart() + s.encodeFields(e) + e.ObjEnd() +} + +// encodeFields encodes fields. +func (s *MatchUnconfirmedComponents) encodeFields(e *jx.Encoder) { + { + e.FieldStart("fit") + e.Float64(s.Fit) + } + { + e.FieldStart("coverage") + e.Float64(s.Coverage) + } +} + +var jsonFieldsNameOfMatchUnconfirmedComponents = [2]string{ + 0: "fit", + 1: "coverage", +} + +// Decode decodes MatchUnconfirmedComponents from json. +func (s *MatchUnconfirmedComponents) Decode(d *jx.Decoder) error { + if s == nil { + return errors.New("invalid: unable to decode MatchUnconfirmedComponents to nil") + } + var requiredBitSet [1]uint8 + + if err := d.ObjBytes(func(d *jx.Decoder, k []byte) error { + switch string(k) { + case "fit": + requiredBitSet[0] |= 1 << 0 + if err := func() error { + v, err := d.Float64() + s.Fit = float64(v) + if err != nil { + return err + } + return nil + }(); err != nil { + return errors.Wrap(err, "decode field \"fit\"") + } + case "coverage": + requiredBitSet[0] |= 1 << 1 + if err := func() error { + v, err := d.Float64() + s.Coverage = float64(v) + if err != nil { + return err + } + return nil + }(); err != nil { + return errors.Wrap(err, "decode field \"coverage\"") + } + default: + return errors.Errorf("unexpected field %q", k) + } + return nil + }); err != nil { + return errors.Wrap(err, "decode MatchUnconfirmedComponents") + } + // Validate required fields. + var failures []validate.FieldError + for i, mask := range [1]uint8{ + 0b00000011, + } { + if result := (requiredBitSet[i] & mask) ^ mask; result != 0 { + // Mask only required fields and check equality to mask using XOR. + // + // If XOR result is not zero, result is not equal to expected, so some fields are missed. + // Bits of fields which would be set are actually bits of missed fields. + missed := bits.OnesCount8(result) + for bitN := 0; bitN < missed; bitN++ { + bitIdx := bits.TrailingZeros8(result) + fieldIdx := i*8 + bitIdx + var name string + if fieldIdx < len(jsonFieldsNameOfMatchUnconfirmedComponents) { + name = jsonFieldsNameOfMatchUnconfirmedComponents[fieldIdx] + } else { + name = strconv.Itoa(fieldIdx) + } + failures = append(failures, validate.FieldError{ + Name: name, + Error: validate.ErrFieldRequired, + }) + // Reset bit. + result &^= 1 << bitIdx + } + } + } + if len(failures) > 0 { + return &validate.Error{Fields: failures} + } + + return nil +} + +// MarshalJSON implements stdjson.Marshaler. +func (s *MatchUnconfirmedComponents) MarshalJSON() ([]byte, error) { + e := jx.Encoder{} + s.Encode(&e) + return e.Bytes(), nil +} + +// UnmarshalJSON implements stdjson.Unmarshaler. +func (s *MatchUnconfirmedComponents) UnmarshalJSON(data []byte) error { + d := jx.DecodeBytes(data) + return s.Decode(d) +} + +// Encode encodes MatchUnknownComponent as json. +func (s MatchUnknownComponent) Encode(e *jx.Encoder) { + e.Str(string(s)) +} + +// Decode decodes MatchUnknownComponent from json. +func (s *MatchUnknownComponent) Decode(d *jx.Decoder) error { + if s == nil { + return errors.New("invalid: unable to decode MatchUnknownComponent to nil") + } + v, err := d.StrBytes() + if err != nil { + return err + } + // Try to use constant string. + switch MatchUnknownComponent(v) { + case MatchUnknownComponentSemantics: + *s = MatchUnknownComponentSemantics + case MatchUnknownComponentPercentile: + *s = MatchUnknownComponentPercentile + case MatchUnknownComponentAssessment: + *s = MatchUnknownComponentAssessment + case MatchUnknownComponentFreshness: + *s = MatchUnknownComponentFreshness + case MatchUnknownComponentResponsiveness: + *s = MatchUnknownComponentResponsiveness + case MatchUnknownComponentExperienceBand: + *s = MatchUnknownComponentExperienceBand + case MatchUnknownComponentWorkFormats: + *s = MatchUnknownComponentWorkFormats + case MatchUnknownComponentSalaryCompatibility: + *s = MatchUnknownComponentSalaryCompatibility + case MatchUnknownComponentDomain: + *s = MatchUnknownComponentDomain + default: + *s = MatchUnknownComponent(v) + } + + return nil +} + +// MarshalJSON implements stdjson.Marshaler. +func (s MatchUnknownComponent) MarshalJSON() ([]byte, error) { + e := jx.Encoder{} + s.Encode(&e) + return e.Bytes(), nil +} + +// UnmarshalJSON implements stdjson.Unmarshaler. +func (s *MatchUnknownComponent) UnmarshalJSON(data []byte) error { + d := jx.DecodeBytes(data) + return s.Decode(d) +} + +// Encode implements json.Marshaler. +func (s *MatchUnknownFlag) Encode(e *jx.Encoder) { + e.ObjStart() + s.encodeFields(e) + e.ObjEnd() +} + +// encodeFields encodes fields. +func (s *MatchUnknownFlag) encodeFields(e *jx.Encoder) { + { + e.FieldStart("component") + s.Component.Encode(e) + } + { + e.FieldStart("reason") + s.Reason.Encode(e) + } +} + +var jsonFieldsNameOfMatchUnknownFlag = [2]string{ + 0: "component", + 1: "reason", +} + +// Decode decodes MatchUnknownFlag from json. +func (s *MatchUnknownFlag) Decode(d *jx.Decoder) error { + if s == nil { + return errors.New("invalid: unable to decode MatchUnknownFlag to nil") + } + var requiredBitSet [1]uint8 + + if err := d.ObjBytes(func(d *jx.Decoder, k []byte) error { + switch string(k) { + case "component": + requiredBitSet[0] |= 1 << 0 + if err := func() error { + if err := s.Component.Decode(d); err != nil { + return err + } + return nil + }(); err != nil { + return errors.Wrap(err, "decode field \"component\"") + } + case "reason": + requiredBitSet[0] |= 1 << 1 + if err := func() error { + if err := s.Reason.Decode(d); err != nil { + return err + } + return nil + }(); err != nil { + return errors.Wrap(err, "decode field \"reason\"") + } + default: + return errors.Errorf("unexpected field %q", k) + } + return nil + }); err != nil { + return errors.Wrap(err, "decode MatchUnknownFlag") + } + // Validate required fields. + var failures []validate.FieldError + for i, mask := range [1]uint8{ + 0b00000011, + } { + if result := (requiredBitSet[i] & mask) ^ mask; result != 0 { + // Mask only required fields and check equality to mask using XOR. + // + // If XOR result is not zero, result is not equal to expected, so some fields are missed. + // Bits of fields which would be set are actually bits of missed fields. + missed := bits.OnesCount8(result) + for bitN := 0; bitN < missed; bitN++ { + bitIdx := bits.TrailingZeros8(result) + fieldIdx := i*8 + bitIdx + var name string + if fieldIdx < len(jsonFieldsNameOfMatchUnknownFlag) { + name = jsonFieldsNameOfMatchUnknownFlag[fieldIdx] + } else { + name = strconv.Itoa(fieldIdx) + } + failures = append(failures, validate.FieldError{ + Name: name, + Error: validate.ErrFieldRequired, + }) + // Reset bit. + result &^= 1 << bitIdx + } + } + } + if len(failures) > 0 { + return &validate.Error{Fields: failures} + } + + return nil +} + +// MarshalJSON implements stdjson.Marshaler. +func (s *MatchUnknownFlag) MarshalJSON() ([]byte, error) { + e := jx.Encoder{} + s.Encode(&e) + return e.Bytes(), nil +} + +// UnmarshalJSON implements stdjson.Unmarshaler. +func (s *MatchUnknownFlag) UnmarshalJSON(data []byte) error { + d := jx.DecodeBytes(data) + return s.Decode(d) +} + +// Encode encodes MatchUnknownFlags as json. +func (s MatchUnknownFlags) Encode(e *jx.Encoder) { + unwrapped := []MatchUnknownFlag(s) + + e.ArrStart() + for _, elem := range unwrapped { + elem.Encode(e) + } + e.ArrEnd() +} + +// Decode decodes MatchUnknownFlags from json. +func (s *MatchUnknownFlags) Decode(d *jx.Decoder) error { + if s == nil { + return errors.New("invalid: unable to decode MatchUnknownFlags to nil") + } + var unwrapped []MatchUnknownFlag + if err := func() error { + unwrapped = make([]MatchUnknownFlag, 0) + if err := d.Arr(func(d *jx.Decoder) error { + var elem MatchUnknownFlag + if err := elem.Decode(d); err != nil { + return err + } + unwrapped = append(unwrapped, elem) + return nil + }); err != nil { + return err + } + return nil + }(); err != nil { + return errors.Wrap(err, "alias") + } + *s = MatchUnknownFlags(unwrapped) + return nil +} + +// MarshalJSON implements stdjson.Marshaler. +func (s MatchUnknownFlags) MarshalJSON() ([]byte, error) { + e := jx.Encoder{} + s.Encode(&e) + return e.Bytes(), nil +} + +// UnmarshalJSON implements stdjson.Unmarshaler. +func (s *MatchUnknownFlags) UnmarshalJSON(data []byte) error { + d := jx.DecodeBytes(data) + return s.Decode(d) +} + +// Encode encodes MatchUnknownReason as json. +func (s MatchUnknownReason) Encode(e *jx.Encoder) { + e.Str(string(s)) +} + +// Decode decodes MatchUnknownReason from json. +func (s *MatchUnknownReason) Decode(d *jx.Decoder) error { + if s == nil { + return errors.New("invalid: unable to decode MatchUnknownReason to nil") + } + v, err := d.StrBytes() + if err != nil { + return err + } + // Try to use constant string. + switch MatchUnknownReason(v) { + case MatchUnknownReasonMlUnavailable: + *s = MatchUnknownReasonMlUnavailable + case MatchUnknownReasonCohortBelow30: + *s = MatchUnknownReasonCohortBelow30 + case MatchUnknownReasonNoConfirmationForSpecialization: + *s = MatchUnknownReasonNoConfirmationForSpecialization + case MatchUnknownReasonNotInPublicCard: + *s = MatchUnknownReasonNotInPublicCard + case MatchUnknownReasonNeedFieldUnconfirmed: + *s = MatchUnknownReasonNeedFieldUnconfirmed + case MatchUnknownReasonNoFreshnessHistory: + *s = MatchUnknownReasonNoFreshnessHistory + case MatchUnknownReasonNoResponseHistory: + *s = MatchUnknownReasonNoResponseHistory + default: + *s = MatchUnknownReason(v) + } + + return nil +} + +// MarshalJSON implements stdjson.Marshaler. +func (s MatchUnknownReason) MarshalJSON() ([]byte, error) { + e := jx.Encoder{} + s.Encode(&e) + return e.Bytes(), nil +} + +// UnmarshalJSON implements stdjson.Unmarshaler. +func (s *MatchUnknownReason) UnmarshalJSON(data []byte) error { + d := jx.DecodeBytes(data) + return s.Decode(d) +} + // Encode encodes MembershipState as json. func (s MembershipState) Encode(e *jx.Encoder) { e.Str(string(s)) @@ -32478,6 +36104,138 @@ func (s *NilInvitationTermsVersion) UnmarshalJSON(data []byte) error { return s.Decode(d) } +// Encode encodes MatchAppliedConditions as json. +func (o NilMatchAppliedConditions) Encode(e *jx.Encoder) { + if o.Null { + e.Null() + return + } + o.Value.Encode(e) +} + +// Decode decodes MatchAppliedConditions from json. +func (o *NilMatchAppliedConditions) Decode(d *jx.Decoder) error { + if o == nil { + return errors.New("invalid: unable to decode NilMatchAppliedConditions to nil") + } + if d.Next() == jx.Null { + if err := d.Null(); err != nil { + return err + } + + var v MatchAppliedConditions + o.Value = v + o.Null = true + return nil + } + o.Null = false + if err := o.Value.Decode(d); err != nil { + return err + } + return nil +} + +// MarshalJSON implements stdjson.Marshaler. +func (s NilMatchAppliedConditions) MarshalJSON() ([]byte, error) { + e := jx.Encoder{} + s.Encode(&e) + return e.Bytes(), nil +} + +// UnmarshalJSON implements stdjson.Unmarshaler. +func (s *NilMatchAppliedConditions) UnmarshalJSON(data []byte) error { + d := jx.DecodeBytes(data) + return s.Decode(d) +} + +// Encode encodes MatchConfirmationStatus as json. +func (o NilMatchConfirmationStatus) Encode(e *jx.Encoder) { + if o.Null { + e.Null() + return + } + e.Str(string(o.Value)) +} + +// Decode decodes MatchConfirmationStatus from json. +func (o *NilMatchConfirmationStatus) Decode(d *jx.Decoder) error { + if o == nil { + return errors.New("invalid: unable to decode NilMatchConfirmationStatus to nil") + } + if d.Next() == jx.Null { + if err := d.Null(); err != nil { + return err + } + + var v MatchConfirmationStatus + o.Value = v + o.Null = true + return nil + } + o.Null = false + if err := o.Value.Decode(d); err != nil { + return err + } + return nil +} + +// MarshalJSON implements stdjson.Marshaler. +func (s NilMatchConfirmationStatus) MarshalJSON() ([]byte, error) { + e := jx.Encoder{} + s.Encode(&e) + return e.Bytes(), nil +} + +// UnmarshalJSON implements stdjson.Unmarshaler. +func (s *NilMatchConfirmationStatus) UnmarshalJSON(data []byte) error { + d := jx.DecodeBytes(data) + return s.Decode(d) +} + +// Encode encodes MatchGradeFilter as json. +func (o NilMatchGradeFilter) Encode(e *jx.Encoder) { + if o.Null { + e.Null() + return + } + o.Value.Encode(e) +} + +// Decode decodes MatchGradeFilter from json. +func (o *NilMatchGradeFilter) Decode(d *jx.Decoder) error { + if o == nil { + return errors.New("invalid: unable to decode NilMatchGradeFilter to nil") + } + if d.Next() == jx.Null { + if err := d.Null(); err != nil { + return err + } + + var v MatchGradeFilter + o.Value = v + o.Null = true + return nil + } + o.Null = false + if err := o.Value.Decode(d); err != nil { + return err + } + return nil +} + +// MarshalJSON implements stdjson.Marshaler. +func (s NilMatchGradeFilter) MarshalJSON() ([]byte, error) { + e := jx.Encoder{} + s.Encode(&e) + return e.Bytes(), nil +} + +// UnmarshalJSON implements stdjson.Unmarshaler. +func (s *NilMatchGradeFilter) UnmarshalJSON(data []byte) error { + d := jx.DecodeBytes(data) + return s.Decode(d) +} + // Encode encodes NeedDomainName as json. func (o NilNeedDomainName) Encode(e *jx.Encoder) { if o.Null { @@ -34718,6 +38476,72 @@ func (s *OnboardingStep) UnmarshalJSON(data []byte) error { return s.Decode(d) } +// Encode encodes CandidateSalaryCompatibility as json. +func (o OptCandidateSalaryCompatibility) Encode(e *jx.Encoder) { + if !o.Set { + return + } + e.Str(string(o.Value)) +} + +// Decode decodes CandidateSalaryCompatibility from json. +func (o *OptCandidateSalaryCompatibility) Decode(d *jx.Decoder) error { + if o == nil { + return errors.New("invalid: unable to decode OptCandidateSalaryCompatibility to nil") + } + o.Set = true + if err := o.Value.Decode(d); err != nil { + return err + } + return nil +} + +// MarshalJSON implements stdjson.Marshaler. +func (s OptCandidateSalaryCompatibility) MarshalJSON() ([]byte, error) { + e := jx.Encoder{} + s.Encode(&e) + return e.Bytes(), nil +} + +// UnmarshalJSON implements stdjson.Unmarshaler. +func (s *OptCandidateSalaryCompatibility) UnmarshalJSON(data []byte) error { + d := jx.DecodeBytes(data) + return s.Decode(d) +} + +// Encode encodes GradeCode as json. +func (o OptGradeCode) Encode(e *jx.Encoder) { + if !o.Set { + return + } + e.Str(string(o.Value)) +} + +// Decode decodes GradeCode from json. +func (o *OptGradeCode) Decode(d *jx.Decoder) error { + if o == nil { + return errors.New("invalid: unable to decode OptGradeCode to nil") + } + o.Set = true + if err := o.Value.Decode(d); err != nil { + return err + } + return nil +} + +// MarshalJSON implements stdjson.Marshaler. +func (s OptGradeCode) MarshalJSON() ([]byte, error) { + e := jx.Encoder{} + s.Encode(&e) + return e.Bytes(), nil +} + +// UnmarshalJSON implements stdjson.Unmarshaler. +func (s *OptGradeCode) UnmarshalJSON(data []byte) error { + d := jx.DecodeBytes(data) + return s.Decode(d) +} + // Encode encodes InvitationResponsePeriod as json. func (o OptInvitationResponsePeriod) Encode(e *jx.Encoder) { if !o.Set { @@ -34784,6 +38608,138 @@ func (s *OptInvitationTerms) UnmarshalJSON(data []byte) error { return s.Decode(d) } +// Encode encodes MatchConfirmationStatus as json. +func (o OptMatchConfirmationStatus) Encode(e *jx.Encoder) { + if !o.Set { + return + } + e.Str(string(o.Value)) +} + +// Decode decodes MatchConfirmationStatus from json. +func (o *OptMatchConfirmationStatus) Decode(d *jx.Decoder) error { + if o == nil { + return errors.New("invalid: unable to decode OptMatchConfirmationStatus to nil") + } + o.Set = true + if err := o.Value.Decode(d); err != nil { + return err + } + return nil +} + +// MarshalJSON implements stdjson.Marshaler. +func (s OptMatchConfirmationStatus) MarshalJSON() ([]byte, error) { + e := jx.Encoder{} + s.Encode(&e) + return e.Bytes(), nil +} + +// UnmarshalJSON implements stdjson.Unmarshaler. +func (s *OptMatchConfirmationStatus) UnmarshalJSON(data []byte) error { + d := jx.DecodeBytes(data) + return s.Decode(d) +} + +// Encode encodes MatchGradeFilter as json. +func (o OptMatchGradeFilter) Encode(e *jx.Encoder) { + if !o.Set { + return + } + o.Value.Encode(e) +} + +// Decode decodes MatchGradeFilter from json. +func (o *OptMatchGradeFilter) Decode(d *jx.Decoder) error { + if o == nil { + return errors.New("invalid: unable to decode OptMatchGradeFilter to nil") + } + o.Set = true + if err := o.Value.Decode(d); err != nil { + return err + } + return nil +} + +// MarshalJSON implements stdjson.Marshaler. +func (s OptMatchGradeFilter) MarshalJSON() ([]byte, error) { + e := jx.Encoder{} + s.Encode(&e) + return e.Bytes(), nil +} + +// UnmarshalJSON implements stdjson.Unmarshaler. +func (s *OptMatchGradeFilter) UnmarshalJSON(data []byte) error { + d := jx.DecodeBytes(data) + return s.Decode(d) +} + +// Encode encodes MatchSearchConditions as json. +func (o OptMatchSearchConditions) Encode(e *jx.Encoder) { + if !o.Set { + return + } + o.Value.Encode(e) +} + +// Decode decodes MatchSearchConditions from json. +func (o *OptMatchSearchConditions) Decode(d *jx.Decoder) error { + if o == nil { + return errors.New("invalid: unable to decode OptMatchSearchConditions to nil") + } + o.Set = true + if err := o.Value.Decode(d); err != nil { + return err + } + return nil +} + +// MarshalJSON implements stdjson.Marshaler. +func (s OptMatchSearchConditions) MarshalJSON() ([]byte, error) { + e := jx.Encoder{} + s.Encode(&e) + return e.Bytes(), nil +} + +// UnmarshalJSON implements stdjson.Unmarshaler. +func (s *OptMatchSearchConditions) UnmarshalJSON(data []byte) error { + d := jx.DecodeBytes(data) + return s.Decode(d) +} + +// Encode encodes MatchSearchFilters as json. +func (o OptMatchSearchFilters) Encode(e *jx.Encoder) { + if !o.Set { + return + } + o.Value.Encode(e) +} + +// Decode decodes MatchSearchFilters from json. +func (o *OptMatchSearchFilters) Decode(d *jx.Decoder) error { + if o == nil { + return errors.New("invalid: unable to decode OptMatchSearchFilters to nil") + } + o.Set = true + if err := o.Value.Decode(d); err != nil { + return err + } + return nil +} + +// MarshalJSON implements stdjson.Marshaler. +func (s OptMatchSearchFilters) MarshalJSON() ([]byte, error) { + e := jx.Encoder{} + s.Encode(&e) + return e.Bytes(), nil +} + +// UnmarshalJSON implements stdjson.Unmarshaler. +func (s *OptMatchSearchFilters) UnmarshalJSON(data []byte) error { + d := jx.DecodeBytes(data) + return s.Decode(d) +} + // Encode encodes NeedTitle as json. func (o OptNeedTitle) Encode(e *jx.Encoder) { if !o.Set { @@ -35583,6 +39539,39 @@ func (s *OptOrganizationName) UnmarshalJSON(data []byte) error { return s.Decode(d) } +// Encode encodes SpecializationCode as json. +func (o OptSpecializationCode) Encode(e *jx.Encoder) { + if !o.Set { + return + } + e.Str(string(o.Value)) +} + +// Decode decodes SpecializationCode from json. +func (o *OptSpecializationCode) Decode(d *jx.Decoder) error { + if o == nil { + return errors.New("invalid: unable to decode OptSpecializationCode to nil") + } + o.Set = true + if err := o.Value.Decode(d); err != nil { + return err + } + return nil +} + +// MarshalJSON implements stdjson.Marshaler. +func (s OptSpecializationCode) MarshalJSON() ([]byte, error) { + e := jx.Encoder{} + s.Encode(&e) + return e.Bytes(), nil +} + +// UnmarshalJSON implements stdjson.Unmarshaler. +func (s *OptSpecializationCode) UnmarshalJSON(data []byte) error { + d := jx.DecodeBytes(data) + return s.Decode(d) +} + // Encode encodes string as json. func (o OptString) Encode(e *jx.Encoder) { if !o.Set { @@ -47730,6 +51719,158 @@ func (s *SaveMyQuestionnaireUnauthorized) UnmarshalJSON(data []byte) error { return s.Decode(d) } +// Encode encodes SearchOrganizationMatchesBadRequest as json. +func (s *SearchOrganizationMatchesBadRequest) Encode(e *jx.Encoder) { + unwrapped := (*Problem)(s) + + unwrapped.Encode(e) +} + +// Decode decodes SearchOrganizationMatchesBadRequest from json. +func (s *SearchOrganizationMatchesBadRequest) Decode(d *jx.Decoder) error { + if s == nil { + return errors.New("invalid: unable to decode SearchOrganizationMatchesBadRequest to nil") + } + var unwrapped Problem + if err := func() error { + if err := unwrapped.Decode(d); err != nil { + return err + } + return nil + }(); err != nil { + return errors.Wrap(err, "alias") + } + *s = SearchOrganizationMatchesBadRequest(unwrapped) + return nil +} + +// MarshalJSON implements stdjson.Marshaler. +func (s *SearchOrganizationMatchesBadRequest) MarshalJSON() ([]byte, error) { + e := jx.Encoder{} + s.Encode(&e) + return e.Bytes(), nil +} + +// UnmarshalJSON implements stdjson.Unmarshaler. +func (s *SearchOrganizationMatchesBadRequest) UnmarshalJSON(data []byte) error { + d := jx.DecodeBytes(data) + return s.Decode(d) +} + +// Encode encodes SearchOrganizationMatchesForbidden as json. +func (s *SearchOrganizationMatchesForbidden) Encode(e *jx.Encoder) { + unwrapped := (*Problem)(s) + + unwrapped.Encode(e) +} + +// Decode decodes SearchOrganizationMatchesForbidden from json. +func (s *SearchOrganizationMatchesForbidden) Decode(d *jx.Decoder) error { + if s == nil { + return errors.New("invalid: unable to decode SearchOrganizationMatchesForbidden to nil") + } + var unwrapped Problem + if err := func() error { + if err := unwrapped.Decode(d); err != nil { + return err + } + return nil + }(); err != nil { + return errors.Wrap(err, "alias") + } + *s = SearchOrganizationMatchesForbidden(unwrapped) + return nil +} + +// MarshalJSON implements stdjson.Marshaler. +func (s *SearchOrganizationMatchesForbidden) MarshalJSON() ([]byte, error) { + e := jx.Encoder{} + s.Encode(&e) + return e.Bytes(), nil +} + +// UnmarshalJSON implements stdjson.Unmarshaler. +func (s *SearchOrganizationMatchesForbidden) UnmarshalJSON(data []byte) error { + d := jx.DecodeBytes(data) + return s.Decode(d) +} + +// Encode encodes SearchOrganizationMatchesNotFound as json. +func (s *SearchOrganizationMatchesNotFound) Encode(e *jx.Encoder) { + unwrapped := (*Problem)(s) + + unwrapped.Encode(e) +} + +// Decode decodes SearchOrganizationMatchesNotFound from json. +func (s *SearchOrganizationMatchesNotFound) Decode(d *jx.Decoder) error { + if s == nil { + return errors.New("invalid: unable to decode SearchOrganizationMatchesNotFound to nil") + } + var unwrapped Problem + if err := func() error { + if err := unwrapped.Decode(d); err != nil { + return err + } + return nil + }(); err != nil { + return errors.Wrap(err, "alias") + } + *s = SearchOrganizationMatchesNotFound(unwrapped) + return nil +} + +// MarshalJSON implements stdjson.Marshaler. +func (s *SearchOrganizationMatchesNotFound) MarshalJSON() ([]byte, error) { + e := jx.Encoder{} + s.Encode(&e) + return e.Bytes(), nil +} + +// UnmarshalJSON implements stdjson.Unmarshaler. +func (s *SearchOrganizationMatchesNotFound) UnmarshalJSON(data []byte) error { + d := jx.DecodeBytes(data) + return s.Decode(d) +} + +// Encode encodes SearchOrganizationMatchesUnauthorized as json. +func (s *SearchOrganizationMatchesUnauthorized) Encode(e *jx.Encoder) { + unwrapped := (*Problem)(s) + + unwrapped.Encode(e) +} + +// Decode decodes SearchOrganizationMatchesUnauthorized from json. +func (s *SearchOrganizationMatchesUnauthorized) Decode(d *jx.Decoder) error { + if s == nil { + return errors.New("invalid: unable to decode SearchOrganizationMatchesUnauthorized to nil") + } + var unwrapped Problem + if err := func() error { + if err := unwrapped.Decode(d); err != nil { + return err + } + return nil + }(); err != nil { + return errors.Wrap(err, "alias") + } + *s = SearchOrganizationMatchesUnauthorized(unwrapped) + return nil +} + +// MarshalJSON implements stdjson.Marshaler. +func (s *SearchOrganizationMatchesUnauthorized) MarshalJSON() ([]byte, error) { + e := jx.Encoder{} + s.Encode(&e) + return e.Bytes(), nil +} + +// UnmarshalJSON implements stdjson.Unmarshaler. +func (s *SearchOrganizationMatchesUnauthorized) UnmarshalJSON(data []byte) error { + d := jx.DecodeBytes(data) + return s.Decode(d) +} + // Encode implements json.Marshaler. func (s *SearchStatus) Encode(e *jx.Encoder) { e.ObjStart() diff --git a/backend/internal/adapter/primary/http/api/oas_operations_gen.go b/backend/internal/adapter/primary/http/api/oas_operations_gen.go index 964567f..a2456b0 100644 --- a/backend/internal/adapter/primary/http/api/oas_operations_gen.go +++ b/backend/internal/adapter/primary/http/api/oas_operations_gen.go @@ -58,6 +58,7 @@ const ( RevokeMyOrganizationContactConsentOperation OperationName = "RevokeMyOrganizationContactConsent" SaveMyProfileOperation OperationName = "SaveMyProfile" SaveMyQuestionnaireOperation OperationName = "SaveMyQuestionnaire" + SearchOrganizationMatchesOperation OperationName = "SearchOrganizationMatches" SendOrganizationInvitationOperation OperationName = "SendOrganizationInvitation" SetMyPublicationOperation OperationName = "SetMyPublication" SetMySearchStatusOperation OperationName = "SetMySearchStatus" diff --git a/backend/internal/adapter/primary/http/api/oas_parameters_gen.go b/backend/internal/adapter/primary/http/api/oas_parameters_gen.go index b6b01b4..4ca4d4d 100644 --- a/backend/internal/adapter/primary/http/api/oas_parameters_gen.go +++ b/backend/internal/adapter/primary/http/api/oas_parameters_gen.go @@ -4788,6 +4788,75 @@ func decodeRevokeMyOrganizationContactConsentParams(args [1]string, argsEscaped return params, nil } +// SearchOrganizationMatchesParams is parameters of SearchOrganizationMatches operation. +type SearchOrganizationMatchesParams struct { + // Identifier of an organization. Access comes only from an active membership of the session account in + // this organization, checked by the server on every request; the identifier itself grants nothing. An + // organization without such a membership and an unknown identifier both answer 404 not_found, so + // organizations cannot be enumerated. + OrgID uuid.UUID +} + +func unpackSearchOrganizationMatchesParams(packed middleware.Parameters) (params SearchOrganizationMatchesParams) { + { + key := middleware.ParameterKey{ + Name: "org_id", + In: "path", + } + params.OrgID = packed[key].(uuid.UUID) + } + return params +} + +func decodeSearchOrganizationMatchesParams(args [1]string, argsEscaped bool, r *http.Request) (params SearchOrganizationMatchesParams, _ error) { + // Decode path: org_id. + if err := func() error { + param := args[0] + if argsEscaped { + unescaped, err := url.PathUnescape(args[0]) + if err != nil { + return errors.Wrap(err, "unescape path") + } + param = unescaped + } + if len(param) > 0 { + d := uri.NewPathDecoder(uri.PathDecoderConfig{ + Param: "org_id", + Value: param, + Style: uri.PathStyleSimple, + Explode: false, + }) + + if err := func() error { + val, err := d.DecodeValue() + if err != nil { + return err + } + + c, err := conv.ToUUID(val) + if err != nil { + return err + } + + params.OrgID = c + return nil + }(); err != nil { + return err + } + } else { + return validate.ErrFieldRequired + } + return nil + }(); err != nil { + return params, &ogenerrors.DecodeParamError{ + Name: "org_id", + In: "path", + Err: err, + } + } + return params, nil +} + // SendOrganizationInvitationParams is parameters of SendOrganizationInvitation operation. type SendOrganizationInvitationParams struct { // Identifier of an organization. Access comes only from an active membership of the session account in diff --git a/backend/internal/adapter/primary/http/api/oas_request_decoders_gen.go b/backend/internal/adapter/primary/http/api/oas_request_decoders_gen.go index a68a30b..a178d3d 100644 --- a/backend/internal/adapter/primary/http/api/oas_request_decoders_gen.go +++ b/backend/internal/adapter/primary/http/api/oas_request_decoders_gen.go @@ -1436,6 +1436,85 @@ func (s *Server) decodeSaveMyQuestionnaireRequest(r *http.Request) ( } } +func (s *Server) decodeSearchOrganizationMatchesRequest(r *http.Request) ( + req MatchSearchRequest, + rawBody []byte, + close func() error, + rerr error, +) { + var closers []func() error + close = func() error { + var merr error + // Close in reverse order, to match defer behavior. + for i := len(closers) - 1; i >= 0; i-- { + c := closers[i] + merr = errors.Join(merr, c()) + } + return merr + } + defer func() { + if rerr != nil { + rerr = errors.Join(rerr, close()) + } + }() + ct, _, err := mime.ParseMediaType(r.Header.Get("Content-Type")) + if err != nil { + return req, rawBody, close, errors.Wrap(err, "parse media type") + } + switch { + case ct == "application/json": + if r.ContentLength == 0 { + return req, rawBody, close, validate.ErrBodyRequired + } + buf, err := io.ReadAll(r.Body) + defer func() { + _ = r.Body.Close() + }() + if err != nil { + return req, rawBody, close, err + } + + // Reset the body to allow for downstream reading. + r.Body = io.NopCloser(bytes.NewBuffer(buf)) + + if len(buf) == 0 { + return req, rawBody, close, validate.ErrBodyRequired + } + + rawBody = append(rawBody, buf...) + d := jx.DecodeBytes(buf) + + var request MatchSearchRequest + if err := func() error { + if err := request.Decode(d); err != nil { + return err + } + if err := d.Skip(); err != io.EOF { + return errors.New("unexpected trailing data") + } + return nil + }(); err != nil { + err = &ogenerrors.DecodeBodyError{ + ContentType: ct, + Body: buf, + Err: err, + } + return req, rawBody, close, err + } + if err := func() error { + if err := request.Validate(); err != nil { + return err + } + return nil + }(); err != nil { + return req, rawBody, close, errors.Wrap(err, "validate") + } + return request, rawBody, close, nil + default: + return req, rawBody, close, validate.InvalidContentType(ct) + } +} + func (s *Server) decodeSendOrganizationInvitationRequest(r *http.Request) ( req *InvitationCommand, rawBody []byte, diff --git a/backend/internal/adapter/primary/http/api/oas_response_encoders_gen.go b/backend/internal/adapter/primary/http/api/oas_response_encoders_gen.go index d60f6fe..c08ffb6 100644 --- a/backend/internal/adapter/primary/http/api/oas_response_encoders_gen.go +++ b/backend/internal/adapter/primary/http/api/oas_response_encoders_gen.go @@ -4388,6 +4388,89 @@ func encodeSaveMyQuestionnaireResponse(response SaveMyQuestionnaireRes, w http.R } } +func encodeSearchOrganizationMatchesResponse(response SearchOrganizationMatchesRes, w http.ResponseWriter, span trace.Span) error { + switch response := response.(type) { + case *MatchSearchResponseHeaders: + w.Header().Set("Content-Type", "application/json; charset=utf-8") + // Encoding response headers. + { + h := uri.NewHeaderEncoder(w.Header()) + // Encode "Cache-Control" header. + { + cfg := uri.HeaderParameterEncodingConfig{ + Name: "Cache-Control", + Explode: false, + } + if err := h.EncodeParam(cfg, func(e uri.Encoder) error { + return e.EncodeValue(conv.StringToString(string(response.CacheControl))) + }); err != nil { + return errors.Wrap(err, "encode Cache-Control header") + } + } + } + w.WriteHeader(200) + + e := new(jx.Encoder) + response.Response.Encode(e) + if _, err := e.WriteTo(w); err != nil { + return errors.Wrap(err, "write") + } + + return nil + + case *SearchOrganizationMatchesBadRequest: + w.Header().Set("Content-Type", "application/problem+json") + w.WriteHeader(400) + + e := new(jx.Encoder) + response.Encode(e) + if _, err := e.WriteTo(w); err != nil { + return errors.Wrap(err, "write") + } + + return nil + + case *SearchOrganizationMatchesUnauthorized: + w.Header().Set("Content-Type", "application/problem+json") + w.WriteHeader(401) + + e := new(jx.Encoder) + response.Encode(e) + if _, err := e.WriteTo(w); err != nil { + return errors.Wrap(err, "write") + } + + return nil + + case *SearchOrganizationMatchesForbidden: + w.Header().Set("Content-Type", "application/problem+json") + w.WriteHeader(403) + + e := new(jx.Encoder) + response.Encode(e) + if _, err := e.WriteTo(w); err != nil { + return errors.Wrap(err, "write") + } + + return nil + + case *SearchOrganizationMatchesNotFound: + w.Header().Set("Content-Type", "application/problem+json") + w.WriteHeader(404) + + e := new(jx.Encoder) + response.Encode(e) + if _, err := e.WriteTo(w); err != nil { + return errors.Wrap(err, "write") + } + + return nil + + default: + return errors.Errorf("unexpected response type: %T", response) + } +} + func encodeSendOrganizationInvitationResponse(response SendOrganizationInvitationRes, w http.ResponseWriter, span trace.Span) error { switch response := response.(type) { case *OrganizationInvitationHeaders: diff --git a/backend/internal/adapter/primary/http/api/oas_router_gen.go b/backend/internal/adapter/primary/http/api/oas_router_gen.go index cc666c2..98c0825 100644 --- a/backend/internal/adapter/primary/http/api/oas_router_gen.go +++ b/backend/internal/adapter/primary/http/api/oas_router_gen.go @@ -32,13 +32,13 @@ var ( rn9AllowedHeaders = map[string]string{ "POST": "Content-Type,Idempotency-Key,X-Csrf-Token", } - rn79AllowedHeaders = map[string]string{ + rn80AllowedHeaders = map[string]string{ "POST": "Content-Type,Idempotency-Key,X-Csrf-Token", } rn20AllowedHeaders = map[string]string{ "POST": "Content-Type,Idempotency-Key,X-Csrf-Token", } - rn78AllowedHeaders = map[string]string{ + rn79AllowedHeaders = map[string]string{ "POST": "Content-Type,Idempotency-Key,X-Csrf-Token", } rn64AllowedHeaders = map[string]string{ @@ -60,17 +60,17 @@ var ( rn17AllowedHeaders = map[string]string{ "POST": "Content-Type,Idempotency-Key,X-Csrf-Token", } - rn80AllowedHeaders = map[string]string{ + rn81AllowedHeaders = map[string]string{ "POST": "X-Csrf-Token", } rn53AllowedHeaders = map[string]string{ "DELETE": "X-Csrf-Token", "PUT": "X-Csrf-Token", } - rn75AllowedHeaders = map[string]string{ + rn76AllowedHeaders = map[string]string{ "PUT": "Content-Type,X-Csrf-Token", } - rn76AllowedHeaders = map[string]string{ + rn77AllowedHeaders = map[string]string{ "PUT": "Content-Type,X-Csrf-Token", } rn36AllowedHeaders = map[string]string{ @@ -97,12 +97,15 @@ var ( rn63AllowedHeaders = map[string]string{ "POST": "Content-Type,Idempotency-Key,X-Csrf-Token", } - rn73AllowedHeaders = map[string]string{ + rn74AllowedHeaders = map[string]string{ "POST": "Content-Type,Idempotency-Key,X-Csrf-Token", } - rn81AllowedHeaders = map[string]string{ + rn82AllowedHeaders = map[string]string{ "POST": "Content-Type,Idempotency-Key,X-Csrf-Token", } + rn72AllowedHeaders = map[string]string{ + "POST": "Content-Type,X-Csrf-Token", + } rn16AllowedHeaders = map[string]string{ "POST": "Content-Type,Idempotency-Key,X-Csrf-Token", } @@ -554,7 +557,7 @@ func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) { default: s.notAllowed(w, r, notAllowedParams{ allowedMethods: "POST", - allowedHeaders: rn79AllowedHeaders, + allowedHeaders: rn80AllowedHeaders, acceptPost: "application/json", acceptPatch: "", }) @@ -647,7 +650,7 @@ func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) { default: s.notAllowed(w, r, notAllowedParams{ allowedMethods: "POST", - allowedHeaders: rn78AllowedHeaders, + allowedHeaders: rn79AllowedHeaders, acceptPost: "application/json", acceptPatch: "", }) @@ -1048,7 +1051,7 @@ func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) { default: s.notAllowed(w, r, notAllowedParams{ allowedMethods: "POST", - allowedHeaders: rn80AllowedHeaders, + allowedHeaders: rn81AllowedHeaders, acceptPost: "", acceptPatch: "", }) @@ -1319,7 +1322,7 @@ func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) { default: s.notAllowed(w, r, notAllowedParams{ allowedMethods: "PUT", - allowedHeaders: rn75AllowedHeaders, + allowedHeaders: rn76AllowedHeaders, acceptPost: "", acceptPatch: "", }) @@ -1346,7 +1349,7 @@ func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) { default: s.notAllowed(w, r, notAllowedParams{ allowedMethods: "PUT", - allowedHeaders: rn76AllowedHeaders, + allowedHeaders: rn77AllowedHeaders, acceptPost: "", acceptPatch: "", }) @@ -1763,7 +1766,7 @@ func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) { default: s.notAllowed(w, r, notAllowedParams{ allowedMethods: "POST", - allowedHeaders: rn73AllowedHeaders, + allowedHeaders: rn74AllowedHeaders, acceptPost: "application/json", acceptPatch: "", }) @@ -1793,7 +1796,7 @@ func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) { default: s.notAllowed(w, r, notAllowedParams{ allowedMethods: "POST", - allowedHeaders: rn81AllowedHeaders, + allowedHeaders: rn82AllowedHeaders, acceptPost: "application/json", acceptPatch: "", }) @@ -1808,6 +1811,33 @@ func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) { } + case 'm': // Prefix: "matches" + + if l := len("matches"); len(elem) >= l && elem[0:l] == "matches" { + elem = elem[l:] + } else { + break + } + + if len(elem) == 0 { + // Leaf node. + switch r.Method { + case "POST": + s.handleSearchOrganizationMatchesRequest([1]string{ + args[0], + }, elemIsEscaped, w, r) + default: + s.notAllowed(w, r, notAllowedParams{ + allowedMethods: "POST", + allowedHeaders: rn72AllowedHeaders, + acceptPost: "application/json", + acceptPatch: "", + }) + } + + return + } + case 'n': // Prefix: "needs" if l := len("needs"); len(elem) >= l && elem[0:l] == "needs" { @@ -3655,6 +3685,31 @@ func (s *Server) FindPath(method string, u *url.URL) (r Route, _ bool) { } + case 'm': // Prefix: "matches" + + if l := len("matches"); len(elem) >= l && elem[0:l] == "matches" { + elem = elem[l:] + } else { + break + } + + if len(elem) == 0 { + // Leaf node. + switch method { + case "POST": + r.name = SearchOrganizationMatchesOperation + r.summary = "Search the current organization-visible candidate bank." + r.operationID = "SearchOrganizationMatches" + r.operationGroup = "" + r.pathPattern = "/api/v1/organizations/{org_id}/matches" + r.args = args + r.count = 1 + return r, true + default: + return + } + } + case 'n': // Prefix: "needs" if l := len("needs"); len(elem) >= l && elem[0:l] == "needs" { diff --git a/backend/internal/adapter/primary/http/api/oas_schemas_gen.go b/backend/internal/adapter/primary/http/api/oas_schemas_gen.go index ad342d5..5f49879 100644 --- a/backend/internal/adapter/primary/http/api/oas_schemas_gen.go +++ b/backend/internal/adapter/primary/http/api/oas_schemas_gen.go @@ -11579,6 +11579,1729 @@ func (s *LogoutNoContent) SetSetCookie(val string) { func (*LogoutNoContent) logoutRes() {} +// Conditions echoed as a complete snapshot; null means no filter. +// Ref: #/components/schemas/MatchAppliedConditions +type MatchAppliedConditions struct { + WorkFormats []WorkFormat `json:"work_formats"` + SalaryCompatibility NilCandidateSalaryCompatibility `json:"salary_compatibility"` +} + +// GetWorkFormats returns the value of WorkFormats. +func (s *MatchAppliedConditions) GetWorkFormats() []WorkFormat { + return s.WorkFormats +} + +// GetSalaryCompatibility returns the value of SalaryCompatibility. +func (s *MatchAppliedConditions) GetSalaryCompatibility() NilCandidateSalaryCompatibility { + return s.SalaryCompatibility +} + +// SetWorkFormats sets the value of WorkFormats. +func (s *MatchAppliedConditions) SetWorkFormats(val []WorkFormat) { + s.WorkFormats = val +} + +// SetSalaryCompatibility sets the value of SalaryCompatibility. +func (s *MatchAppliedConditions) SetSalaryCompatibility(val NilCandidateSalaryCompatibility) { + s.SalaryCompatibility = val +} + +// A normalized response snapshot of the bank filters. Each key is present; null means the +// corresponding request filter was omitted. This keeps a search result tied to its exact filter basis. +// Ref: #/components/schemas/MatchAppliedFilters +type MatchAppliedFilters struct { + Specialization NilSpecializationCode `json:"specialization"` + ConfirmedGrade NilGradeCode `json:"confirmed_grade"` + ConfirmedCategory NilMatchGradeFilter `json:"confirmed_category"` + ConfirmationStatus NilMatchConfirmationStatus `json:"confirmation_status"` + DeclaredGrade NilGradeCode `json:"declared_grade"` + Stack []MatchSearchStackTag `json:"stack"` + Conditions NilMatchAppliedConditions `json:"conditions"` +} + +// GetSpecialization returns the value of Specialization. +func (s *MatchAppliedFilters) GetSpecialization() NilSpecializationCode { + return s.Specialization +} + +// GetConfirmedGrade returns the value of ConfirmedGrade. +func (s *MatchAppliedFilters) GetConfirmedGrade() NilGradeCode { + return s.ConfirmedGrade +} + +// GetConfirmedCategory returns the value of ConfirmedCategory. +func (s *MatchAppliedFilters) GetConfirmedCategory() NilMatchGradeFilter { + return s.ConfirmedCategory +} + +// GetConfirmationStatus returns the value of ConfirmationStatus. +func (s *MatchAppliedFilters) GetConfirmationStatus() NilMatchConfirmationStatus { + return s.ConfirmationStatus +} + +// GetDeclaredGrade returns the value of DeclaredGrade. +func (s *MatchAppliedFilters) GetDeclaredGrade() NilGradeCode { + return s.DeclaredGrade +} + +// GetStack returns the value of Stack. +func (s *MatchAppliedFilters) GetStack() []MatchSearchStackTag { + return s.Stack +} + +// GetConditions returns the value of Conditions. +func (s *MatchAppliedFilters) GetConditions() NilMatchAppliedConditions { + return s.Conditions +} + +// SetSpecialization sets the value of Specialization. +func (s *MatchAppliedFilters) SetSpecialization(val NilSpecializationCode) { + s.Specialization = val +} + +// SetConfirmedGrade sets the value of ConfirmedGrade. +func (s *MatchAppliedFilters) SetConfirmedGrade(val NilGradeCode) { + s.ConfirmedGrade = val +} + +// SetConfirmedCategory sets the value of ConfirmedCategory. +func (s *MatchAppliedFilters) SetConfirmedCategory(val NilMatchGradeFilter) { + s.ConfirmedCategory = val +} + +// SetConfirmationStatus sets the value of ConfirmationStatus. +func (s *MatchAppliedFilters) SetConfirmationStatus(val NilMatchConfirmationStatus) { + s.ConfirmationStatus = val +} + +// SetDeclaredGrade sets the value of DeclaredGrade. +func (s *MatchAppliedFilters) SetDeclaredGrade(val NilGradeCode) { + s.DeclaredGrade = val +} + +// SetStack sets the value of Stack. +func (s *MatchAppliedFilters) SetStack(val []MatchSearchStackTag) { + s.Stack = val +} + +// SetConditions sets the value of Conditions. +func (s *MatchAppliedFilters) SetConditions(val NilMatchAppliedConditions) { + s.Conditions = val +} + +// A confirmed category. Its specialization must equal the enclosing match entry's specialization. +// Ref: #/components/schemas/MatchCategory +type MatchCategory struct { + Specialization SpecializationCode `json:"specialization"` + Grade GradeCode `json:"grade"` +} + +// GetSpecialization returns the value of Specialization. +func (s *MatchCategory) GetSpecialization() SpecializationCode { + return s.Specialization +} + +// GetGrade returns the value of Grade. +func (s *MatchCategory) GetGrade() GradeCode { + return s.Grade +} + +// SetSpecialization sets the value of Specialization. +func (s *MatchCategory) SetSpecialization(val SpecializationCode) { + s.Specialization = val +} + +// SetGrade sets the value of Grade. +func (s *MatchCategory) SetGrade(val GradeCode) { + s.Grade = val +} + +// Confirmation state for this specialization only. A result for one specialization never changes the +// state of another specialization. +// Ref: #/components/schemas/MatchConfirmationStatus +type MatchConfirmationStatus string + +const ( + MatchConfirmationStatusConfirmed MatchConfirmationStatus = "confirmed" + MatchConfirmationStatusUnconfirmed MatchConfirmationStatus = "unconfirmed" +) + +// AllValues returns all MatchConfirmationStatus values. +func (MatchConfirmationStatus) AllValues() []MatchConfirmationStatus { + return []MatchConfirmationStatus{ + MatchConfirmationStatusConfirmed, + MatchConfirmationStatusUnconfirmed, + } +} + +// MarshalText implements encoding.TextMarshaler. +func (s MatchConfirmationStatus) MarshalText() ([]byte, error) { + switch s { + case MatchConfirmationStatusConfirmed: + return []byte(s), nil + case MatchConfirmationStatusUnconfirmed: + return []byte(s), nil + default: + return nil, errors.Errorf("invalid value: %q", s) + } +} + +// UnmarshalText implements encoding.TextUnmarshaler. +func (s *MatchConfirmationStatus) UnmarshalText(data []byte) error { + switch MatchConfirmationStatus(data) { + case MatchConfirmationStatusConfirmed: + *s = MatchConfirmationStatusConfirmed + return nil + case MatchConfirmationStatusUnconfirmed: + *s = MatchConfirmationStatusUnconfirmed + return nil + default: + return errors.Errorf("invalid value: %q", data) + } +} + +// One confirmed specialization entry in the `main` or `near` group. The group containing it supplies +// the group label. A candidate may have a separate entry for another specialization. +// Ref: #/components/schemas/MatchConfirmedCandidate +type MatchConfirmedCandidate struct { + CandidateHandle CandidateHandle `json:"candidate_handle"` + Specialization SpecializationCode `json:"specialization"` + ConfirmationStatus MatchConfirmedCandidateConfirmationStatus `json:"confirmation_status"` + // Candidate-declared grade for this specialization, never a confirmation. + DeclaredGrade NilGradeCode `json:"declared_grade"` + Category MatchCategory `json:"category"` + Strength MatchStrength `json:"strength"` + PublicContext MatchPublicContext `json:"public_context"` + EvidenceSummary MatchEvidenceSummary `json:"evidence_summary"` + Components MatchConfirmedComponents `json:"components"` + UnknownFlags MatchUnknownFlags `json:"unknown_flags"` +} + +// GetCandidateHandle returns the value of CandidateHandle. +func (s *MatchConfirmedCandidate) GetCandidateHandle() CandidateHandle { + return s.CandidateHandle +} + +// GetSpecialization returns the value of Specialization. +func (s *MatchConfirmedCandidate) GetSpecialization() SpecializationCode { + return s.Specialization +} + +// GetConfirmationStatus returns the value of ConfirmationStatus. +func (s *MatchConfirmedCandidate) GetConfirmationStatus() MatchConfirmedCandidateConfirmationStatus { + return s.ConfirmationStatus +} + +// GetDeclaredGrade returns the value of DeclaredGrade. +func (s *MatchConfirmedCandidate) GetDeclaredGrade() NilGradeCode { + return s.DeclaredGrade +} + +// GetCategory returns the value of Category. +func (s *MatchConfirmedCandidate) GetCategory() MatchCategory { + return s.Category +} + +// GetStrength returns the value of Strength. +func (s *MatchConfirmedCandidate) GetStrength() MatchStrength { + return s.Strength +} + +// GetPublicContext returns the value of PublicContext. +func (s *MatchConfirmedCandidate) GetPublicContext() MatchPublicContext { + return s.PublicContext +} + +// GetEvidenceSummary returns the value of EvidenceSummary. +func (s *MatchConfirmedCandidate) GetEvidenceSummary() MatchEvidenceSummary { + return s.EvidenceSummary +} + +// GetComponents returns the value of Components. +func (s *MatchConfirmedCandidate) GetComponents() MatchConfirmedComponents { + return s.Components +} + +// GetUnknownFlags returns the value of UnknownFlags. +func (s *MatchConfirmedCandidate) GetUnknownFlags() MatchUnknownFlags { + return s.UnknownFlags +} + +// SetCandidateHandle sets the value of CandidateHandle. +func (s *MatchConfirmedCandidate) SetCandidateHandle(val CandidateHandle) { + s.CandidateHandle = val +} + +// SetSpecialization sets the value of Specialization. +func (s *MatchConfirmedCandidate) SetSpecialization(val SpecializationCode) { + s.Specialization = val +} + +// SetConfirmationStatus sets the value of ConfirmationStatus. +func (s *MatchConfirmedCandidate) SetConfirmationStatus(val MatchConfirmedCandidateConfirmationStatus) { + s.ConfirmationStatus = val +} + +// SetDeclaredGrade sets the value of DeclaredGrade. +func (s *MatchConfirmedCandidate) SetDeclaredGrade(val NilGradeCode) { + s.DeclaredGrade = val +} + +// SetCategory sets the value of Category. +func (s *MatchConfirmedCandidate) SetCategory(val MatchCategory) { + s.Category = val +} + +// SetStrength sets the value of Strength. +func (s *MatchConfirmedCandidate) SetStrength(val MatchStrength) { + s.Strength = val +} + +// SetPublicContext sets the value of PublicContext. +func (s *MatchConfirmedCandidate) SetPublicContext(val MatchPublicContext) { + s.PublicContext = val +} + +// SetEvidenceSummary sets the value of EvidenceSummary. +func (s *MatchConfirmedCandidate) SetEvidenceSummary(val MatchEvidenceSummary) { + s.EvidenceSummary = val +} + +// SetComponents sets the value of Components. +func (s *MatchConfirmedCandidate) SetComponents(val MatchConfirmedComponents) { + s.Components = val +} + +// SetUnknownFlags sets the value of UnknownFlags. +func (s *MatchConfirmedCandidate) SetUnknownFlags(val MatchUnknownFlags) { + s.UnknownFlags = val +} + +type MatchConfirmedCandidateConfirmationStatus string + +const ( + MatchConfirmedCandidateConfirmationStatusConfirmed MatchConfirmedCandidateConfirmationStatus = "confirmed" +) + +// AllValues returns all MatchConfirmedCandidateConfirmationStatus values. +func (MatchConfirmedCandidateConfirmationStatus) AllValues() []MatchConfirmedCandidateConfirmationStatus { + return []MatchConfirmedCandidateConfirmationStatus{ + MatchConfirmedCandidateConfirmationStatusConfirmed, + } +} + +// MarshalText implements encoding.TextMarshaler. +func (s MatchConfirmedCandidateConfirmationStatus) MarshalText() ([]byte, error) { + switch s { + case MatchConfirmedCandidateConfirmationStatusConfirmed: + return []byte(s), nil + default: + return nil, errors.Errorf("invalid value: %q", s) + } +} + +// UnmarshalText implements encoding.TextUnmarshaler. +func (s *MatchConfirmedCandidateConfirmationStatus) UnmarshalText(data []byte) error { + switch MatchConfirmedCandidateConfirmationStatus(data) { + case MatchConfirmedCandidateConfirmationStatusConfirmed: + *s = MatchConfirmedCandidateConfirmationStatusConfirmed + return nil + default: + return errors.Errorf("invalid value: %q", data) + } +} + +// Components from the FR09 ranking model for a confirmed category. `percentile` is null when fewer +// than 30 comparable real candidates are available; the ranking uses neutral T = 0.5 and does not +// publish a percentile. If ML is unavailable, `semantics` uses neutral 0.5 and the reason appears in +// `unknown_flags`. +// Ref: #/components/schemas/MatchConfirmedComponents +type MatchConfirmedComponents struct { + Fit MatchScore `json:"fit"` + Coverage MatchScore `json:"coverage"` + Domain MatchScore `json:"domain"` + Semantics MatchScore `json:"semantics"` + Percentile NilFloat64 `json:"percentile"` + Competition MatchScore `json:"competition"` + Freshness MatchScore `json:"freshness"` + Responsiveness MatchScore `json:"responsiveness"` + RankScore MatchScore `json:"rank_score"` +} + +// GetFit returns the value of Fit. +func (s *MatchConfirmedComponents) GetFit() MatchScore { + return s.Fit +} + +// GetCoverage returns the value of Coverage. +func (s *MatchConfirmedComponents) GetCoverage() MatchScore { + return s.Coverage +} + +// GetDomain returns the value of Domain. +func (s *MatchConfirmedComponents) GetDomain() MatchScore { + return s.Domain +} + +// GetSemantics returns the value of Semantics. +func (s *MatchConfirmedComponents) GetSemantics() MatchScore { + return s.Semantics +} + +// GetPercentile returns the value of Percentile. +func (s *MatchConfirmedComponents) GetPercentile() NilFloat64 { + return s.Percentile +} + +// GetCompetition returns the value of Competition. +func (s *MatchConfirmedComponents) GetCompetition() MatchScore { + return s.Competition +} + +// GetFreshness returns the value of Freshness. +func (s *MatchConfirmedComponents) GetFreshness() MatchScore { + return s.Freshness +} + +// GetResponsiveness returns the value of Responsiveness. +func (s *MatchConfirmedComponents) GetResponsiveness() MatchScore { + return s.Responsiveness +} + +// GetRankScore returns the value of RankScore. +func (s *MatchConfirmedComponents) GetRankScore() MatchScore { + return s.RankScore +} + +// SetFit sets the value of Fit. +func (s *MatchConfirmedComponents) SetFit(val MatchScore) { + s.Fit = val +} + +// SetCoverage sets the value of Coverage. +func (s *MatchConfirmedComponents) SetCoverage(val MatchScore) { + s.Coverage = val +} + +// SetDomain sets the value of Domain. +func (s *MatchConfirmedComponents) SetDomain(val MatchScore) { + s.Domain = val +} + +// SetSemantics sets the value of Semantics. +func (s *MatchConfirmedComponents) SetSemantics(val MatchScore) { + s.Semantics = val +} + +// SetPercentile sets the value of Percentile. +func (s *MatchConfirmedComponents) SetPercentile(val NilFloat64) { + s.Percentile = val +} + +// SetCompetition sets the value of Competition. +func (s *MatchConfirmedComponents) SetCompetition(val MatchScore) { + s.Competition = val +} + +// SetFreshness sets the value of Freshness. +func (s *MatchConfirmedComponents) SetFreshness(val MatchScore) { + s.Freshness = val +} + +// SetResponsiveness sets the value of Responsiveness. +func (s *MatchConfirmedComponents) SetResponsiveness(val MatchScore) { + s.Responsiveness = val +} + +// SetRankScore sets the value of RankScore. +func (s *MatchConfirmedComponents) SetRankScore(val MatchScore) { + s.RankScore = val +} + +// Template code for an explanation derived from allowed evidence. It carries no free text, raw answer, +// or reason for withheld FSP data. +// Ref: #/components/schemas/MatchEvidenceCode +type MatchEvidenceCode string + +const ( + MatchEvidenceCodeConfirmedCategory MatchEvidenceCode = "confirmed_category" + MatchEvidenceCodeRequiredSkillEvidence MatchEvidenceCode = "required_skill_evidence" + MatchEvidenceCodeDesiredSkillEvidence MatchEvidenceCode = "desired_skill_evidence" + MatchEvidenceCodeDomainAlignment MatchEvidenceCode = "domain_alignment" + MatchEvidenceCodeTaskAlignment MatchEvidenceCode = "task_alignment" + MatchEvidenceCodeWorkConditionsMatch MatchEvidenceCode = "work_conditions_match" + MatchEvidenceCodeSalaryCompatibility MatchEvidenceCode = "salary_compatibility" + MatchEvidenceCodeDeclaredGrade MatchEvidenceCode = "declared_grade" +) + +// AllValues returns all MatchEvidenceCode values. +func (MatchEvidenceCode) AllValues() []MatchEvidenceCode { + return []MatchEvidenceCode{ + MatchEvidenceCodeConfirmedCategory, + MatchEvidenceCodeRequiredSkillEvidence, + MatchEvidenceCodeDesiredSkillEvidence, + MatchEvidenceCodeDomainAlignment, + MatchEvidenceCodeTaskAlignment, + MatchEvidenceCodeWorkConditionsMatch, + MatchEvidenceCodeSalaryCompatibility, + MatchEvidenceCodeDeclaredGrade, + } +} + +// MarshalText implements encoding.TextMarshaler. +func (s MatchEvidenceCode) MarshalText() ([]byte, error) { + switch s { + case MatchEvidenceCodeConfirmedCategory: + return []byte(s), nil + case MatchEvidenceCodeRequiredSkillEvidence: + return []byte(s), nil + case MatchEvidenceCodeDesiredSkillEvidence: + return []byte(s), nil + case MatchEvidenceCodeDomainAlignment: + return []byte(s), nil + case MatchEvidenceCodeTaskAlignment: + return []byte(s), nil + case MatchEvidenceCodeWorkConditionsMatch: + return []byte(s), nil + case MatchEvidenceCodeSalaryCompatibility: + return []byte(s), nil + case MatchEvidenceCodeDeclaredGrade: + return []byte(s), nil + default: + return nil, errors.Errorf("invalid value: %q", s) + } +} + +// UnmarshalText implements encoding.TextUnmarshaler. +func (s *MatchEvidenceCode) UnmarshalText(data []byte) error { + switch MatchEvidenceCode(data) { + case MatchEvidenceCodeConfirmedCategory: + *s = MatchEvidenceCodeConfirmedCategory + return nil + case MatchEvidenceCodeRequiredSkillEvidence: + *s = MatchEvidenceCodeRequiredSkillEvidence + return nil + case MatchEvidenceCodeDesiredSkillEvidence: + *s = MatchEvidenceCodeDesiredSkillEvidence + return nil + case MatchEvidenceCodeDomainAlignment: + *s = MatchEvidenceCodeDomainAlignment + return nil + case MatchEvidenceCodeTaskAlignment: + *s = MatchEvidenceCodeTaskAlignment + return nil + case MatchEvidenceCodeWorkConditionsMatch: + *s = MatchEvidenceCodeWorkConditionsMatch + return nil + case MatchEvidenceCodeSalaryCompatibility: + *s = MatchEvidenceCodeSalaryCompatibility + return nil + case MatchEvidenceCodeDeclaredGrade: + *s = MatchEvidenceCodeDeclaredGrade + return nil + default: + return errors.Errorf("invalid value: %q", data) + } +} + +// Ref: #/components/schemas/MatchEvidenceState +type MatchEvidenceState string + +const ( + MatchEvidenceStateSupports MatchEvidenceState = "supports" + MatchEvidenceStatePartial MatchEvidenceState = "partial" + MatchEvidenceStateGap MatchEvidenceState = "gap" + MatchEvidenceStateDeclaredOnly MatchEvidenceState = "declared_only" +) + +// AllValues returns all MatchEvidenceState values. +func (MatchEvidenceState) AllValues() []MatchEvidenceState { + return []MatchEvidenceState{ + MatchEvidenceStateSupports, + MatchEvidenceStatePartial, + MatchEvidenceStateGap, + MatchEvidenceStateDeclaredOnly, + } +} + +// MarshalText implements encoding.TextMarshaler. +func (s MatchEvidenceState) MarshalText() ([]byte, error) { + switch s { + case MatchEvidenceStateSupports: + return []byte(s), nil + case MatchEvidenceStatePartial: + return []byte(s), nil + case MatchEvidenceStateGap: + return []byte(s), nil + case MatchEvidenceStateDeclaredOnly: + return []byte(s), nil + default: + return nil, errors.Errorf("invalid value: %q", s) + } +} + +// UnmarshalText implements encoding.TextUnmarshaler. +func (s *MatchEvidenceState) UnmarshalText(data []byte) error { + switch MatchEvidenceState(data) { + case MatchEvidenceStateSupports: + *s = MatchEvidenceStateSupports + return nil + case MatchEvidenceStatePartial: + *s = MatchEvidenceStatePartial + return nil + case MatchEvidenceStateGap: + *s = MatchEvidenceStateGap + return nil + case MatchEvidenceStateDeclaredOnly: + *s = MatchEvidenceStateDeclaredOnly + return nil + default: + return errors.Errorf("invalid value: %q", data) + } +} + +type MatchEvidenceSummary []MatchEvidenceSummaryItem + +// A templated, non-text evidence explanation. +// Ref: #/components/schemas/MatchEvidenceSummaryItem +type MatchEvidenceSummaryItem struct { + Code MatchEvidenceCode `json:"code"` + State MatchEvidenceState `json:"state"` +} + +// GetCode returns the value of Code. +func (s *MatchEvidenceSummaryItem) GetCode() MatchEvidenceCode { + return s.Code +} + +// GetState returns the value of State. +func (s *MatchEvidenceSummaryItem) GetState() MatchEvidenceState { + return s.State +} + +// SetCode sets the value of Code. +func (s *MatchEvidenceSummaryItem) SetCode(val MatchEvidenceCode) { + s.Code = val +} + +// SetState sets the value of State. +func (s *MatchEvidenceSummaryItem) SetState(val MatchEvidenceState) { + s.State = val +} + +// A confirmed category filter, never a candidate declaration. +// Ref: #/components/schemas/MatchGradeFilter +type MatchGradeFilter struct { + Specialization SpecializationCode `json:"specialization"` + Grade GradeCode `json:"grade"` +} + +// GetSpecialization returns the value of Specialization. +func (s *MatchGradeFilter) GetSpecialization() SpecializationCode { + return s.Specialization +} + +// GetGrade returns the value of Grade. +func (s *MatchGradeFilter) GetGrade() GradeCode { + return s.Grade +} + +// SetSpecialization sets the value of Specialization. +func (s *MatchGradeFilter) SetSpecialization(val SpecializationCode) { + s.Specialization = val +} + +// SetGrade sets the value of Grade. +func (s *MatchGradeFilter) SetGrade(val GradeCode) { + s.Grade = val +} + +// Safe anonymous-card context only. A null value means that the value is not in the public card or is +// not present; the response does not reveal which. It contains no contact, candidate location, or +// salary amount. +// Ref: #/components/schemas/MatchPublicContext +type MatchPublicContext struct { + Stack MatchPublicStack `json:"stack"` + ExperienceBand NilCandidateExperienceBand `json:"experience_band"` + WorkFormats []WorkFormat `json:"work_formats"` + SalaryCompatibility NilCandidateSalaryCompatibility `json:"salary_compatibility"` +} + +// GetStack returns the value of Stack. +func (s *MatchPublicContext) GetStack() MatchPublicStack { + return s.Stack +} + +// GetExperienceBand returns the value of ExperienceBand. +func (s *MatchPublicContext) GetExperienceBand() NilCandidateExperienceBand { + return s.ExperienceBand +} + +// GetWorkFormats returns the value of WorkFormats. +func (s *MatchPublicContext) GetWorkFormats() []WorkFormat { + return s.WorkFormats +} + +// GetSalaryCompatibility returns the value of SalaryCompatibility. +func (s *MatchPublicContext) GetSalaryCompatibility() NilCandidateSalaryCompatibility { + return s.SalaryCompatibility +} + +// SetStack sets the value of Stack. +func (s *MatchPublicContext) SetStack(val MatchPublicStack) { + s.Stack = val +} + +// SetExperienceBand sets the value of ExperienceBand. +func (s *MatchPublicContext) SetExperienceBand(val NilCandidateExperienceBand) { + s.ExperienceBand = val +} + +// SetWorkFormats sets the value of WorkFormats. +func (s *MatchPublicContext) SetWorkFormats(val []WorkFormat) { + s.WorkFormats = val +} + +// SetSalaryCompatibility sets the value of SalaryCompatibility. +func (s *MatchPublicContext) SetSalaryCompatibility(val NilCandidateSalaryCompatibility) { + s.SalaryCompatibility = val +} + +type MatchPublicStack []MatchSearchStackTag + +type MatchScore float64 + +// The normalized filters used for a bank search. +// Ref: #/components/schemas/MatchSearchBankSource +type MatchSearchBankSource struct { + Kind MatchSearchBankSourceKind `json:"kind"` + Filters MatchAppliedFilters `json:"filters"` +} + +// GetKind returns the value of Kind. +func (s *MatchSearchBankSource) GetKind() MatchSearchBankSourceKind { + return s.Kind +} + +// GetFilters returns the value of Filters. +func (s *MatchSearchBankSource) GetFilters() MatchAppliedFilters { + return s.Filters +} + +// SetKind sets the value of Kind. +func (s *MatchSearchBankSource) SetKind(val MatchSearchBankSourceKind) { + s.Kind = val +} + +// SetFilters sets the value of Filters. +func (s *MatchSearchBankSource) SetFilters(val MatchAppliedFilters) { + s.Filters = val +} + +type MatchSearchBankSourceKind string + +const ( + MatchSearchBankSourceKindBank MatchSearchBankSourceKind = "bank" +) + +// AllValues returns all MatchSearchBankSourceKind values. +func (MatchSearchBankSourceKind) AllValues() []MatchSearchBankSourceKind { + return []MatchSearchBankSourceKind{ + MatchSearchBankSourceKindBank, + } +} + +// MarshalText implements encoding.TextMarshaler. +func (s MatchSearchBankSourceKind) MarshalText() ([]byte, error) { + switch s { + case MatchSearchBankSourceKindBank: + return []byte(s), nil + default: + return nil, errors.Errorf("invalid value: %q", s) + } +} + +// UnmarshalText implements encoding.TextUnmarshaler. +func (s *MatchSearchBankSourceKind) UnmarshalText(data []byte) error { + switch MatchSearchBankSourceKind(data) { + case MatchSearchBankSourceKindBank: + *s = MatchSearchBankSourceKindBank + return nil + default: + return errors.Errorf("invalid value: %q", data) + } +} + +// Search the current organization-visible bank. An empty `filters` object includes all otherwise +// eligible specializations as separate entries. +// Ref: #/components/schemas/MatchSearchByBank +type MatchSearchByBank struct { + Filters MatchSearchFilters `json:"filters"` +} + +// GetFilters returns the value of Filters. +func (s *MatchSearchByBank) GetFilters() MatchSearchFilters { + return s.Filters +} + +// SetFilters sets the value of Filters. +func (s *MatchSearchByBank) SetFilters(val MatchSearchFilters) { + s.Filters = val +} + +// Search one immutable set of confirmed requirements. `requirements_version` is the +// Need.requirements_version, not the general Need.version; text-only or suggestion-only edits do not +// change this search basis. +// Ref: #/components/schemas/MatchSearchByNeed +type MatchSearchByNeed struct { + // Need owned by the organization in the path. + NeedID uuid.UUID `json:"need_id"` + RequirementsVersion NeedVersion `json:"requirements_version"` + Filters OptMatchSearchFilters `json:"filters"` +} + +// GetNeedID returns the value of NeedID. +func (s *MatchSearchByNeed) GetNeedID() uuid.UUID { + return s.NeedID +} + +// GetRequirementsVersion returns the value of RequirementsVersion. +func (s *MatchSearchByNeed) GetRequirementsVersion() NeedVersion { + return s.RequirementsVersion +} + +// GetFilters returns the value of Filters. +func (s *MatchSearchByNeed) GetFilters() OptMatchSearchFilters { + return s.Filters +} + +// SetNeedID sets the value of NeedID. +func (s *MatchSearchByNeed) SetNeedID(val uuid.UUID) { + s.NeedID = val +} + +// SetRequirementsVersion sets the value of RequirementsVersion. +func (s *MatchSearchByNeed) SetRequirementsVersion(val NeedVersion) { + s.RequirementsVersion = val +} + +// SetFilters sets the value of Filters. +func (s *MatchSearchByNeed) SetFilters(val OptMatchSearchFilters) { + s.Filters = val +} + +// Filters against safe, coarse card conditions. No candidate location, salary amount, salary minimum, +// or salary range is accepted. +// Ref: #/components/schemas/MatchSearchConditions +type MatchSearchConditions struct { + WorkFormats []WorkFormat `json:"work_formats"` + SalaryCompatibility OptCandidateSalaryCompatibility `json:"salary_compatibility"` +} + +// GetWorkFormats returns the value of WorkFormats. +func (s *MatchSearchConditions) GetWorkFormats() []WorkFormat { + return s.WorkFormats +} + +// GetSalaryCompatibility returns the value of SalaryCompatibility. +func (s *MatchSearchConditions) GetSalaryCompatibility() OptCandidateSalaryCompatibility { + return s.SalaryCompatibility +} + +// SetWorkFormats sets the value of WorkFormats. +func (s *MatchSearchConditions) SetWorkFormats(val []WorkFormat) { + s.WorkFormats = val +} + +// SetSalaryCompatibility sets the value of SalaryCompatibility. +func (s *MatchSearchConditions) SetSalaryCompatibility(val OptCandidateSalaryCompatibility) { + s.SalaryCompatibility = val +} + +// Optional filters over the current organization-visible bank. An empty object means no additional +// filter. Confirmed and declared grades are separate fields; a declaration never satisfies a +// confirmed-grade or category filter. Conditions use only the safe, coarse card fields. +// Ref: #/components/schemas/MatchSearchFilters +type MatchSearchFilters struct { + Specialization OptSpecializationCode `json:"specialization"` + // Match only candidates with this currently confirmed grade in the selected specialization. It never + // matches a declared grade. + ConfirmedGrade OptGradeCode `json:"confirmed_grade"` + ConfirmedCategory OptMatchGradeFilter `json:"confirmed_category"` + ConfirmationStatus OptMatchConfirmationStatus `json:"confirmation_status"` + // Candidate-declared grade filter. This is a separate claim and cannot satisfy `confirmed_grade` or + // `confirmed_category`. + DeclaredGrade OptGradeCode `json:"declared_grade"` + Stack []MatchSearchStackTag `json:"stack"` + Conditions OptMatchSearchConditions `json:"conditions"` +} + +// GetSpecialization returns the value of Specialization. +func (s *MatchSearchFilters) GetSpecialization() OptSpecializationCode { + return s.Specialization +} + +// GetConfirmedGrade returns the value of ConfirmedGrade. +func (s *MatchSearchFilters) GetConfirmedGrade() OptGradeCode { + return s.ConfirmedGrade +} + +// GetConfirmedCategory returns the value of ConfirmedCategory. +func (s *MatchSearchFilters) GetConfirmedCategory() OptMatchGradeFilter { + return s.ConfirmedCategory +} + +// GetConfirmationStatus returns the value of ConfirmationStatus. +func (s *MatchSearchFilters) GetConfirmationStatus() OptMatchConfirmationStatus { + return s.ConfirmationStatus +} + +// GetDeclaredGrade returns the value of DeclaredGrade. +func (s *MatchSearchFilters) GetDeclaredGrade() OptGradeCode { + return s.DeclaredGrade +} + +// GetStack returns the value of Stack. +func (s *MatchSearchFilters) GetStack() []MatchSearchStackTag { + return s.Stack +} + +// GetConditions returns the value of Conditions. +func (s *MatchSearchFilters) GetConditions() OptMatchSearchConditions { + return s.Conditions +} + +// SetSpecialization sets the value of Specialization. +func (s *MatchSearchFilters) SetSpecialization(val OptSpecializationCode) { + s.Specialization = val +} + +// SetConfirmedGrade sets the value of ConfirmedGrade. +func (s *MatchSearchFilters) SetConfirmedGrade(val OptGradeCode) { + s.ConfirmedGrade = val +} + +// SetConfirmedCategory sets the value of ConfirmedCategory. +func (s *MatchSearchFilters) SetConfirmedCategory(val OptMatchGradeFilter) { + s.ConfirmedCategory = val +} + +// SetConfirmationStatus sets the value of ConfirmationStatus. +func (s *MatchSearchFilters) SetConfirmationStatus(val OptMatchConfirmationStatus) { + s.ConfirmationStatus = val +} + +// SetDeclaredGrade sets the value of DeclaredGrade. +func (s *MatchSearchFilters) SetDeclaredGrade(val OptGradeCode) { + s.DeclaredGrade = val +} + +// SetStack sets the value of Stack. +func (s *MatchSearchFilters) SetStack(val []MatchSearchStackTag) { + s.Stack = val +} + +// SetConditions sets the value of Conditions. +func (s *MatchSearchFilters) SetConditions(val OptMatchSearchConditions) { + s.Conditions = val +} + +// Separate ranking groups. Confirmed categories appear in main and near; unconfirmed specializations +// appear only in the lower unconfirmed group. +// Ref: #/components/schemas/MatchSearchGroups +type MatchSearchGroups struct { + Main []MatchConfirmedCandidate `json:"main"` + Near []MatchConfirmedCandidate `json:"near"` + Unconfirmed []MatchUnconfirmedCandidate `json:"unconfirmed"` +} + +// GetMain returns the value of Main. +func (s *MatchSearchGroups) GetMain() []MatchConfirmedCandidate { + return s.Main +} + +// GetNear returns the value of Near. +func (s *MatchSearchGroups) GetNear() []MatchConfirmedCandidate { + return s.Near +} + +// GetUnconfirmed returns the value of Unconfirmed. +func (s *MatchSearchGroups) GetUnconfirmed() []MatchUnconfirmedCandidate { + return s.Unconfirmed +} + +// SetMain sets the value of Main. +func (s *MatchSearchGroups) SetMain(val []MatchConfirmedCandidate) { + s.Main = val +} + +// SetNear sets the value of Near. +func (s *MatchSearchGroups) SetNear(val []MatchConfirmedCandidate) { + s.Near = val +} + +// SetUnconfirmed sets the value of Unconfirmed. +func (s *MatchSearchGroups) SetUnconfirmed(val []MatchUnconfirmedCandidate) { + s.Unconfirmed = val +} + +// The immutable need requirements snapshot used by this result. +// Ref: #/components/schemas/MatchSearchNeedSource +type MatchSearchNeedSource struct { + Kind MatchSearchNeedSourceKind `json:"kind"` + NeedID uuid.UUID `json:"need_id"` + RequirementsVersion NeedVersion `json:"requirements_version"` +} + +// GetKind returns the value of Kind. +func (s *MatchSearchNeedSource) GetKind() MatchSearchNeedSourceKind { + return s.Kind +} + +// GetNeedID returns the value of NeedID. +func (s *MatchSearchNeedSource) GetNeedID() uuid.UUID { + return s.NeedID +} + +// GetRequirementsVersion returns the value of RequirementsVersion. +func (s *MatchSearchNeedSource) GetRequirementsVersion() NeedVersion { + return s.RequirementsVersion +} + +// SetKind sets the value of Kind. +func (s *MatchSearchNeedSource) SetKind(val MatchSearchNeedSourceKind) { + s.Kind = val +} + +// SetNeedID sets the value of NeedID. +func (s *MatchSearchNeedSource) SetNeedID(val uuid.UUID) { + s.NeedID = val +} + +// SetRequirementsVersion sets the value of RequirementsVersion. +func (s *MatchSearchNeedSource) SetRequirementsVersion(val NeedVersion) { + s.RequirementsVersion = val +} + +type MatchSearchNeedSourceKind string + +const ( + MatchSearchNeedSourceKindNeed MatchSearchNeedSourceKind = "need" +) + +// AllValues returns all MatchSearchNeedSourceKind values. +func (MatchSearchNeedSourceKind) AllValues() []MatchSearchNeedSourceKind { + return []MatchSearchNeedSourceKind{ + MatchSearchNeedSourceKindNeed, + } +} + +// MarshalText implements encoding.TextMarshaler. +func (s MatchSearchNeedSourceKind) MarshalText() ([]byte, error) { + switch s { + case MatchSearchNeedSourceKindNeed: + return []byte(s), nil + default: + return nil, errors.Errorf("invalid value: %q", s) + } +} + +// UnmarshalText implements encoding.TextUnmarshaler. +func (s *MatchSearchNeedSourceKind) UnmarshalText(data []byte) error { + switch MatchSearchNeedSourceKind(data) { + case MatchSearchNeedSourceKindNeed: + *s = MatchSearchNeedSourceKindNeed + return nil + default: + return errors.Errorf("invalid value: %q", data) + } +} + +// Search either a Need.requirements_version snapshot or the whole organization-visible bank with +// explicit filters. Unknown fields are rejected by both closed request variants. +// Ref: #/components/schemas/MatchSearchRequest +// MatchSearchRequest represents sum type. +type MatchSearchRequest struct { + // Type selects the active sum variant, switch on this field. + Type MatchSearchRequestType + MatchSearchByNeed MatchSearchByNeed + MatchSearchByBank MatchSearchByBank +} + +// MatchSearchRequestType is oneOf type of MatchSearchRequest. +type MatchSearchRequestType string + +// Possible values for MatchSearchRequestType. +const ( + MatchSearchByNeedMatchSearchRequest MatchSearchRequestType = "MatchSearchByNeed" + MatchSearchByBankMatchSearchRequest MatchSearchRequestType = "MatchSearchByBank" +) + +// IsMatchSearchByNeed reports whether MatchSearchRequest is MatchSearchByNeed. +func (s MatchSearchRequest) IsMatchSearchByNeed() bool { + return s.Type == MatchSearchByNeedMatchSearchRequest +} + +// IsMatchSearchByBank reports whether MatchSearchRequest is MatchSearchByBank. +func (s MatchSearchRequest) IsMatchSearchByBank() bool { + return s.Type == MatchSearchByBankMatchSearchRequest +} + +// SetMatchSearchByNeed sets MatchSearchRequest to MatchSearchByNeed. +func (s *MatchSearchRequest) SetMatchSearchByNeed(v MatchSearchByNeed) { + s.Type = MatchSearchByNeedMatchSearchRequest + s.MatchSearchByNeed = v +} + +// GetMatchSearchByNeed returns MatchSearchByNeed and true boolean if MatchSearchRequest is MatchSearchByNeed. +func (s MatchSearchRequest) GetMatchSearchByNeed() (v MatchSearchByNeed, ok bool) { + if !s.IsMatchSearchByNeed() { + return v, false + } + return s.MatchSearchByNeed, true +} + +// NewMatchSearchByNeedMatchSearchRequest returns new MatchSearchRequest from MatchSearchByNeed. +func NewMatchSearchByNeedMatchSearchRequest(v MatchSearchByNeed) MatchSearchRequest { + var s MatchSearchRequest + s.SetMatchSearchByNeed(v) + return s +} + +// SetMatchSearchByBank sets MatchSearchRequest to MatchSearchByBank. +func (s *MatchSearchRequest) SetMatchSearchByBank(v MatchSearchByBank) { + s.Type = MatchSearchByBankMatchSearchRequest + s.MatchSearchByBank = v +} + +// GetMatchSearchByBank returns MatchSearchByBank and true boolean if MatchSearchRequest is MatchSearchByBank. +func (s MatchSearchRequest) GetMatchSearchByBank() (v MatchSearchByBank, ok bool) { + if !s.IsMatchSearchByBank() { + return v, false + } + return s.MatchSearchByBank, true +} + +// NewMatchSearchByBankMatchSearchRequest returns new MatchSearchRequest from MatchSearchByBank. +func NewMatchSearchByBankMatchSearchRequest(v MatchSearchByBank) MatchSearchRequest { + var s MatchSearchRequest + s.SetMatchSearchByBank(v) + return s +} + +// Anonymous search result grouped by specialization state. Repeated organization-scoped handles are +// allowed when the same candidate has different specialization entries; entries never transfer +// confirmation between specializations. +// Ref: #/components/schemas/MatchSearchResponse +type MatchSearchResponse struct { + Source MatchSearchSource `json:"source"` + Groups MatchSearchGroups `json:"groups"` +} + +// GetSource returns the value of Source. +func (s *MatchSearchResponse) GetSource() MatchSearchSource { + return s.Source +} + +// GetGroups returns the value of Groups. +func (s *MatchSearchResponse) GetGroups() MatchSearchGroups { + return s.Groups +} + +// SetSource sets the value of Source. +func (s *MatchSearchResponse) SetSource(val MatchSearchSource) { + s.Source = val +} + +// SetGroups sets the value of Groups. +func (s *MatchSearchResponse) SetGroups(val MatchSearchGroups) { + s.Groups = val +} + +// MatchSearchResponseHeaders wraps MatchSearchResponse with response headers. +type MatchSearchResponseHeaders struct { + CacheControl CacheControlNoStore + Response MatchSearchResponse +} + +// GetCacheControl returns the value of CacheControl. +func (s *MatchSearchResponseHeaders) GetCacheControl() CacheControlNoStore { + return s.CacheControl +} + +// GetResponse returns the value of Response. +func (s *MatchSearchResponseHeaders) GetResponse() MatchSearchResponse { + return s.Response +} + +// SetCacheControl sets the value of CacheControl. +func (s *MatchSearchResponseHeaders) SetCacheControl(val CacheControlNoStore) { + s.CacheControl = val +} + +// SetResponse sets the value of Response. +func (s *MatchSearchResponseHeaders) SetResponse(val MatchSearchResponse) { + s.Response = val +} + +func (*MatchSearchResponseHeaders) searchOrganizationMatchesRes() {} + +// Search basis echoed with the response so the displayed result remains tied to its need requirements +// version or bank filters. +// Ref: #/components/schemas/MatchSearchSource +// MatchSearchSource represents sum type. +type MatchSearchSource struct { + // Type selects the active sum variant, switch on this field. + Type MatchSearchSourceType + MatchSearchNeedSource MatchSearchNeedSource + MatchSearchBankSource MatchSearchBankSource +} + +// MatchSearchSourceType is oneOf type of MatchSearchSource. +type MatchSearchSourceType string + +// Possible values for MatchSearchSourceType. +const ( + MatchSearchNeedSourceMatchSearchSource MatchSearchSourceType = "MatchSearchNeedSource" + MatchSearchBankSourceMatchSearchSource MatchSearchSourceType = "MatchSearchBankSource" +) + +// IsMatchSearchNeedSource reports whether MatchSearchSource is MatchSearchNeedSource. +func (s MatchSearchSource) IsMatchSearchNeedSource() bool { + return s.Type == MatchSearchNeedSourceMatchSearchSource +} + +// IsMatchSearchBankSource reports whether MatchSearchSource is MatchSearchBankSource. +func (s MatchSearchSource) IsMatchSearchBankSource() bool { + return s.Type == MatchSearchBankSourceMatchSearchSource +} + +// SetMatchSearchNeedSource sets MatchSearchSource to MatchSearchNeedSource. +func (s *MatchSearchSource) SetMatchSearchNeedSource(v MatchSearchNeedSource) { + s.Type = MatchSearchNeedSourceMatchSearchSource + s.MatchSearchNeedSource = v +} + +// GetMatchSearchNeedSource returns MatchSearchNeedSource and true boolean if MatchSearchSource is MatchSearchNeedSource. +func (s MatchSearchSource) GetMatchSearchNeedSource() (v MatchSearchNeedSource, ok bool) { + if !s.IsMatchSearchNeedSource() { + return v, false + } + return s.MatchSearchNeedSource, true +} + +// NewMatchSearchNeedSourceMatchSearchSource returns new MatchSearchSource from MatchSearchNeedSource. +func NewMatchSearchNeedSourceMatchSearchSource(v MatchSearchNeedSource) MatchSearchSource { + var s MatchSearchSource + s.SetMatchSearchNeedSource(v) + return s +} + +// SetMatchSearchBankSource sets MatchSearchSource to MatchSearchBankSource. +func (s *MatchSearchSource) SetMatchSearchBankSource(v MatchSearchBankSource) { + s.Type = MatchSearchBankSourceMatchSearchSource + s.MatchSearchBankSource = v +} + +// GetMatchSearchBankSource returns MatchSearchBankSource and true boolean if MatchSearchSource is MatchSearchBankSource. +func (s MatchSearchSource) GetMatchSearchBankSource() (v MatchSearchBankSource, ok bool) { + if !s.IsMatchSearchBankSource() { + return v, false + } + return s.MatchSearchBankSource, true +} + +// NewMatchSearchBankSourceMatchSearchSource returns new MatchSearchSource from MatchSearchBankSource. +func NewMatchSearchBankSourceMatchSearchSource(v MatchSearchBankSource) MatchSearchSource { + var s MatchSearchSource + s.SetMatchSearchBankSource(v) + return s +} + +// A stack code that the anonymous card may expose. Search filters do not accept arbitrary profile text +// or candidate-provided evidence. +// Ref: #/components/schemas/MatchSearchStackTag +type MatchSearchStackTag string + +const ( + MatchSearchStackTagGo MatchSearchStackTag = "go" + MatchSearchStackTagPostgresql MatchSearchStackTag = "postgresql" + MatchSearchStackTagKafka MatchSearchStackTag = "kafka" + MatchSearchStackTagDocker MatchSearchStackTag = "docker" +) + +// AllValues returns all MatchSearchStackTag values. +func (MatchSearchStackTag) AllValues() []MatchSearchStackTag { + return []MatchSearchStackTag{ + MatchSearchStackTagGo, + MatchSearchStackTagPostgresql, + MatchSearchStackTagKafka, + MatchSearchStackTagDocker, + } +} + +// MarshalText implements encoding.TextMarshaler. +func (s MatchSearchStackTag) MarshalText() ([]byte, error) { + switch s { + case MatchSearchStackTagGo: + return []byte(s), nil + case MatchSearchStackTagPostgresql: + return []byte(s), nil + case MatchSearchStackTagKafka: + return []byte(s), nil + case MatchSearchStackTagDocker: + return []byte(s), nil + default: + return nil, errors.Errorf("invalid value: %q", s) + } +} + +// UnmarshalText implements encoding.TextUnmarshaler. +func (s *MatchSearchStackTag) UnmarshalText(data []byte) error { + switch MatchSearchStackTag(data) { + case MatchSearchStackTagGo: + *s = MatchSearchStackTagGo + return nil + case MatchSearchStackTagPostgresql: + *s = MatchSearchStackTagPostgresql + return nil + case MatchSearchStackTagKafka: + *s = MatchSearchStackTagKafka + return nil + case MatchSearchStackTagDocker: + *s = MatchSearchStackTagDocker + return nil + default: + return errors.Errorf("invalid value: %q", data) + } +} + +// Coarse strength of a confirmed assessment for this specialization. +// Ref: #/components/schemas/MatchStrength +type MatchStrength string + +const ( + MatchStrengthStandard MatchStrength = "standard" + MatchStrengthStrong MatchStrength = "strong" +) + +// AllValues returns all MatchStrength values. +func (MatchStrength) AllValues() []MatchStrength { + return []MatchStrength{ + MatchStrengthStandard, + MatchStrengthStrong, + } +} + +// MarshalText implements encoding.TextMarshaler. +func (s MatchStrength) MarshalText() ([]byte, error) { + switch s { + case MatchStrengthStandard: + return []byte(s), nil + case MatchStrengthStrong: + return []byte(s), nil + default: + return nil, errors.Errorf("invalid value: %q", s) + } +} + +// UnmarshalText implements encoding.TextUnmarshaler. +func (s *MatchStrength) UnmarshalText(data []byte) error { + switch MatchStrength(data) { + case MatchStrengthStandard: + *s = MatchStrengthStandard + return nil + case MatchStrengthStrong: + *s = MatchStrengthStrong + return nil + default: + return errors.Errorf("invalid value: %q", data) + } +} + +// One specialization with no confirmed category. `category` and `strength` remain present and null. A +// confirmation in another specialization never changes this entry. The schema intentionally has no +// assessment measurement fields. +// Ref: #/components/schemas/MatchUnconfirmedCandidate +type MatchUnconfirmedCandidate struct { + CandidateHandle CandidateHandle `json:"candidate_handle"` + Specialization SpecializationCode `json:"specialization"` + ConfirmationStatus MatchUnconfirmedCandidateConfirmationStatus `json:"confirmation_status"` + // Candidate-declared grade, separate from assessment confirmation. + DeclaredGrade NilGradeCode `json:"declared_grade"` + // There is no confirmed category for this specialization. + Category struct{} `json:"category"` + // Assessment strength is not measured for this specialization. + Strength struct{} `json:"strength"` + PublicContext MatchPublicContext `json:"public_context"` + EvidenceSummary MatchEvidenceSummary `json:"evidence_summary"` + Components MatchUnconfirmedComponents `json:"components"` + UnknownFlags MatchUnknownFlags `json:"unknown_flags"` +} + +// GetCandidateHandle returns the value of CandidateHandle. +func (s *MatchUnconfirmedCandidate) GetCandidateHandle() CandidateHandle { + return s.CandidateHandle +} + +// GetSpecialization returns the value of Specialization. +func (s *MatchUnconfirmedCandidate) GetSpecialization() SpecializationCode { + return s.Specialization +} + +// GetConfirmationStatus returns the value of ConfirmationStatus. +func (s *MatchUnconfirmedCandidate) GetConfirmationStatus() MatchUnconfirmedCandidateConfirmationStatus { + return s.ConfirmationStatus +} + +// GetDeclaredGrade returns the value of DeclaredGrade. +func (s *MatchUnconfirmedCandidate) GetDeclaredGrade() NilGradeCode { + return s.DeclaredGrade +} + +// GetCategory returns the value of Category. +func (s *MatchUnconfirmedCandidate) GetCategory() struct{} { + return s.Category +} + +// GetStrength returns the value of Strength. +func (s *MatchUnconfirmedCandidate) GetStrength() struct{} { + return s.Strength +} + +// GetPublicContext returns the value of PublicContext. +func (s *MatchUnconfirmedCandidate) GetPublicContext() MatchPublicContext { + return s.PublicContext +} + +// GetEvidenceSummary returns the value of EvidenceSummary. +func (s *MatchUnconfirmedCandidate) GetEvidenceSummary() MatchEvidenceSummary { + return s.EvidenceSummary +} + +// GetComponents returns the value of Components. +func (s *MatchUnconfirmedCandidate) GetComponents() MatchUnconfirmedComponents { + return s.Components +} + +// GetUnknownFlags returns the value of UnknownFlags. +func (s *MatchUnconfirmedCandidate) GetUnknownFlags() MatchUnknownFlags { + return s.UnknownFlags +} + +// SetCandidateHandle sets the value of CandidateHandle. +func (s *MatchUnconfirmedCandidate) SetCandidateHandle(val CandidateHandle) { + s.CandidateHandle = val +} + +// SetSpecialization sets the value of Specialization. +func (s *MatchUnconfirmedCandidate) SetSpecialization(val SpecializationCode) { + s.Specialization = val +} + +// SetConfirmationStatus sets the value of ConfirmationStatus. +func (s *MatchUnconfirmedCandidate) SetConfirmationStatus(val MatchUnconfirmedCandidateConfirmationStatus) { + s.ConfirmationStatus = val +} + +// SetDeclaredGrade sets the value of DeclaredGrade. +func (s *MatchUnconfirmedCandidate) SetDeclaredGrade(val NilGradeCode) { + s.DeclaredGrade = val +} + +// SetCategory sets the value of Category. +func (s *MatchUnconfirmedCandidate) SetCategory(val struct{}) { + s.Category = val +} + +// SetStrength sets the value of Strength. +func (s *MatchUnconfirmedCandidate) SetStrength(val struct{}) { + s.Strength = val +} + +// SetPublicContext sets the value of PublicContext. +func (s *MatchUnconfirmedCandidate) SetPublicContext(val MatchPublicContext) { + s.PublicContext = val +} + +// SetEvidenceSummary sets the value of EvidenceSummary. +func (s *MatchUnconfirmedCandidate) SetEvidenceSummary(val MatchEvidenceSummary) { + s.EvidenceSummary = val +} + +// SetComponents sets the value of Components. +func (s *MatchUnconfirmedCandidate) SetComponents(val MatchUnconfirmedComponents) { + s.Components = val +} + +// SetUnknownFlags sets the value of UnknownFlags. +func (s *MatchUnconfirmedCandidate) SetUnknownFlags(val MatchUnknownFlags) { + s.UnknownFlags = val +} + +type MatchUnconfirmedCandidateConfirmationStatus string + +const ( + MatchUnconfirmedCandidateConfirmationStatusUnconfirmed MatchUnconfirmedCandidateConfirmationStatus = "unconfirmed" +) + +// AllValues returns all MatchUnconfirmedCandidateConfirmationStatus values. +func (MatchUnconfirmedCandidateConfirmationStatus) AllValues() []MatchUnconfirmedCandidateConfirmationStatus { + return []MatchUnconfirmedCandidateConfirmationStatus{ + MatchUnconfirmedCandidateConfirmationStatusUnconfirmed, + } +} + +// MarshalText implements encoding.TextMarshaler. +func (s MatchUnconfirmedCandidateConfirmationStatus) MarshalText() ([]byte, error) { + switch s { + case MatchUnconfirmedCandidateConfirmationStatusUnconfirmed: + return []byte(s), nil + default: + return nil, errors.Errorf("invalid value: %q", s) + } +} + +// UnmarshalText implements encoding.TextUnmarshaler. +func (s *MatchUnconfirmedCandidateConfirmationStatus) UnmarshalText(data []byte) error { + switch MatchUnconfirmedCandidateConfirmationStatus(data) { + case MatchUnconfirmedCandidateConfirmationStatusUnconfirmed: + *s = MatchUnconfirmedCandidateConfirmationStatusUnconfirmed + return nil + default: + return errors.Errorf("invalid value: %q", data) + } +} + +// Unconfirmed entries are ordered only by Fit and coverage. This strict component object has no theta, +// T, P, test percentile, or confirmed assessment score. +// Ref: #/components/schemas/MatchUnconfirmedComponents +type MatchUnconfirmedComponents struct { + // Job fit for this specialization, never an assessment score. + Fit float64 `json:"fit"` + // Coverage of confirmed need skills by allowed public evidence. + Coverage float64 `json:"coverage"` +} + +// GetFit returns the value of Fit. +func (s *MatchUnconfirmedComponents) GetFit() float64 { + return s.Fit +} + +// GetCoverage returns the value of Coverage. +func (s *MatchUnconfirmedComponents) GetCoverage() float64 { + return s.Coverage +} + +// SetFit sets the value of Fit. +func (s *MatchUnconfirmedComponents) SetFit(val float64) { + s.Fit = val +} + +// SetCoverage sets the value of Coverage. +func (s *MatchUnconfirmedComponents) SetCoverage(val float64) { + s.Coverage = val +} + +// Ranking or public-card component whose value is unknown. +// Ref: #/components/schemas/MatchUnknownComponent +type MatchUnknownComponent string + +const ( + MatchUnknownComponentSemantics MatchUnknownComponent = "semantics" + MatchUnknownComponentPercentile MatchUnknownComponent = "percentile" + MatchUnknownComponentAssessment MatchUnknownComponent = "assessment" + MatchUnknownComponentFreshness MatchUnknownComponent = "freshness" + MatchUnknownComponentResponsiveness MatchUnknownComponent = "responsiveness" + MatchUnknownComponentExperienceBand MatchUnknownComponent = "experience_band" + MatchUnknownComponentWorkFormats MatchUnknownComponent = "work_formats" + MatchUnknownComponentSalaryCompatibility MatchUnknownComponent = "salary_compatibility" + MatchUnknownComponentDomain MatchUnknownComponent = "domain" +) + +// AllValues returns all MatchUnknownComponent values. +func (MatchUnknownComponent) AllValues() []MatchUnknownComponent { + return []MatchUnknownComponent{ + MatchUnknownComponentSemantics, + MatchUnknownComponentPercentile, + MatchUnknownComponentAssessment, + MatchUnknownComponentFreshness, + MatchUnknownComponentResponsiveness, + MatchUnknownComponentExperienceBand, + MatchUnknownComponentWorkFormats, + MatchUnknownComponentSalaryCompatibility, + MatchUnknownComponentDomain, + } +} + +// MarshalText implements encoding.TextMarshaler. +func (s MatchUnknownComponent) MarshalText() ([]byte, error) { + switch s { + case MatchUnknownComponentSemantics: + return []byte(s), nil + case MatchUnknownComponentPercentile: + return []byte(s), nil + case MatchUnknownComponentAssessment: + return []byte(s), nil + case MatchUnknownComponentFreshness: + return []byte(s), nil + case MatchUnknownComponentResponsiveness: + return []byte(s), nil + case MatchUnknownComponentExperienceBand: + return []byte(s), nil + case MatchUnknownComponentWorkFormats: + return []byte(s), nil + case MatchUnknownComponentSalaryCompatibility: + return []byte(s), nil + case MatchUnknownComponentDomain: + return []byte(s), nil + default: + return nil, errors.Errorf("invalid value: %q", s) + } +} + +// UnmarshalText implements encoding.TextUnmarshaler. +func (s *MatchUnknownComponent) UnmarshalText(data []byte) error { + switch MatchUnknownComponent(data) { + case MatchUnknownComponentSemantics: + *s = MatchUnknownComponentSemantics + return nil + case MatchUnknownComponentPercentile: + *s = MatchUnknownComponentPercentile + return nil + case MatchUnknownComponentAssessment: + *s = MatchUnknownComponentAssessment + return nil + case MatchUnknownComponentFreshness: + *s = MatchUnknownComponentFreshness + return nil + case MatchUnknownComponentResponsiveness: + *s = MatchUnknownComponentResponsiveness + return nil + case MatchUnknownComponentExperienceBand: + *s = MatchUnknownComponentExperienceBand + return nil + case MatchUnknownComponentWorkFormats: + *s = MatchUnknownComponentWorkFormats + return nil + case MatchUnknownComponentSalaryCompatibility: + *s = MatchUnknownComponentSalaryCompatibility + return nil + case MatchUnknownComponentDomain: + *s = MatchUnknownComponentDomain + return nil + default: + return errors.Errorf("invalid value: %q", data) + } +} + +// A safe, bounded explanation for one unavailable component. +// Ref: #/components/schemas/MatchUnknownFlag +type MatchUnknownFlag struct { + Component MatchUnknownComponent `json:"component"` + Reason MatchUnknownReason `json:"reason"` +} + +// GetComponent returns the value of Component. +func (s *MatchUnknownFlag) GetComponent() MatchUnknownComponent { + return s.Component +} + +// GetReason returns the value of Reason. +func (s *MatchUnknownFlag) GetReason() MatchUnknownReason { + return s.Reason +} + +// SetComponent sets the value of Component. +func (s *MatchUnknownFlag) SetComponent(val MatchUnknownComponent) { + s.Component = val +} + +// SetReason sets the value of Reason. +func (s *MatchUnknownFlag) SetReason(val MatchUnknownReason) { + s.Reason = val +} + +type MatchUnknownFlags []MatchUnknownFlag + +// Bounded explanation for an unknown component, not a hiding reason. +// Ref: #/components/schemas/MatchUnknownReason +type MatchUnknownReason string + +const ( + MatchUnknownReasonMlUnavailable MatchUnknownReason = "ml_unavailable" + MatchUnknownReasonCohortBelow30 MatchUnknownReason = "cohort_below_30" + MatchUnknownReasonNoConfirmationForSpecialization MatchUnknownReason = "no_confirmation_for_specialization" + MatchUnknownReasonNotInPublicCard MatchUnknownReason = "not_in_public_card" + MatchUnknownReasonNeedFieldUnconfirmed MatchUnknownReason = "need_field_unconfirmed" + MatchUnknownReasonNoFreshnessHistory MatchUnknownReason = "no_freshness_history" + MatchUnknownReasonNoResponseHistory MatchUnknownReason = "no_response_history" +) + +// AllValues returns all MatchUnknownReason values. +func (MatchUnknownReason) AllValues() []MatchUnknownReason { + return []MatchUnknownReason{ + MatchUnknownReasonMlUnavailable, + MatchUnknownReasonCohortBelow30, + MatchUnknownReasonNoConfirmationForSpecialization, + MatchUnknownReasonNotInPublicCard, + MatchUnknownReasonNeedFieldUnconfirmed, + MatchUnknownReasonNoFreshnessHistory, + MatchUnknownReasonNoResponseHistory, + } +} + +// MarshalText implements encoding.TextMarshaler. +func (s MatchUnknownReason) MarshalText() ([]byte, error) { + switch s { + case MatchUnknownReasonMlUnavailable: + return []byte(s), nil + case MatchUnknownReasonCohortBelow30: + return []byte(s), nil + case MatchUnknownReasonNoConfirmationForSpecialization: + return []byte(s), nil + case MatchUnknownReasonNotInPublicCard: + return []byte(s), nil + case MatchUnknownReasonNeedFieldUnconfirmed: + return []byte(s), nil + case MatchUnknownReasonNoFreshnessHistory: + return []byte(s), nil + case MatchUnknownReasonNoResponseHistory: + return []byte(s), nil + default: + return nil, errors.Errorf("invalid value: %q", s) + } +} + +// UnmarshalText implements encoding.TextUnmarshaler. +func (s *MatchUnknownReason) UnmarshalText(data []byte) error { + switch MatchUnknownReason(data) { + case MatchUnknownReasonMlUnavailable: + *s = MatchUnknownReasonMlUnavailable + return nil + case MatchUnknownReasonCohortBelow30: + *s = MatchUnknownReasonCohortBelow30 + return nil + case MatchUnknownReasonNoConfirmationForSpecialization: + *s = MatchUnknownReasonNoConfirmationForSpecialization + return nil + case MatchUnknownReasonNotInPublicCard: + *s = MatchUnknownReasonNotInPublicCard + return nil + case MatchUnknownReasonNeedFieldUnconfirmed: + *s = MatchUnknownReasonNeedFieldUnconfirmed + return nil + case MatchUnknownReasonNoFreshnessHistory: + *s = MatchUnknownReasonNoFreshnessHistory + return nil + case MatchUnknownReasonNoResponseHistory: + *s = MatchUnknownReasonNoResponseHistory + return nil + default: + return errors.Errorf("invalid value: %q", data) + } +} + // State of a membership. Only `active` gives access: every other state answers as if the account were // no member. // @@ -15354,6 +17077,141 @@ func (o NilInvitationTermsVersion) Or(d InvitationTermsVersion) InvitationTermsV return d } +// NewNilMatchAppliedConditions returns new NilMatchAppliedConditions with value set to v. +func NewNilMatchAppliedConditions(v MatchAppliedConditions) NilMatchAppliedConditions { + return NilMatchAppliedConditions{ + Value: v, + } +} + +// NilMatchAppliedConditions is nullable MatchAppliedConditions. +type NilMatchAppliedConditions struct { + Value MatchAppliedConditions + Null bool +} + +// SetTo sets value to v. +func (o *NilMatchAppliedConditions) SetTo(v MatchAppliedConditions) { + o.Null = false + o.Value = v +} + +// IsNull returns true if value is Null. +func (o NilMatchAppliedConditions) IsNull() bool { return o.Null } + +// SetToNull sets value to null. +func (o *NilMatchAppliedConditions) SetToNull() { + o.Null = true + var v MatchAppliedConditions + o.Value = v +} + +// Get returns value and boolean that denotes whether value was set. +func (o NilMatchAppliedConditions) Get() (v MatchAppliedConditions, ok bool) { + if o.Null { + return v, false + } + return o.Value, true +} + +// Or returns value if set, or given parameter if does not. +func (o NilMatchAppliedConditions) Or(d MatchAppliedConditions) MatchAppliedConditions { + if v, ok := o.Get(); ok { + return v + } + return d +} + +// NewNilMatchConfirmationStatus returns new NilMatchConfirmationStatus with value set to v. +func NewNilMatchConfirmationStatus(v MatchConfirmationStatus) NilMatchConfirmationStatus { + return NilMatchConfirmationStatus{ + Value: v, + } +} + +// NilMatchConfirmationStatus is nullable MatchConfirmationStatus. +type NilMatchConfirmationStatus struct { + Value MatchConfirmationStatus + Null bool +} + +// SetTo sets value to v. +func (o *NilMatchConfirmationStatus) SetTo(v MatchConfirmationStatus) { + o.Null = false + o.Value = v +} + +// IsNull returns true if value is Null. +func (o NilMatchConfirmationStatus) IsNull() bool { return o.Null } + +// SetToNull sets value to null. +func (o *NilMatchConfirmationStatus) SetToNull() { + o.Null = true + var v MatchConfirmationStatus + o.Value = v +} + +// Get returns value and boolean that denotes whether value was set. +func (o NilMatchConfirmationStatus) Get() (v MatchConfirmationStatus, ok bool) { + if o.Null { + return v, false + } + return o.Value, true +} + +// Or returns value if set, or given parameter if does not. +func (o NilMatchConfirmationStatus) Or(d MatchConfirmationStatus) MatchConfirmationStatus { + if v, ok := o.Get(); ok { + return v + } + return d +} + +// NewNilMatchGradeFilter returns new NilMatchGradeFilter with value set to v. +func NewNilMatchGradeFilter(v MatchGradeFilter) NilMatchGradeFilter { + return NilMatchGradeFilter{ + Value: v, + } +} + +// NilMatchGradeFilter is nullable MatchGradeFilter. +type NilMatchGradeFilter struct { + Value MatchGradeFilter + Null bool +} + +// SetTo sets value to v. +func (o *NilMatchGradeFilter) SetTo(v MatchGradeFilter) { + o.Null = false + o.Value = v +} + +// IsNull returns true if value is Null. +func (o NilMatchGradeFilter) IsNull() bool { return o.Null } + +// SetToNull sets value to null. +func (o *NilMatchGradeFilter) SetToNull() { + o.Null = true + var v MatchGradeFilter + o.Value = v +} + +// Get returns value and boolean that denotes whether value was set. +func (o NilMatchGradeFilter) Get() (v MatchGradeFilter, ok bool) { + if o.Null { + return v, false + } + return o.Value, true +} + +// Or returns value if set, or given parameter if does not. +func (o NilMatchGradeFilter) Or(d MatchGradeFilter) MatchGradeFilter { + if v, ok := o.Get(); ok { + return v + } + return d +} + // NewNilNeedDomainName returns new NilNeedDomainName with value set to v. func NewNilNeedDomainName(v NeedDomainName) NilNeedDomainName { return NilNeedDomainName{ @@ -17498,6 +19356,52 @@ func (s *OnboardingStep) UnmarshalText(data []byte) error { } } +// NewOptCandidateSalaryCompatibility returns new OptCandidateSalaryCompatibility with value set to v. +func NewOptCandidateSalaryCompatibility(v CandidateSalaryCompatibility) OptCandidateSalaryCompatibility { + return OptCandidateSalaryCompatibility{ + Value: v, + Set: true, + } +} + +// OptCandidateSalaryCompatibility is optional CandidateSalaryCompatibility. +type OptCandidateSalaryCompatibility struct { + Value CandidateSalaryCompatibility + Set bool +} + +// IsSet returns true if OptCandidateSalaryCompatibility was set. +func (o OptCandidateSalaryCompatibility) IsSet() bool { return o.Set } + +// Reset unsets value. +func (o *OptCandidateSalaryCompatibility) Reset() { + var v CandidateSalaryCompatibility + o.Value = v + o.Set = false +} + +// SetTo sets value to v. +func (o *OptCandidateSalaryCompatibility) SetTo(v CandidateSalaryCompatibility) { + o.Set = true + o.Value = v +} + +// Get returns value and boolean that denotes whether value was set. +func (o OptCandidateSalaryCompatibility) Get() (v CandidateSalaryCompatibility, ok bool) { + if !o.Set { + return v, false + } + return o.Value, true +} + +// Or returns value if set, or given parameter if does not. +func (o OptCandidateSalaryCompatibility) Or(d CandidateSalaryCompatibility) CandidateSalaryCompatibility { + if v, ok := o.Get(); ok { + return v + } + return d +} + // NewOptConsentState returns new OptConsentState with value set to v. func NewOptConsentState(v ConsentState) OptConsentState { return OptConsentState{ @@ -17544,6 +19448,52 @@ func (o OptConsentState) Or(d ConsentState) ConsentState { return d } +// NewOptGradeCode returns new OptGradeCode with value set to v. +func NewOptGradeCode(v GradeCode) OptGradeCode { + return OptGradeCode{ + Value: v, + Set: true, + } +} + +// OptGradeCode is optional GradeCode. +type OptGradeCode struct { + Value GradeCode + Set bool +} + +// IsSet returns true if OptGradeCode was set. +func (o OptGradeCode) IsSet() bool { return o.Set } + +// Reset unsets value. +func (o *OptGradeCode) Reset() { + var v GradeCode + o.Value = v + o.Set = false +} + +// SetTo sets value to v. +func (o *OptGradeCode) SetTo(v GradeCode) { + o.Set = true + o.Value = v +} + +// Get returns value and boolean that denotes whether value was set. +func (o OptGradeCode) Get() (v GradeCode, ok bool) { + if !o.Set { + return v, false + } + return o.Value, true +} + +// Or returns value if set, or given parameter if does not. +func (o OptGradeCode) Or(d GradeCode) GradeCode { + if v, ok := o.Get(); ok { + return v + } + return d +} + // NewOptInt32 returns new OptInt32 with value set to v. func NewOptInt32(v int32) OptInt32 { return OptInt32{ @@ -17682,6 +19632,190 @@ func (o OptInvitationTerms) Or(d InvitationTerms) InvitationTerms { return d } +// NewOptMatchConfirmationStatus returns new OptMatchConfirmationStatus with value set to v. +func NewOptMatchConfirmationStatus(v MatchConfirmationStatus) OptMatchConfirmationStatus { + return OptMatchConfirmationStatus{ + Value: v, + Set: true, + } +} + +// OptMatchConfirmationStatus is optional MatchConfirmationStatus. +type OptMatchConfirmationStatus struct { + Value MatchConfirmationStatus + Set bool +} + +// IsSet returns true if OptMatchConfirmationStatus was set. +func (o OptMatchConfirmationStatus) IsSet() bool { return o.Set } + +// Reset unsets value. +func (o *OptMatchConfirmationStatus) Reset() { + var v MatchConfirmationStatus + o.Value = v + o.Set = false +} + +// SetTo sets value to v. +func (o *OptMatchConfirmationStatus) SetTo(v MatchConfirmationStatus) { + o.Set = true + o.Value = v +} + +// Get returns value and boolean that denotes whether value was set. +func (o OptMatchConfirmationStatus) Get() (v MatchConfirmationStatus, ok bool) { + if !o.Set { + return v, false + } + return o.Value, true +} + +// Or returns value if set, or given parameter if does not. +func (o OptMatchConfirmationStatus) Or(d MatchConfirmationStatus) MatchConfirmationStatus { + if v, ok := o.Get(); ok { + return v + } + return d +} + +// NewOptMatchGradeFilter returns new OptMatchGradeFilter with value set to v. +func NewOptMatchGradeFilter(v MatchGradeFilter) OptMatchGradeFilter { + return OptMatchGradeFilter{ + Value: v, + Set: true, + } +} + +// OptMatchGradeFilter is optional MatchGradeFilter. +type OptMatchGradeFilter struct { + Value MatchGradeFilter + Set bool +} + +// IsSet returns true if OptMatchGradeFilter was set. +func (o OptMatchGradeFilter) IsSet() bool { return o.Set } + +// Reset unsets value. +func (o *OptMatchGradeFilter) Reset() { + var v MatchGradeFilter + o.Value = v + o.Set = false +} + +// SetTo sets value to v. +func (o *OptMatchGradeFilter) SetTo(v MatchGradeFilter) { + o.Set = true + o.Value = v +} + +// Get returns value and boolean that denotes whether value was set. +func (o OptMatchGradeFilter) Get() (v MatchGradeFilter, ok bool) { + if !o.Set { + return v, false + } + return o.Value, true +} + +// Or returns value if set, or given parameter if does not. +func (o OptMatchGradeFilter) Or(d MatchGradeFilter) MatchGradeFilter { + if v, ok := o.Get(); ok { + return v + } + return d +} + +// NewOptMatchSearchConditions returns new OptMatchSearchConditions with value set to v. +func NewOptMatchSearchConditions(v MatchSearchConditions) OptMatchSearchConditions { + return OptMatchSearchConditions{ + Value: v, + Set: true, + } +} + +// OptMatchSearchConditions is optional MatchSearchConditions. +type OptMatchSearchConditions struct { + Value MatchSearchConditions + Set bool +} + +// IsSet returns true if OptMatchSearchConditions was set. +func (o OptMatchSearchConditions) IsSet() bool { return o.Set } + +// Reset unsets value. +func (o *OptMatchSearchConditions) Reset() { + var v MatchSearchConditions + o.Value = v + o.Set = false +} + +// SetTo sets value to v. +func (o *OptMatchSearchConditions) SetTo(v MatchSearchConditions) { + o.Set = true + o.Value = v +} + +// Get returns value and boolean that denotes whether value was set. +func (o OptMatchSearchConditions) Get() (v MatchSearchConditions, ok bool) { + if !o.Set { + return v, false + } + return o.Value, true +} + +// Or returns value if set, or given parameter if does not. +func (o OptMatchSearchConditions) Or(d MatchSearchConditions) MatchSearchConditions { + if v, ok := o.Get(); ok { + return v + } + return d +} + +// NewOptMatchSearchFilters returns new OptMatchSearchFilters with value set to v. +func NewOptMatchSearchFilters(v MatchSearchFilters) OptMatchSearchFilters { + return OptMatchSearchFilters{ + Value: v, + Set: true, + } +} + +// OptMatchSearchFilters is optional MatchSearchFilters. +type OptMatchSearchFilters struct { + Value MatchSearchFilters + Set bool +} + +// IsSet returns true if OptMatchSearchFilters was set. +func (o OptMatchSearchFilters) IsSet() bool { return o.Set } + +// Reset unsets value. +func (o *OptMatchSearchFilters) Reset() { + var v MatchSearchFilters + o.Value = v + o.Set = false +} + +// SetTo sets value to v. +func (o *OptMatchSearchFilters) SetTo(v MatchSearchFilters) { + o.Set = true + o.Value = v +} + +// Get returns value and boolean that denotes whether value was set. +func (o OptMatchSearchFilters) Get() (v MatchSearchFilters, ok bool) { + if !o.Set { + return v, false + } + return o.Value, true +} + +// Or returns value if set, or given parameter if does not. +func (o OptMatchSearchFilters) Or(d MatchSearchFilters) MatchSearchFilters { + if v, ok := o.Get(); ok { + return v + } + return d +} + // NewOptNeedTitle returns new OptNeedTitle with value set to v. func NewOptNeedTitle(v NeedTitle) OptNeedTitle { return OptNeedTitle{ @@ -18772,6 +20906,52 @@ func (o OptOrganizationName) Or(d OrganizationName) OrganizationName { return d } +// NewOptSpecializationCode returns new OptSpecializationCode with value set to v. +func NewOptSpecializationCode(v SpecializationCode) OptSpecializationCode { + return OptSpecializationCode{ + Value: v, + Set: true, + } +} + +// OptSpecializationCode is optional SpecializationCode. +type OptSpecializationCode struct { + Value SpecializationCode + Set bool +} + +// IsSet returns true if OptSpecializationCode was set. +func (o OptSpecializationCode) IsSet() bool { return o.Set } + +// Reset unsets value. +func (o *OptSpecializationCode) Reset() { + var v SpecializationCode + o.Value = v + o.Set = false +} + +// SetTo sets value to v. +func (o *OptSpecializationCode) SetTo(v SpecializationCode) { + o.Set = true + o.Value = v +} + +// Get returns value and boolean that denotes whether value was set. +func (o OptSpecializationCode) Get() (v SpecializationCode, ok bool) { + if !o.Set { + return v, false + } + return o.Value, true +} + +// Or returns value if set, or given parameter if does not. +func (o OptSpecializationCode) Or(d SpecializationCode) SpecializationCode { + if v, ok := o.Get(); ok { + return v + } + return d +} + // NewOptString returns new OptString with value set to v. func NewOptString(v string) OptString { return OptString{ @@ -23968,6 +26148,22 @@ type SaveMyQuestionnaireUnauthorized Problem func (*SaveMyQuestionnaireUnauthorized) saveMyQuestionnaireRes() {} +type SearchOrganizationMatchesBadRequest Problem + +func (*SearchOrganizationMatchesBadRequest) searchOrganizationMatchesRes() {} + +type SearchOrganizationMatchesForbidden Problem + +func (*SearchOrganizationMatchesForbidden) searchOrganizationMatchesRes() {} + +type SearchOrganizationMatchesNotFound Problem + +func (*SearchOrganizationMatchesNotFound) searchOrganizationMatchesRes() {} + +type SearchOrganizationMatchesUnauthorized Problem + +func (*SearchOrganizationMatchesUnauthorized) searchOrganizationMatchesRes() {} + // Search status of the candidate as it holds now. The status `looking` stores the moment of its // confirmation and lapses when the confirmation interval of the product policy passes without a new // confirmation. A lapse only ever narrows: the status falls to `not_looking`, which is the non-public diff --git a/backend/internal/adapter/primary/http/api/oas_security_gen.go b/backend/internal/adapter/primary/http/api/oas_security_gen.go index 7cddb5f..7bd1ea0 100644 --- a/backend/internal/adapter/primary/http/api/oas_security_gen.go +++ b/backend/internal/adapter/primary/http/api/oas_security_gen.go @@ -101,6 +101,7 @@ var operationRolesSessionCookie = map[string][]string{ RevokeMyOrganizationContactConsentOperation: []string{}, SaveMyProfileOperation: []string{}, SaveMyQuestionnaireOperation: []string{}, + SearchOrganizationMatchesOperation: []string{}, SendOrganizationInvitationOperation: []string{}, SetMyPublicationOperation: []string{}, SetMySearchStatusOperation: []string{}, @@ -156,6 +157,7 @@ var operationRolesSessionCsrf = map[string][]string{ RevokeMyOrganizationContactConsentOperation: []string{}, SaveMyProfileOperation: []string{}, SaveMyQuestionnaireOperation: []string{}, + SearchOrganizationMatchesOperation: []string{}, SendOrganizationInvitationOperation: []string{}, SetMyPublicationOperation: []string{}, SetMySearchStatusOperation: []string{}, diff --git a/backend/internal/adapter/primary/http/api/oas_server_gen.go b/backend/internal/adapter/primary/http/api/oas_server_gen.go index 8dd9c11..dcc939d 100644 --- a/backend/internal/adapter/primary/http/api/oas_server_gen.go +++ b/backend/internal/adapter/primary/http/api/oas_server_gen.go @@ -1442,6 +1442,42 @@ type Handler interface { // // PUT /api/v1/me/questionnaire SaveMyQuestionnaire(ctx context.Context, req *CandidateQuestionnaireUpdate) (SaveMyQuestionnaireRes, error) + // SearchOrganizationMatches implements SearchOrganizationMatches operation. + // + // Requires the session cookie of an employer account with an active owner membership in `org_id`, the + // CSRF token of that session in X-CSRF-Token, and an allowed Origin. The organization comes from the + // path and the active server-side membership. Hidden profiles, revoked or missing C2 publication, and + // the organization's visibility restrictions are applied before any result is returned. + // + // The body selects either a Need's `requirements_version` snapshot or the current organization-visible + // bank with explicit filters. A need reference uses `Need.requirements_version`, not the general + // `Need.version`; title or suggestion-only edits do not change the confirmed-requirements snapshot. An + // empty bank filter searches all otherwise eligible specializations, returning each specialization + // separately. + // + // Every entry is one candidate specialization. A confirmed result in Backend never confirms Networks + // for the same candidate. The `main`, `near`, and `unconfirmed` arrays are separate groups. A + // confirmed category with required-skill coverage below 0.25 belongs to `near`; other confirmed + // entries belong to `main` (FR09). Entries in `unconfirmed` are ordered by Fit, then coverage, then a + // stable internal tie-breaker that is never returned. Their category and strength remain null, and + // they have no theta, T, P, or test percentile. The search result uses the organization-scoped opaque + // `candidate_handle` as its display pseudonym and invitation reference, never a candidate account or + // profile identifier. + // + // The card context is limited to safe public fields: recognized stack tags, coarse experience, + // accepted work formats, and coarse salary compatibility. It contains no contact, candidate location, + // salary amount or minimum, raw answer, arbitrary profile text, or reason for withheld FSP data. + // Evidence explanations use bounded codes, not free text. When ML is unavailable, semantic similarity + // uses the neutral 0.5 specified by FR09 and `unknown_flags` names `ml_unavailable`. For fewer than 30 + // comparable real candidates, the search uses neutral T = 0.5, returns no percentile value, and names + // `cohort_below_30`. + // + // A missing, unknown, expired, or revoked session answers 401 unauthenticated; a candidate account + // answers 403 forbidden; an unknown organization or account without active membership answers 404 + // not_found. The response is `Cache-Control: no-store`. + // + // POST /api/v1/organizations/{org_id}/matches + SearchOrganizationMatches(ctx context.Context, req MatchSearchRequest, params SearchOrganizationMatchesParams) (SearchOrganizationMatchesRes, error) // SendOrganizationInvitation implements SendOrganizationInvitation operation. // // Requires the session cookie of an employer account with an active membership in `org_id`, the CSRF diff --git a/backend/internal/adapter/primary/http/api/oas_unimplemented_gen.go b/backend/internal/adapter/primary/http/api/oas_unimplemented_gen.go index 6184021..49105a4 100644 --- a/backend/internal/adapter/primary/http/api/oas_unimplemented_gen.go +++ b/backend/internal/adapter/primary/http/api/oas_unimplemented_gen.go @@ -1603,6 +1603,45 @@ func (UnimplementedHandler) SaveMyQuestionnaire(ctx context.Context, req *Candid return r, ht.ErrNotImplemented } +// SearchOrganizationMatches implements SearchOrganizationMatches operation. +// +// Requires the session cookie of an employer account with an active owner membership in `org_id`, the +// CSRF token of that session in X-CSRF-Token, and an allowed Origin. The organization comes from the +// path and the active server-side membership. Hidden profiles, revoked or missing C2 publication, and +// the organization's visibility restrictions are applied before any result is returned. +// +// The body selects either a Need's `requirements_version` snapshot or the current organization-visible +// bank with explicit filters. A need reference uses `Need.requirements_version`, not the general +// `Need.version`; title or suggestion-only edits do not change the confirmed-requirements snapshot. An +// empty bank filter searches all otherwise eligible specializations, returning each specialization +// separately. +// +// Every entry is one candidate specialization. A confirmed result in Backend never confirms Networks +// for the same candidate. The `main`, `near`, and `unconfirmed` arrays are separate groups. A +// confirmed category with required-skill coverage below 0.25 belongs to `near`; other confirmed +// entries belong to `main` (FR09). Entries in `unconfirmed` are ordered by Fit, then coverage, then a +// stable internal tie-breaker that is never returned. Their category and strength remain null, and +// they have no theta, T, P, or test percentile. The search result uses the organization-scoped opaque +// `candidate_handle` as its display pseudonym and invitation reference, never a candidate account or +// profile identifier. +// +// The card context is limited to safe public fields: recognized stack tags, coarse experience, +// accepted work formats, and coarse salary compatibility. It contains no contact, candidate location, +// salary amount or minimum, raw answer, arbitrary profile text, or reason for withheld FSP data. +// Evidence explanations use bounded codes, not free text. When ML is unavailable, semantic similarity +// uses the neutral 0.5 specified by FR09 and `unknown_flags` names `ml_unavailable`. For fewer than 30 +// comparable real candidates, the search uses neutral T = 0.5, returns no percentile value, and names +// `cohort_below_30`. +// +// A missing, unknown, expired, or revoked session answers 401 unauthenticated; a candidate account +// answers 403 forbidden; an unknown organization or account without active membership answers 404 +// not_found. The response is `Cache-Control: no-store`. +// +// POST /api/v1/organizations/{org_id}/matches +func (UnimplementedHandler) SearchOrganizationMatches(ctx context.Context, req MatchSearchRequest, params SearchOrganizationMatchesParams) (r SearchOrganizationMatchesRes, _ error) { + return r, ht.ErrNotImplemented +} + // SendOrganizationInvitation implements SendOrganizationInvitation operation. // // Requires the session cookie of an employer account with an active membership in `org_id`, the CSRF diff --git a/backend/internal/adapter/primary/http/api/oas_validators_gen.go b/backend/internal/adapter/primary/http/api/oas_validators_gen.go index 097bf3e..5a9f384 100644 --- a/backend/internal/adapter/primary/http/api/oas_validators_gen.go +++ b/backend/internal/adapter/primary/http/api/oas_validators_gen.go @@ -10741,6 +10741,1721 @@ func (s *LogoutNoContent) Validate() error { return nil } +func (s *MatchAppliedConditions) Validate() error { + if s == nil { + return validate.ErrNilPointer + } + + var failures []validate.FieldError + if err := func() error { + if s.WorkFormats == nil { + return nil // null + } + if err := (validate.Array{ + MinLength: 1, + MinLengthSet: true, + MaxLength: 3, + MaxLengthSet: true, + }).ValidateLength(len(s.WorkFormats)); err != nil { + return errors.Wrap(err, "array") + } + if err := validate.UniqueItems(s.WorkFormats); err != nil { + return errors.Wrap(err, "array") + } + var failures []validate.FieldError + for i, elem := range s.WorkFormats { + if err := func() error { + if err := elem.Validate(); err != nil { + return err + } + return nil + }(); err != nil { + failures = append(failures, validate.FieldError{ + Name: fmt.Sprintf("[%d]", i), + Error: err, + }) + } + } + if len(failures) > 0 { + return &validate.Error{Fields: failures} + } + return nil + }(); err != nil { + failures = append(failures, validate.FieldError{ + Name: "work_formats", + Error: err, + }) + } + if err := func() error { + if value, ok := s.SalaryCompatibility.Get(); ok { + if err := func() error { + if err := value.Validate(); err != nil { + return err + } + return nil + }(); err != nil { + return err + } + } + return nil + }(); err != nil { + failures = append(failures, validate.FieldError{ + Name: "salary_compatibility", + Error: err, + }) + } + if len(failures) > 0 { + return &validate.Error{Fields: failures} + } + return nil +} + +func (s *MatchAppliedFilters) Validate() error { + if s == nil { + return validate.ErrNilPointer + } + + var failures []validate.FieldError + if err := func() error { + if value, ok := s.Specialization.Get(); ok { + if err := func() error { + if err := value.Validate(); err != nil { + return err + } + return nil + }(); err != nil { + return err + } + } + return nil + }(); err != nil { + failures = append(failures, validate.FieldError{ + Name: "specialization", + Error: err, + }) + } + if err := func() error { + if value, ok := s.ConfirmedGrade.Get(); ok { + if err := func() error { + if err := value.Validate(); err != nil { + return err + } + return nil + }(); err != nil { + return err + } + } + return nil + }(); err != nil { + failures = append(failures, validate.FieldError{ + Name: "confirmed_grade", + Error: err, + }) + } + if err := func() error { + if value, ok := s.ConfirmedCategory.Get(); ok { + if err := func() error { + if err := value.Validate(); err != nil { + return err + } + return nil + }(); err != nil { + return err + } + } + return nil + }(); err != nil { + failures = append(failures, validate.FieldError{ + Name: "confirmed_category", + Error: err, + }) + } + if err := func() error { + if value, ok := s.ConfirmationStatus.Get(); ok { + if err := func() error { + if err := value.Validate(); err != nil { + return err + } + return nil + }(); err != nil { + return err + } + } + return nil + }(); err != nil { + failures = append(failures, validate.FieldError{ + Name: "confirmation_status", + Error: err, + }) + } + if err := func() error { + if value, ok := s.DeclaredGrade.Get(); ok { + if err := func() error { + if err := value.Validate(); err != nil { + return err + } + return nil + }(); err != nil { + return err + } + } + return nil + }(); err != nil { + failures = append(failures, validate.FieldError{ + Name: "declared_grade", + Error: err, + }) + } + if err := func() error { + if s.Stack == nil { + return nil // null + } + if err := (validate.Array{ + MinLength: 1, + MinLengthSet: true, + MaxLength: 4, + MaxLengthSet: true, + }).ValidateLength(len(s.Stack)); err != nil { + return errors.Wrap(err, "array") + } + if err := validate.UniqueItems(s.Stack); err != nil { + return errors.Wrap(err, "array") + } + var failures []validate.FieldError + for i, elem := range s.Stack { + if err := func() error { + if err := elem.Validate(); err != nil { + return err + } + return nil + }(); err != nil { + failures = append(failures, validate.FieldError{ + Name: fmt.Sprintf("[%d]", i), + Error: err, + }) + } + } + if len(failures) > 0 { + return &validate.Error{Fields: failures} + } + return nil + }(); err != nil { + failures = append(failures, validate.FieldError{ + Name: "stack", + Error: err, + }) + } + if err := func() error { + if value, ok := s.Conditions.Get(); ok { + if err := func() error { + if err := value.Validate(); err != nil { + return err + } + return nil + }(); err != nil { + return err + } + } + return nil + }(); err != nil { + failures = append(failures, validate.FieldError{ + Name: "conditions", + Error: err, + }) + } + if len(failures) > 0 { + return &validate.Error{Fields: failures} + } + return nil +} + +func (s *MatchCategory) Validate() error { + if s == nil { + return validate.ErrNilPointer + } + + var failures []validate.FieldError + if err := func() error { + if err := s.Specialization.Validate(); err != nil { + return err + } + return nil + }(); err != nil { + failures = append(failures, validate.FieldError{ + Name: "specialization", + Error: err, + }) + } + if err := func() error { + if err := s.Grade.Validate(); err != nil { + return err + } + return nil + }(); err != nil { + failures = append(failures, validate.FieldError{ + Name: "grade", + Error: err, + }) + } + if len(failures) > 0 { + return &validate.Error{Fields: failures} + } + return nil +} + +func (s MatchConfirmationStatus) Validate() error { + switch s { + case "confirmed": + return nil + case "unconfirmed": + return nil + default: + return errors.Errorf("invalid value: %v", s) + } +} + +func (s *MatchConfirmedCandidate) Validate() error { + if s == nil { + return validate.ErrNilPointer + } + + var failures []validate.FieldError + if err := func() error { + if err := s.CandidateHandle.Validate(); err != nil { + return err + } + return nil + }(); err != nil { + failures = append(failures, validate.FieldError{ + Name: "candidate_handle", + Error: err, + }) + } + if err := func() error { + if err := s.Specialization.Validate(); err != nil { + return err + } + return nil + }(); err != nil { + failures = append(failures, validate.FieldError{ + Name: "specialization", + Error: err, + }) + } + if err := func() error { + if err := s.ConfirmationStatus.Validate(); err != nil { + return err + } + return nil + }(); err != nil { + failures = append(failures, validate.FieldError{ + Name: "confirmation_status", + Error: err, + }) + } + if err := func() error { + if value, ok := s.DeclaredGrade.Get(); ok { + if err := func() error { + if err := value.Validate(); err != nil { + return err + } + return nil + }(); err != nil { + return err + } + } + return nil + }(); err != nil { + failures = append(failures, validate.FieldError{ + Name: "declared_grade", + Error: err, + }) + } + if err := func() error { + if err := s.Category.Validate(); err != nil { + return err + } + return nil + }(); err != nil { + failures = append(failures, validate.FieldError{ + Name: "category", + Error: err, + }) + } + if err := func() error { + if err := s.Strength.Validate(); err != nil { + return err + } + return nil + }(); err != nil { + failures = append(failures, validate.FieldError{ + Name: "strength", + Error: err, + }) + } + if err := func() error { + if err := s.PublicContext.Validate(); err != nil { + return err + } + return nil + }(); err != nil { + failures = append(failures, validate.FieldError{ + Name: "public_context", + Error: err, + }) + } + if err := func() error { + if err := s.EvidenceSummary.Validate(); err != nil { + return err + } + return nil + }(); err != nil { + failures = append(failures, validate.FieldError{ + Name: "evidence_summary", + Error: err, + }) + } + if err := func() error { + if err := s.Components.Validate(); err != nil { + return err + } + return nil + }(); err != nil { + failures = append(failures, validate.FieldError{ + Name: "components", + Error: err, + }) + } + if err := func() error { + if err := s.UnknownFlags.Validate(); err != nil { + return err + } + return nil + }(); err != nil { + failures = append(failures, validate.FieldError{ + Name: "unknown_flags", + Error: err, + }) + } + if len(failures) > 0 { + return &validate.Error{Fields: failures} + } + return nil +} + +func (s MatchConfirmedCandidateConfirmationStatus) Validate() error { + switch s { + case "confirmed": + return nil + default: + return errors.Errorf("invalid value: %v", s) + } +} + +func (s *MatchConfirmedComponents) Validate() error { + if s == nil { + return validate.ErrNilPointer + } + + var failures []validate.FieldError + if err := func() error { + if err := s.Fit.Validate(); err != nil { + return err + } + return nil + }(); err != nil { + failures = append(failures, validate.FieldError{ + Name: "fit", + Error: err, + }) + } + if err := func() error { + if err := s.Coverage.Validate(); err != nil { + return err + } + return nil + }(); err != nil { + failures = append(failures, validate.FieldError{ + Name: "coverage", + Error: err, + }) + } + if err := func() error { + if err := s.Domain.Validate(); err != nil { + return err + } + return nil + }(); err != nil { + failures = append(failures, validate.FieldError{ + Name: "domain", + Error: err, + }) + } + if err := func() error { + if err := s.Semantics.Validate(); err != nil { + return err + } + return nil + }(); err != nil { + failures = append(failures, validate.FieldError{ + Name: "semantics", + Error: err, + }) + } + if err := func() error { + if value, ok := s.Percentile.Get(); ok { + if err := func() error { + if err := (validate.Float{ + MinSet: true, + Min: 0, + MaxSet: true, + Max: 1, + MinExclusive: false, + MaxExclusive: false, + MultipleOfSet: false, + MultipleOf: nil, + Pattern: nil, + }).Validate(float64(value)); err != nil { + return errors.Wrap(err, "float") + } + return nil + }(); err != nil { + return err + } + } + return nil + }(); err != nil { + failures = append(failures, validate.FieldError{ + Name: "percentile", + Error: err, + }) + } + if err := func() error { + if err := s.Competition.Validate(); err != nil { + return err + } + return nil + }(); err != nil { + failures = append(failures, validate.FieldError{ + Name: "competition", + Error: err, + }) + } + if err := func() error { + if err := s.Freshness.Validate(); err != nil { + return err + } + return nil + }(); err != nil { + failures = append(failures, validate.FieldError{ + Name: "freshness", + Error: err, + }) + } + if err := func() error { + if err := s.Responsiveness.Validate(); err != nil { + return err + } + return nil + }(); err != nil { + failures = append(failures, validate.FieldError{ + Name: "responsiveness", + Error: err, + }) + } + if err := func() error { + if err := s.RankScore.Validate(); err != nil { + return err + } + return nil + }(); err != nil { + failures = append(failures, validate.FieldError{ + Name: "rank_score", + Error: err, + }) + } + if len(failures) > 0 { + return &validate.Error{Fields: failures} + } + return nil +} + +func (s MatchEvidenceCode) Validate() error { + switch s { + case "confirmed_category": + return nil + case "required_skill_evidence": + return nil + case "desired_skill_evidence": + return nil + case "domain_alignment": + return nil + case "task_alignment": + return nil + case "work_conditions_match": + return nil + case "salary_compatibility": + return nil + case "declared_grade": + return nil + default: + return errors.Errorf("invalid value: %v", s) + } +} + +func (s MatchEvidenceState) Validate() error { + switch s { + case "supports": + return nil + case "partial": + return nil + case "gap": + return nil + case "declared_only": + return nil + default: + return errors.Errorf("invalid value: %v", s) + } +} + +func (s MatchEvidenceSummary) Validate() error { + alias := ([]MatchEvidenceSummaryItem)(s) + if alias == nil { + return errors.New("nil is invalid value") + } + if err := (validate.Array{ + MinLength: 0, + MinLengthSet: false, + MaxLength: 12, + MaxLengthSet: true, + }).ValidateLength(len(alias)); err != nil { + return errors.Wrap(err, "array") + } + var failures []validate.FieldError + for i, elem := range alias { + if err := func() error { + if err := elem.Validate(); err != nil { + return err + } + return nil + }(); err != nil { + failures = append(failures, validate.FieldError{ + Name: fmt.Sprintf("[%d]", i), + Error: err, + }) + } + } + if len(failures) > 0 { + return &validate.Error{Fields: failures} + } + return nil +} + +func (s *MatchEvidenceSummaryItem) Validate() error { + if s == nil { + return validate.ErrNilPointer + } + + var failures []validate.FieldError + if err := func() error { + if err := s.Code.Validate(); err != nil { + return err + } + return nil + }(); err != nil { + failures = append(failures, validate.FieldError{ + Name: "code", + Error: err, + }) + } + if err := func() error { + if err := s.State.Validate(); err != nil { + return err + } + return nil + }(); err != nil { + failures = append(failures, validate.FieldError{ + Name: "state", + Error: err, + }) + } + if len(failures) > 0 { + return &validate.Error{Fields: failures} + } + return nil +} + +func (s *MatchGradeFilter) Validate() error { + if s == nil { + return validate.ErrNilPointer + } + + var failures []validate.FieldError + if err := func() error { + if err := s.Specialization.Validate(); err != nil { + return err + } + return nil + }(); err != nil { + failures = append(failures, validate.FieldError{ + Name: "specialization", + Error: err, + }) + } + if err := func() error { + if err := s.Grade.Validate(); err != nil { + return err + } + return nil + }(); err != nil { + failures = append(failures, validate.FieldError{ + Name: "grade", + Error: err, + }) + } + if len(failures) > 0 { + return &validate.Error{Fields: failures} + } + return nil +} + +func (s *MatchPublicContext) Validate() error { + if s == nil { + return validate.ErrNilPointer + } + + var failures []validate.FieldError + if err := func() error { + if err := s.Stack.Validate(); err != nil { + return err + } + return nil + }(); err != nil { + failures = append(failures, validate.FieldError{ + Name: "stack", + Error: err, + }) + } + if err := func() error { + if value, ok := s.ExperienceBand.Get(); ok { + if err := func() error { + if err := value.Validate(); err != nil { + return err + } + return nil + }(); err != nil { + return err + } + } + return nil + }(); err != nil { + failures = append(failures, validate.FieldError{ + Name: "experience_band", + Error: err, + }) + } + if err := func() error { + if s.WorkFormats == nil { + return nil // null + } + if err := (validate.Array{ + MinLength: 0, + MinLengthSet: false, + MaxLength: 3, + MaxLengthSet: true, + }).ValidateLength(len(s.WorkFormats)); err != nil { + return errors.Wrap(err, "array") + } + if err := validate.UniqueItems(s.WorkFormats); err != nil { + return errors.Wrap(err, "array") + } + var failures []validate.FieldError + for i, elem := range s.WorkFormats { + if err := func() error { + if err := elem.Validate(); err != nil { + return err + } + return nil + }(); err != nil { + failures = append(failures, validate.FieldError{ + Name: fmt.Sprintf("[%d]", i), + Error: err, + }) + } + } + if len(failures) > 0 { + return &validate.Error{Fields: failures} + } + return nil + }(); err != nil { + failures = append(failures, validate.FieldError{ + Name: "work_formats", + Error: err, + }) + } + if err := func() error { + if value, ok := s.SalaryCompatibility.Get(); ok { + if err := func() error { + if err := value.Validate(); err != nil { + return err + } + return nil + }(); err != nil { + return err + } + } + return nil + }(); err != nil { + failures = append(failures, validate.FieldError{ + Name: "salary_compatibility", + Error: err, + }) + } + if len(failures) > 0 { + return &validate.Error{Fields: failures} + } + return nil +} + +func (s MatchPublicStack) Validate() error { + alias := ([]MatchSearchStackTag)(s) + if alias == nil { + return nil // null + } + if err := (validate.Array{ + MinLength: 0, + MinLengthSet: false, + MaxLength: 4, + MaxLengthSet: true, + }).ValidateLength(len(alias)); err != nil { + return errors.Wrap(err, "array") + } + if err := validate.UniqueItems(alias); err != nil { + return errors.Wrap(err, "array") + } + var failures []validate.FieldError + for i, elem := range alias { + if err := func() error { + if err := elem.Validate(); err != nil { + return err + } + return nil + }(); err != nil { + failures = append(failures, validate.FieldError{ + Name: fmt.Sprintf("[%d]", i), + Error: err, + }) + } + } + if len(failures) > 0 { + return &validate.Error{Fields: failures} + } + return nil +} + +func (s MatchScore) Validate() error { + alias := (float64)(s) + if err := (validate.Float{ + MinSet: true, + Min: 0, + MaxSet: true, + Max: 1, + MinExclusive: false, + MaxExclusive: false, + MultipleOfSet: false, + MultipleOf: nil, + Pattern: nil, + }).Validate(float64(alias)); err != nil { + return errors.Wrap(err, "float") + } + return nil +} + +func (s *MatchSearchBankSource) Validate() error { + if s == nil { + return validate.ErrNilPointer + } + + var failures []validate.FieldError + if err := func() error { + if err := s.Kind.Validate(); err != nil { + return err + } + return nil + }(); err != nil { + failures = append(failures, validate.FieldError{ + Name: "kind", + Error: err, + }) + } + if err := func() error { + if err := s.Filters.Validate(); err != nil { + return err + } + return nil + }(); err != nil { + failures = append(failures, validate.FieldError{ + Name: "filters", + Error: err, + }) + } + if len(failures) > 0 { + return &validate.Error{Fields: failures} + } + return nil +} + +func (s MatchSearchBankSourceKind) Validate() error { + switch s { + case "bank": + return nil + default: + return errors.Errorf("invalid value: %v", s) + } +} + +func (s *MatchSearchByBank) Validate() error { + if s == nil { + return validate.ErrNilPointer + } + + var failures []validate.FieldError + if err := func() error { + if err := s.Filters.Validate(); err != nil { + return err + } + return nil + }(); err != nil { + failures = append(failures, validate.FieldError{ + Name: "filters", + Error: err, + }) + } + if len(failures) > 0 { + return &validate.Error{Fields: failures} + } + return nil +} + +func (s *MatchSearchByNeed) Validate() error { + if s == nil { + return validate.ErrNilPointer + } + + var failures []validate.FieldError + if err := func() error { + if err := s.RequirementsVersion.Validate(); err != nil { + return err + } + return nil + }(); err != nil { + failures = append(failures, validate.FieldError{ + Name: "requirements_version", + Error: err, + }) + } + if err := func() error { + if value, ok := s.Filters.Get(); ok { + if err := func() error { + if err := value.Validate(); err != nil { + return err + } + return nil + }(); err != nil { + return err + } + } + return nil + }(); err != nil { + failures = append(failures, validate.FieldError{ + Name: "filters", + Error: err, + }) + } + if len(failures) > 0 { + return &validate.Error{Fields: failures} + } + return nil +} + +func (s *MatchSearchConditions) Validate() error { + if s == nil { + return validate.ErrNilPointer + } + + var failures []validate.FieldError + if err := func() error { + if s.WorkFormats == nil { + return nil // optional + } + if err := (validate.Array{ + MinLength: 1, + MinLengthSet: true, + MaxLength: 3, + MaxLengthSet: true, + }).ValidateLength(len(s.WorkFormats)); err != nil { + return errors.Wrap(err, "array") + } + if err := validate.UniqueItems(s.WorkFormats); err != nil { + return errors.Wrap(err, "array") + } + var failures []validate.FieldError + for i, elem := range s.WorkFormats { + if err := func() error { + if err := elem.Validate(); err != nil { + return err + } + return nil + }(); err != nil { + failures = append(failures, validate.FieldError{ + Name: fmt.Sprintf("[%d]", i), + Error: err, + }) + } + } + if len(failures) > 0 { + return &validate.Error{Fields: failures} + } + return nil + }(); err != nil { + failures = append(failures, validate.FieldError{ + Name: "work_formats", + Error: err, + }) + } + if err := func() error { + if value, ok := s.SalaryCompatibility.Get(); ok { + if err := func() error { + if err := value.Validate(); err != nil { + return err + } + return nil + }(); err != nil { + return err + } + } + return nil + }(); err != nil { + failures = append(failures, validate.FieldError{ + Name: "salary_compatibility", + Error: err, + }) + } + if len(failures) > 0 { + return &validate.Error{Fields: failures} + } + return nil +} + +func (s *MatchSearchFilters) Validate() error { + if s == nil { + return validate.ErrNilPointer + } + + var failures []validate.FieldError + if err := func() error { + if value, ok := s.Specialization.Get(); ok { + if err := func() error { + if err := value.Validate(); err != nil { + return err + } + return nil + }(); err != nil { + return err + } + } + return nil + }(); err != nil { + failures = append(failures, validate.FieldError{ + Name: "specialization", + Error: err, + }) + } + if err := func() error { + if value, ok := s.ConfirmedGrade.Get(); ok { + if err := func() error { + if err := value.Validate(); err != nil { + return err + } + return nil + }(); err != nil { + return err + } + } + return nil + }(); err != nil { + failures = append(failures, validate.FieldError{ + Name: "confirmed_grade", + Error: err, + }) + } + if err := func() error { + if value, ok := s.ConfirmedCategory.Get(); ok { + if err := func() error { + if err := value.Validate(); err != nil { + return err + } + return nil + }(); err != nil { + return err + } + } + return nil + }(); err != nil { + failures = append(failures, validate.FieldError{ + Name: "confirmed_category", + Error: err, + }) + } + if err := func() error { + if value, ok := s.ConfirmationStatus.Get(); ok { + if err := func() error { + if err := value.Validate(); err != nil { + return err + } + return nil + }(); err != nil { + return err + } + } + return nil + }(); err != nil { + failures = append(failures, validate.FieldError{ + Name: "confirmation_status", + Error: err, + }) + } + if err := func() error { + if value, ok := s.DeclaredGrade.Get(); ok { + if err := func() error { + if err := value.Validate(); err != nil { + return err + } + return nil + }(); err != nil { + return err + } + } + return nil + }(); err != nil { + failures = append(failures, validate.FieldError{ + Name: "declared_grade", + Error: err, + }) + } + if err := func() error { + if s.Stack == nil { + return nil // optional + } + if err := (validate.Array{ + MinLength: 1, + MinLengthSet: true, + MaxLength: 4, + MaxLengthSet: true, + }).ValidateLength(len(s.Stack)); err != nil { + return errors.Wrap(err, "array") + } + if err := validate.UniqueItems(s.Stack); err != nil { + return errors.Wrap(err, "array") + } + var failures []validate.FieldError + for i, elem := range s.Stack { + if err := func() error { + if err := elem.Validate(); err != nil { + return err + } + return nil + }(); err != nil { + failures = append(failures, validate.FieldError{ + Name: fmt.Sprintf("[%d]", i), + Error: err, + }) + } + } + if len(failures) > 0 { + return &validate.Error{Fields: failures} + } + return nil + }(); err != nil { + failures = append(failures, validate.FieldError{ + Name: "stack", + Error: err, + }) + } + if err := func() error { + if value, ok := s.Conditions.Get(); ok { + if err := func() error { + if err := value.Validate(); err != nil { + return err + } + return nil + }(); err != nil { + return err + } + } + return nil + }(); err != nil { + failures = append(failures, validate.FieldError{ + Name: "conditions", + Error: err, + }) + } + if len(failures) > 0 { + return &validate.Error{Fields: failures} + } + return nil +} + +func (s *MatchSearchGroups) Validate() error { + if s == nil { + return validate.ErrNilPointer + } + + var failures []validate.FieldError + if err := func() error { + if s.Main == nil { + return errors.New("nil is invalid value") + } + var failures []validate.FieldError + for i, elem := range s.Main { + if err := func() error { + if err := elem.Validate(); err != nil { + return err + } + return nil + }(); err != nil { + failures = append(failures, validate.FieldError{ + Name: fmt.Sprintf("[%d]", i), + Error: err, + }) + } + } + if len(failures) > 0 { + return &validate.Error{Fields: failures} + } + return nil + }(); err != nil { + failures = append(failures, validate.FieldError{ + Name: "main", + Error: err, + }) + } + if err := func() error { + if s.Near == nil { + return errors.New("nil is invalid value") + } + var failures []validate.FieldError + for i, elem := range s.Near { + if err := func() error { + if err := elem.Validate(); err != nil { + return err + } + return nil + }(); err != nil { + failures = append(failures, validate.FieldError{ + Name: fmt.Sprintf("[%d]", i), + Error: err, + }) + } + } + if len(failures) > 0 { + return &validate.Error{Fields: failures} + } + return nil + }(); err != nil { + failures = append(failures, validate.FieldError{ + Name: "near", + Error: err, + }) + } + if err := func() error { + if s.Unconfirmed == nil { + return errors.New("nil is invalid value") + } + var failures []validate.FieldError + for i, elem := range s.Unconfirmed { + if err := func() error { + if err := elem.Validate(); err != nil { + return err + } + return nil + }(); err != nil { + failures = append(failures, validate.FieldError{ + Name: fmt.Sprintf("[%d]", i), + Error: err, + }) + } + } + if len(failures) > 0 { + return &validate.Error{Fields: failures} + } + return nil + }(); err != nil { + failures = append(failures, validate.FieldError{ + Name: "unconfirmed", + Error: err, + }) + } + if len(failures) > 0 { + return &validate.Error{Fields: failures} + } + return nil +} + +func (s *MatchSearchNeedSource) Validate() error { + if s == nil { + return validate.ErrNilPointer + } + + var failures []validate.FieldError + if err := func() error { + if err := s.Kind.Validate(); err != nil { + return err + } + return nil + }(); err != nil { + failures = append(failures, validate.FieldError{ + Name: "kind", + Error: err, + }) + } + if err := func() error { + if err := s.RequirementsVersion.Validate(); err != nil { + return err + } + return nil + }(); err != nil { + failures = append(failures, validate.FieldError{ + Name: "requirements_version", + Error: err, + }) + } + if len(failures) > 0 { + return &validate.Error{Fields: failures} + } + return nil +} + +func (s MatchSearchNeedSourceKind) Validate() error { + switch s { + case "need": + return nil + default: + return errors.Errorf("invalid value: %v", s) + } +} + +func (s MatchSearchRequest) Validate() error { + switch s.Type { + case MatchSearchByNeedMatchSearchRequest: + if err := s.MatchSearchByNeed.Validate(); err != nil { + return err + } + return nil + case MatchSearchByBankMatchSearchRequest: + if err := s.MatchSearchByBank.Validate(); err != nil { + return err + } + return nil + default: + return errors.Errorf("invalid type %q", s.Type) + } +} + +func (s *MatchSearchResponse) Validate() error { + if s == nil { + return validate.ErrNilPointer + } + + var failures []validate.FieldError + if err := func() error { + if err := s.Source.Validate(); err != nil { + return err + } + return nil + }(); err != nil { + failures = append(failures, validate.FieldError{ + Name: "source", + Error: err, + }) + } + if err := func() error { + if err := s.Groups.Validate(); err != nil { + return err + } + return nil + }(); err != nil { + failures = append(failures, validate.FieldError{ + Name: "groups", + Error: err, + }) + } + if len(failures) > 0 { + return &validate.Error{Fields: failures} + } + return nil +} + +func (s *MatchSearchResponseHeaders) Validate() error { + if s == nil { + return validate.ErrNilPointer + } + + var failures []validate.FieldError + if err := func() error { + if err := s.CacheControl.Validate(); err != nil { + return err + } + return nil + }(); err != nil { + failures = append(failures, validate.FieldError{ + Name: "CacheControl", + Error: err, + }) + } + if err := func() error { + if err := s.Response.Validate(); err != nil { + return err + } + return nil + }(); err != nil { + failures = append(failures, validate.FieldError{ + Name: "Response", + Error: err, + }) + } + if len(failures) > 0 { + return &validate.Error{Fields: failures} + } + return nil +} + +func (s MatchSearchSource) Validate() error { + switch s.Type { + case MatchSearchNeedSourceMatchSearchSource: + if err := s.MatchSearchNeedSource.Validate(); err != nil { + return err + } + return nil + case MatchSearchBankSourceMatchSearchSource: + if err := s.MatchSearchBankSource.Validate(); err != nil { + return err + } + return nil + default: + return errors.Errorf("invalid type %q", s.Type) + } +} + +func (s MatchSearchStackTag) Validate() error { + switch s { + case "go": + return nil + case "postgresql": + return nil + case "kafka": + return nil + case "docker": + return nil + default: + return errors.Errorf("invalid value: %v", s) + } +} + +func (s MatchStrength) Validate() error { + switch s { + case "standard": + return nil + case "strong": + return nil + default: + return errors.Errorf("invalid value: %v", s) + } +} + +func (s *MatchUnconfirmedCandidate) Validate() error { + if s == nil { + return validate.ErrNilPointer + } + + var failures []validate.FieldError + if err := func() error { + if err := s.CandidateHandle.Validate(); err != nil { + return err + } + return nil + }(); err != nil { + failures = append(failures, validate.FieldError{ + Name: "candidate_handle", + Error: err, + }) + } + if err := func() error { + if err := s.Specialization.Validate(); err != nil { + return err + } + return nil + }(); err != nil { + failures = append(failures, validate.FieldError{ + Name: "specialization", + Error: err, + }) + } + if err := func() error { + if err := s.ConfirmationStatus.Validate(); err != nil { + return err + } + return nil + }(); err != nil { + failures = append(failures, validate.FieldError{ + Name: "confirmation_status", + Error: err, + }) + } + if err := func() error { + if value, ok := s.DeclaredGrade.Get(); ok { + if err := func() error { + if err := value.Validate(); err != nil { + return err + } + return nil + }(); err != nil { + return err + } + } + return nil + }(); err != nil { + failures = append(failures, validate.FieldError{ + Name: "declared_grade", + Error: err, + }) + } + if err := func() error { + if err := s.PublicContext.Validate(); err != nil { + return err + } + return nil + }(); err != nil { + failures = append(failures, validate.FieldError{ + Name: "public_context", + Error: err, + }) + } + if err := func() error { + if err := s.EvidenceSummary.Validate(); err != nil { + return err + } + return nil + }(); err != nil { + failures = append(failures, validate.FieldError{ + Name: "evidence_summary", + Error: err, + }) + } + if err := func() error { + if err := s.Components.Validate(); err != nil { + return err + } + return nil + }(); err != nil { + failures = append(failures, validate.FieldError{ + Name: "components", + Error: err, + }) + } + if err := func() error { + if err := s.UnknownFlags.Validate(); err != nil { + return err + } + return nil + }(); err != nil { + failures = append(failures, validate.FieldError{ + Name: "unknown_flags", + Error: err, + }) + } + if len(failures) > 0 { + return &validate.Error{Fields: failures} + } + return nil +} + +func (s MatchUnconfirmedCandidateConfirmationStatus) Validate() error { + switch s { + case "unconfirmed": + return nil + default: + return errors.Errorf("invalid value: %v", s) + } +} + +func (s *MatchUnconfirmedComponents) Validate() error { + if s == nil { + return validate.ErrNilPointer + } + + var failures []validate.FieldError + if err := func() error { + if err := (validate.Float{ + MinSet: true, + Min: 0, + MaxSet: true, + Max: 1, + MinExclusive: false, + MaxExclusive: false, + MultipleOfSet: false, + MultipleOf: nil, + Pattern: nil, + }).Validate(float64(s.Fit)); err != nil { + return errors.Wrap(err, "float") + } + return nil + }(); err != nil { + failures = append(failures, validate.FieldError{ + Name: "fit", + Error: err, + }) + } + if err := func() error { + if err := (validate.Float{ + MinSet: true, + Min: 0, + MaxSet: true, + Max: 1, + MinExclusive: false, + MaxExclusive: false, + MultipleOfSet: false, + MultipleOf: nil, + Pattern: nil, + }).Validate(float64(s.Coverage)); err != nil { + return errors.Wrap(err, "float") + } + return nil + }(); err != nil { + failures = append(failures, validate.FieldError{ + Name: "coverage", + Error: err, + }) + } + if len(failures) > 0 { + return &validate.Error{Fields: failures} + } + return nil +} + +func (s MatchUnknownComponent) Validate() error { + switch s { + case "semantics": + return nil + case "percentile": + return nil + case "assessment": + return nil + case "freshness": + return nil + case "responsiveness": + return nil + case "experience_band": + return nil + case "work_formats": + return nil + case "salary_compatibility": + return nil + case "domain": + return nil + default: + return errors.Errorf("invalid value: %v", s) + } +} + +func (s *MatchUnknownFlag) Validate() error { + if s == nil { + return validate.ErrNilPointer + } + + var failures []validate.FieldError + if err := func() error { + if err := s.Component.Validate(); err != nil { + return err + } + return nil + }(); err != nil { + failures = append(failures, validate.FieldError{ + Name: "component", + Error: err, + }) + } + if err := func() error { + if err := s.Reason.Validate(); err != nil { + return err + } + return nil + }(); err != nil { + failures = append(failures, validate.FieldError{ + Name: "reason", + Error: err, + }) + } + if len(failures) > 0 { + return &validate.Error{Fields: failures} + } + return nil +} + +func (s MatchUnknownFlags) Validate() error { + alias := ([]MatchUnknownFlag)(s) + if alias == nil { + return errors.New("nil is invalid value") + } + if err := (validate.Array{ + MinLength: 0, + MinLengthSet: false, + MaxLength: 9, + MaxLengthSet: true, + }).ValidateLength(len(alias)); err != nil { + return errors.Wrap(err, "array") + } + var failures []validate.FieldError + for i, elem := range alias { + if err := func() error { + if err := elem.Validate(); err != nil { + return err + } + return nil + }(); err != nil { + failures = append(failures, validate.FieldError{ + Name: fmt.Sprintf("[%d]", i), + Error: err, + }) + } + } + if len(failures) > 0 { + return &validate.Error{Fields: failures} + } + return nil +} + +func (s MatchUnknownReason) Validate() error { + switch s { + case "ml_unavailable": + return nil + case "cohort_below_30": + return nil + case "no_confirmation_for_specialization": + return nil + case "not_in_public_card": + return nil + case "need_field_unconfirmed": + return nil + case "no_freshness_history": + return nil + case "no_response_history": + return nil + default: + return errors.Errorf("invalid value: %v", s) + } +} + func (s MembershipState) Validate() error { switch s { case "active": @@ -19002,6 +20717,38 @@ func (s *SaveMyQuestionnaireUnauthorized) Validate() error { return nil } +func (s *SearchOrganizationMatchesBadRequest) Validate() error { + alias := (*Problem)(s) + if err := alias.Validate(); err != nil { + return err + } + return nil +} + +func (s *SearchOrganizationMatchesForbidden) Validate() error { + alias := (*Problem)(s) + if err := alias.Validate(); err != nil { + return err + } + return nil +} + +func (s *SearchOrganizationMatchesNotFound) Validate() error { + alias := (*Problem)(s) + if err := alias.Validate(); err != nil { + return err + } + return nil +} + +func (s *SearchOrganizationMatchesUnauthorized) Validate() error { + alias := (*Problem)(s) + if err := alias.Validate(); err != nil { + return err + } + return nil +} + func (s *SearchStatus) Validate() error { if s == nil { return validate.ErrNilPointer diff --git a/frontend/src/shared/api/endpoints/organization/organization.msw.ts b/frontend/src/shared/api/endpoints/organization/organization.msw.ts index bb8f536..cf86ce0 100644 --- a/frontend/src/shared/api/endpoints/organization/organization.msw.ts +++ b/frontend/src/shared/api/endpoints/organization/organization.msw.ts @@ -21,6 +21,11 @@ import type { } from 'msw'; import type { + MatchAppliedConditions, + MatchGradeFilter, + MatchSearchBankSource, + MatchSearchNeedSource, + MatchSearchResponse, MyOrganizationList, Organization } from '../../schemas'; @@ -34,6 +39,16 @@ export const getGetOrganizationResponseMock = (overrideResponse: Partial> = {}): Organization => ({id: faker.string.uuid(), version: faker.number.int({min: 1}), name: fakeFromPattern("^\\S(?:[^\\n\\r]*\\S)?$", {minLength: 1, maxLength: 200}), description: faker.helpers.arrayElement([faker.string.alpha({length: {min: 1, max: 2000}}),null,]), sphere: faker.helpers.arrayElement([fakeFromPattern("^\\S(?:.*\\S)?$", {minLength: 1, maxLength: 100}),null,]), contacts: {website: faker.helpers.arrayElement([fakeFromPattern("^https://[^\\s/?#@]+(?:[/?#][^\\s]*)?$", {minLength: 9, maxLength: 300}),null,]), email: faker.helpers.arrayElement([faker.internet.email(),null,]), phone: faker.helpers.arrayElement([fakeFromPattern("^\\+[1-9][0-9]{6,14}$", {minLength: 8, maxLength: 16}),null,]), telegram: faker.helpers.arrayElement([fakeFromPattern("^@[A-Za-z0-9_]{5,32}$", {minLength: 6, maxLength: 33}),null,])}, representatives: Array.from({ length: faker.number.int({min: 1, max: 10}) }, (_, i) => i + 1).map(() => ({name: fakeFromPattern("^\\S(?:.*\\S)?$", {minLength: 1, maxLength: 100}), job_title: fakeFromPattern("^\\S(?:.*\\S)?$", {minLength: 1, maxLength: 100})})), verification: {level: faker.helpers.arrayElement(['e0','e1','e2','e3'] as const), basis: faker.helpers.arrayElement(['confirmed_email','corporate_domain','requisites_and_authority','manual_review','partner_status'] as const), changed_at: faker.date.past().toISOString().slice(0, 19) + 'Z'}, candidate_card: {id: faker.string.uuid(), name: fakeFromPattern("^\\S(?:[^\\n\\r]*\\S)?$", {minLength: 1, maxLength: 200}), description: faker.helpers.arrayElement([faker.string.alpha({length: {min: 1, max: 2000}}),null,]), sphere: faker.helpers.arrayElement([fakeFromPattern("^\\S(?:.*\\S)?$", {minLength: 1, maxLength: 100}),null,]), contacts: {website: faker.helpers.arrayElement([fakeFromPattern("^https://[^\\s/?#@]+(?:[/?#][^\\s]*)?$", {minLength: 9, maxLength: 300}),null,]), email: faker.helpers.arrayElement([faker.internet.email(),null,]), phone: faker.helpers.arrayElement([fakeFromPattern("^\\+[1-9][0-9]{6,14}$", {minLength: 8, maxLength: 16}),null,]), telegram: faker.helpers.arrayElement([fakeFromPattern("^@[A-Za-z0-9_]{5,32}$", {minLength: 6, maxLength: 33}),null,])}, representatives: faker.helpers.arrayElement([Array.from({ length: faker.number.int({min: 1, max: 10}) }, (_, i) => i + 1).map(() => ({name: fakeFromPattern("^\\S(?:.*\\S)?$", {minLength: 1, maxLength: 100}), job_title: fakeFromPattern("^\\S(?:.*\\S)?$", {minLength: 1, maxLength: 100})})), null]), verification_level: faker.helpers.arrayElement(['e0','e1','e2','e3'] as const)}, created_at: faker.date.past().toISOString().slice(0, 19) + 'Z', updated_at: faker.date.past().toISOString().slice(0, 19) + 'Z', ...overrideResponse}) +export const getSearchOrganizationMatchesResponseMatchSearchNeedSourceMock = (overrideResponse: Partial = {}): MatchSearchNeedSource => ({...{kind: faker.helpers.arrayElement(['need'] as const), need_id: faker.string.uuid(), requirements_version: faker.number.int({min: 1})}, ...overrideResponse}); + +export const getSearchOrganizationMatchesResponseMatchGradeFilterMock = (overrideResponse: Partial = {}): MatchGradeFilter => ({...{specialization: faker.helpers.arrayElement(['backend','frontend','mobile','network_engineer','devops_sre','data_analyst','ds_ml','information_security','qa'] as const), grade: faker.helpers.arrayElement(['intern','junior','middle','senior'] as const)}, ...overrideResponse}); + +export const getSearchOrganizationMatchesResponseMatchAppliedConditionsMock = (overrideResponse: Partial = {}): MatchAppliedConditions => ({...{work_formats: faker.helpers.arrayElement([faker.helpers.arrayElements(['remote','office','hybrid'] as const),null,]), salary_compatibility: faker.helpers.arrayElement([faker.helpers.arrayElement(['compatible','not_compatible'] as const),null,])}, ...overrideResponse}); + +export const getSearchOrganizationMatchesResponseMatchSearchBankSourceMock = (overrideResponse: Partial = {}): MatchSearchBankSource => ({...{kind: faker.helpers.arrayElement(['bank'] as const), filters: {specialization: faker.helpers.arrayElement([faker.helpers.arrayElement(['backend','frontend','mobile','network_engineer','devops_sre','data_analyst','ds_ml','information_security','qa'] as const),null,]), confirmed_grade: faker.helpers.arrayElement([faker.helpers.arrayElement(['intern','junior','middle','senior'] as const),null,]), confirmed_category: faker.helpers.arrayElement([{...getSearchOrganizationMatchesResponseMatchGradeFilterMock()},null,]), confirmation_status: faker.helpers.arrayElement([faker.helpers.arrayElement(['confirmed','unconfirmed'] as const),null,]), declared_grade: faker.helpers.arrayElement([faker.helpers.arrayElement(['intern','junior','middle','senior'] as const),null,]), stack: faker.helpers.arrayElement([faker.helpers.arrayElements(['go','postgresql','kafka','docker'] as const),null,]), conditions: faker.helpers.arrayElement([{...getSearchOrganizationMatchesResponseMatchAppliedConditionsMock()},null,])}}, ...overrideResponse}); + +export const getSearchOrganizationMatchesResponseMock = (overrideResponse: Partial> = {}): MatchSearchResponse => ({source: faker.helpers.arrayElement([{...getSearchOrganizationMatchesResponseMatchSearchNeedSourceMock()},{...getSearchOrganizationMatchesResponseMatchSearchBankSourceMock()},]), groups: {main: Array.from({ length: faker.number.int({min: 1, max: 10}) }, (_, i) => i + 1).map(() => ({candidate_handle: fakeFromPattern("^cv1_[A-Za-z0-9_-]{43}$", {minLength: 47, maxLength: 47}), specialization: faker.helpers.arrayElement(['backend','frontend','mobile','network_engineer','devops_sre','data_analyst','ds_ml','information_security','qa'] as const), confirmation_status: faker.helpers.arrayElement(['confirmed'] as const), declared_grade: faker.helpers.arrayElement([faker.helpers.arrayElement(['intern','junior','middle','senior'] as const),null,]), category: {specialization: faker.helpers.arrayElement(['backend','frontend','mobile','network_engineer','devops_sre','data_analyst','ds_ml','information_security','qa'] as const), grade: faker.helpers.arrayElement(['intern','junior','middle','senior'] as const)}, strength: faker.helpers.arrayElement(['standard','strong'] as const), public_context: {stack: faker.helpers.arrayElement([faker.helpers.arrayElements(['go','postgresql','kafka','docker'] as const),null,]), experience_band: faker.helpers.arrayElement([faker.helpers.arrayElement(['0_1','1_3','3_6','6_plus','0_3','3_plus'] as const),null,]), work_formats: faker.helpers.arrayElement([faker.helpers.arrayElements(['remote','office','hybrid'] as const),null,]), salary_compatibility: faker.helpers.arrayElement([faker.helpers.arrayElement(['compatible','not_compatible'] as const),null,])}, evidence_summary: Array.from({ length: faker.number.int({min: 1, max: 12}) }, (_, i) => i + 1).map(() => ({code: faker.helpers.arrayElement(['confirmed_category','required_skill_evidence','desired_skill_evidence','domain_alignment','task_alignment','work_conditions_match','salary_compatibility','declared_grade'] as const), state: faker.helpers.arrayElement(['supports','partial','gap','declared_only'] as const)})), components: {fit: faker.number.float({min: 0, max: 1, fractionDigits: 2}), coverage: faker.number.float({min: 0, max: 1, fractionDigits: 2}), domain: faker.number.float({min: 0, max: 1, fractionDigits: 2}), semantics: faker.number.float({min: 0, max: 1, fractionDigits: 2}), percentile: faker.helpers.arrayElement([faker.number.float({min: 0, max: 1, fractionDigits: 2}),null,]), competition: faker.number.float({min: 0, max: 1, fractionDigits: 2}), freshness: faker.number.float({min: 0, max: 1, fractionDigits: 2}), responsiveness: faker.number.float({min: 0, max: 1, fractionDigits: 2}), rank_score: faker.number.float({min: 0, max: 1, fractionDigits: 2})}, unknown_flags: Array.from({ length: faker.number.int({min: 1, max: 9}) }, (_, i) => i + 1).map(() => ({component: faker.helpers.arrayElement(['semantics','percentile','assessment','freshness','responsiveness','experience_band','work_formats','salary_compatibility','domain'] as const), reason: faker.helpers.arrayElement(['ml_unavailable','cohort_below_30','no_confirmation_for_specialization','not_in_public_card','need_field_unconfirmed','no_freshness_history','no_response_history'] as const)}))})), near: Array.from({ length: faker.number.int({min: 1, max: 10}) }, (_, i) => i + 1).map(() => ({candidate_handle: fakeFromPattern("^cv1_[A-Za-z0-9_-]{43}$", {minLength: 47, maxLength: 47}), specialization: faker.helpers.arrayElement(['backend','frontend','mobile','network_engineer','devops_sre','data_analyst','ds_ml','information_security','qa'] as const), confirmation_status: faker.helpers.arrayElement(['confirmed'] as const), declared_grade: faker.helpers.arrayElement([faker.helpers.arrayElement(['intern','junior','middle','senior'] as const),null,]), category: {specialization: faker.helpers.arrayElement(['backend','frontend','mobile','network_engineer','devops_sre','data_analyst','ds_ml','information_security','qa'] as const), grade: faker.helpers.arrayElement(['intern','junior','middle','senior'] as const)}, strength: faker.helpers.arrayElement(['standard','strong'] as const), public_context: {stack: faker.helpers.arrayElement([faker.helpers.arrayElements(['go','postgresql','kafka','docker'] as const),null,]), experience_band: faker.helpers.arrayElement([faker.helpers.arrayElement(['0_1','1_3','3_6','6_plus','0_3','3_plus'] as const),null,]), work_formats: faker.helpers.arrayElement([faker.helpers.arrayElements(['remote','office','hybrid'] as const),null,]), salary_compatibility: faker.helpers.arrayElement([faker.helpers.arrayElement(['compatible','not_compatible'] as const),null,])}, evidence_summary: Array.from({ length: faker.number.int({min: 1, max: 12}) }, (_, i) => i + 1).map(() => ({code: faker.helpers.arrayElement(['confirmed_category','required_skill_evidence','desired_skill_evidence','domain_alignment','task_alignment','work_conditions_match','salary_compatibility','declared_grade'] as const), state: faker.helpers.arrayElement(['supports','partial','gap','declared_only'] as const)})), components: {fit: faker.number.float({min: 0, max: 1, fractionDigits: 2}), coverage: faker.number.float({min: 0, max: 1, fractionDigits: 2}), domain: faker.number.float({min: 0, max: 1, fractionDigits: 2}), semantics: faker.number.float({min: 0, max: 1, fractionDigits: 2}), percentile: faker.helpers.arrayElement([faker.number.float({min: 0, max: 1, fractionDigits: 2}),null,]), competition: faker.number.float({min: 0, max: 1, fractionDigits: 2}), freshness: faker.number.float({min: 0, max: 1, fractionDigits: 2}), responsiveness: faker.number.float({min: 0, max: 1, fractionDigits: 2}), rank_score: faker.number.float({min: 0, max: 1, fractionDigits: 2})}, unknown_flags: Array.from({ length: faker.number.int({min: 1, max: 9}) }, (_, i) => i + 1).map(() => ({component: faker.helpers.arrayElement(['semantics','percentile','assessment','freshness','responsiveness','experience_band','work_formats','salary_compatibility','domain'] as const), reason: faker.helpers.arrayElement(['ml_unavailable','cohort_below_30','no_confirmation_for_specialization','not_in_public_card','need_field_unconfirmed','no_freshness_history','no_response_history'] as const)}))})), unconfirmed: Array.from({ length: faker.number.int({min: 1, max: 10}) }, (_, i) => i + 1).map(() => ({candidate_handle: fakeFromPattern("^cv1_[A-Za-z0-9_-]{43}$", {minLength: 47, maxLength: 47}), specialization: faker.helpers.arrayElement(['backend','frontend','mobile','network_engineer','devops_sre','data_analyst','ds_ml','information_security','qa'] as const), confirmation_status: faker.helpers.arrayElement(['unconfirmed'] as const), declared_grade: faker.helpers.arrayElement([faker.helpers.arrayElement(['intern','junior','middle','senior'] as const),null,]), category: null, strength: null, public_context: {stack: faker.helpers.arrayElement([faker.helpers.arrayElements(['go','postgresql','kafka','docker'] as const),null,]), experience_band: faker.helpers.arrayElement([faker.helpers.arrayElement(['0_1','1_3','3_6','6_plus','0_3','3_plus'] as const),null,]), work_formats: faker.helpers.arrayElement([faker.helpers.arrayElements(['remote','office','hybrid'] as const),null,]), salary_compatibility: faker.helpers.arrayElement([faker.helpers.arrayElement(['compatible','not_compatible'] as const),null,])}, evidence_summary: Array.from({ length: faker.number.int({min: 1, max: 12}) }, (_, i) => i + 1).map(() => ({code: faker.helpers.arrayElement(['confirmed_category','required_skill_evidence','desired_skill_evidence','domain_alignment','task_alignment','work_conditions_match','salary_compatibility','declared_grade'] as const), state: faker.helpers.arrayElement(['supports','partial','gap','declared_only'] as const)})), components: {fit: faker.number.float({min: 0, max: 1, fractionDigits: 2}), coverage: faker.number.float({min: 0, max: 1, fractionDigits: 2})}, unknown_flags: Array.from({ length: faker.number.int({min: 1, max: 9}) }, (_, i) => i + 1).map(() => ({component: faker.helpers.arrayElement(['semantics','percentile','assessment','freshness','responsiveness','experience_band','work_formats','salary_compatibility','domain'] as const), reason: faker.helpers.arrayElement(['ml_unavailable','cohort_below_30','no_confirmation_for_specialization','not_in_public_card','need_field_unconfirmed','no_freshness_history','no_response_history'] as const)}))}))}, ...overrideResponse}) + export const getListMyOrganizationsMockHandler = (overrideResponse?: MyOrganizationList | ((info: Parameters[1]>[0]) => Promise | MyOrganizationList), options?: RequestHandlerOptions) => { return http.get('*/api/v1/me/organizations', async (info: Parameters[1]>[0]) => { @@ -82,9 +97,22 @@ export const getUpdateOrganizationMockHandler = (overrideResponse?: Organization }) }, options) } + +export const getSearchOrganizationMatchesMockHandler = (overrideResponse?: MatchSearchResponse | ((info: Parameters[1]>[0]) => Promise | MatchSearchResponse), options?: RequestHandlerOptions) => { + return http.post('*/api/v1/organizations/:orgId/matches', async (info: Parameters[1]>[0]) => { + + + return HttpResponse.json(overrideResponse !== undefined + ? (typeof overrideResponse === "function" ? await overrideResponse(info) : overrideResponse) + : getSearchOrganizationMatchesResponseMock(), + { status: 200 + }) + }, options) +} export const getOrganizationMock = () => [ getListMyOrganizationsMockHandler(), getCreateOrganizationMockHandler(), getGetOrganizationMockHandler(), - getUpdateOrganizationMockHandler() + getUpdateOrganizationMockHandler(), + getSearchOrganizationMatchesMockHandler() ] diff --git a/frontend/src/shared/api/endpoints/organization/organization.ts b/frontend/src/shared/api/endpoints/organization/organization.ts index 439e9e6..48204c8 100644 --- a/frontend/src/shared/api/endpoints/organization/organization.ts +++ b/frontend/src/shared/api/endpoints/organization/organization.ts @@ -26,6 +26,8 @@ import type { import type { CreateOrganizationHeaders, ListMyOrganizationsParams, + MatchSearchRequest, + MatchSearchResponse, MyOrganizationList, Organization, OrganizationCreate, @@ -467,3 +469,100 @@ export const useUpdateOrganization = , > => { return useMutation(getUpdateOrganizationMutationOptions(options), queryClient); } + export const getSearchOrganizationMatchesUrl = (orgId: string,) => { + + + + + return `/api/v1/organizations/${orgId}/matches` +} + +/** + * Requires the session cookie of an employer account with an active owner membership in `org_id`, the CSRF token of that session in X-CSRF-Token, and an allowed Origin. The organization comes from the path and the active server-side membership. Hidden profiles, revoked or missing C2 publication, and the organization's visibility restrictions are applied before any result is returned. + * + * The body selects either a Need's `requirements_version` snapshot or the current organization-visible bank with explicit filters. A need reference uses `Need.requirements_version`, not the general `Need.version`; title or suggestion-only edits do not change the confirmed-requirements snapshot. An empty bank filter searches all otherwise eligible specializations, returning each specialization separately. + * + * Every entry is one candidate specialization. A confirmed result in Backend never confirms Networks for the same candidate. The `main`, `near`, and `unconfirmed` arrays are separate groups. A confirmed category with required-skill coverage below 0.25 belongs to `near`; other confirmed entries belong to `main` (FR09). Entries in `unconfirmed` are ordered by Fit, then coverage, then a stable internal tie-breaker that is never returned. Their category and strength remain null, and they have no theta, T, P, or test percentile. The search result uses the organization-scoped opaque `candidate_handle` as its display pseudonym and invitation reference, never a candidate account or profile identifier. + * + * The card context is limited to safe public fields: recognized stack tags, coarse experience, accepted work formats, and coarse salary compatibility. It contains no contact, candidate location, salary amount or minimum, raw answer, arbitrary profile text, or reason for withheld FSP data. Evidence explanations use bounded codes, not free text. When ML is unavailable, semantic similarity uses the neutral 0.5 specified by FR09 and `unknown_flags` names `ml_unavailable`. For fewer than 30 comparable real candidates, the search uses neutral T = 0.5, returns no percentile value, and names `cohort_below_30`. + * + * A missing, unknown, expired, or revoked session answers 401 unauthenticated; a candidate account answers 403 forbidden; an unknown organization or account without active membership answers 404 not_found. The response is `Cache-Control: no-store`. + * @summary Search the current organization-visible candidate bank. + */ +export const searchOrganizationMatches = async (orgId: string, + matchSearchRequest: MatchSearchRequest, options?: Parameters[1]): Promise => { + + const getHeaders = (h?: NonNullable): Record => { + if (!h) return {}; + if (h instanceof Headers) return Object.fromEntries(h.entries()); + if (Symbol.iterator in h) { + return Object.fromEntries( + Array.from(h as Iterable>, (entry) => Array.from(entry) as [string, string]), + ); + } + const headers: Record = {}; + for (const [name, value] of Object.entries(h)) { + if (value !== undefined) headers[name] = value; + } + return headers; + }; +return apiRequest(getSearchOrganizationMatchesUrl(orgId), + { + ...options, + method: 'POST', + headers: { 'Content-Type': 'application/json', ...getHeaders(options?.headers) }, + body: JSON.stringify(matchSearchRequest) + } +);} + + + + + +export const getSearchOrganizationMatchesMutationKey = () => ['searchOrganizationMatches'] as const; + +export const getSearchOrganizationMatchesMutationOptions = , + TContext = unknown>(options?: { mutation?:UseMutationOptions>, TError,SearchOrganizationMatchesMutationVariables, TContext>, request?: SecondParameter} +): UseMutationOptions>, TError,SearchOrganizationMatchesMutationVariables, TContext> => { + +const mutationKey = getSearchOrganizationMatchesMutationKey(); +const {mutation: mutationOptions, request: requestOptions} = options ? + options.mutation && 'mutationKey' in options.mutation && options.mutation.mutationKey ? + options + : {...options, mutation: {...options.mutation, mutationKey}} + : {mutation: { mutationKey, }, request: undefined}; + + + + + const mutationFn: MutationFunction>, SearchOrganizationMatchesMutationVariables> = (props) => { + const {orgId,data} = props ?? {}; + + return searchOrganizationMatches(orgId,data,requestOptions) + } + + + + + + + return { mutationFn, ...mutationOptions }} + + export type SearchOrganizationMatchesMutationResult = NonNullable>> + export type SearchOrganizationMatchesMutationBody = MatchSearchRequest + export type SearchOrganizationMatchesMutationError = ErrorType + export type SearchOrganizationMatchesMutationVariables = {orgId: string;data: MatchSearchRequest} + + /** + * @summary Search the current organization-visible candidate bank. + */ +export const useSearchOrganizationMatches = , + TContext = unknown>(options?: { mutation?:UseMutationOptions>, TError,SearchOrganizationMatchesMutationVariables, TContext>, request?: SecondParameter} + , queryClient?: QueryClient): UseMutationResult< + Awaited>, + TError, + SearchOrganizationMatchesMutationVariables, + TContext + > => { + return useMutation(getSearchOrganizationMatchesMutationOptions(options), queryClient); + } diff --git a/frontend/src/shared/api/schemas/privacy/candidateExperienceBand.zod.ts b/frontend/src/shared/api/schemas/candidateExperienceBand.zod.ts similarity index 100% rename from frontend/src/shared/api/schemas/privacy/candidateExperienceBand.zod.ts rename to frontend/src/shared/api/schemas/candidateExperienceBand.zod.ts diff --git a/frontend/src/shared/api/schemas/invitation/candidateHandle.zod.ts b/frontend/src/shared/api/schemas/candidateHandle.zod.ts similarity index 100% rename from frontend/src/shared/api/schemas/invitation/candidateHandle.zod.ts rename to frontend/src/shared/api/schemas/candidateHandle.zod.ts diff --git a/frontend/src/shared/api/schemas/privacy/candidateSalaryCompatibility.zod.ts b/frontend/src/shared/api/schemas/candidateSalaryCompatibility.zod.ts similarity index 100% rename from frontend/src/shared/api/schemas/privacy/candidateSalaryCompatibility.zod.ts rename to frontend/src/shared/api/schemas/candidateSalaryCompatibility.zod.ts diff --git a/frontend/src/shared/api/schemas/index.ts b/frontend/src/shared/api/schemas/index.ts index b29b732..df10871 100644 --- a/frontend/src/shared/api/schemas/index.ts +++ b/frontend/src/shared/api/schemas/index.ts @@ -5,6 +5,9 @@ * OpenAPI spec version: 0.1.0 */ +export * from './candidateExperienceBand.zod'; +export * from './candidateHandle.zod'; +export * from './candidateSalaryCompatibility.zod'; export * from './consentPurposeCode.zod'; export * from './consentText.zod'; export * from './consentTextVersion.zod'; diff --git a/frontend/src/shared/api/schemas/invitation/index.ts b/frontend/src/shared/api/schemas/invitation/index.ts index c2584e6..79880af 100644 --- a/frontend/src/shared/api/schemas/invitation/index.ts +++ b/frontend/src/shared/api/schemas/invitation/index.ts @@ -9,7 +9,6 @@ export * from './acceptMyInvitationBody.zod'; export * from './acceptMyInvitationHeaders.zod'; export * from './cancelMyInvitationBody.zod'; export * from './cancelMyInvitationHeaders.zod'; -export * from './candidateHandle.zod'; export * from './candidateInvitation.zod'; export * from './candidateInvitationList.zod'; export * from './candidateInvitationSummary.zod'; diff --git a/frontend/src/shared/api/schemas/organization/index.ts b/frontend/src/shared/api/schemas/organization/index.ts index 0875611..45664a0 100644 --- a/frontend/src/shared/api/schemas/organization/index.ts +++ b/frontend/src/shared/api/schemas/organization/index.ts @@ -9,6 +9,39 @@ export * from './candidateOrganizationCard.zod'; export * from './createOrganizationBody.zod'; export * from './createOrganizationHeaders.zod'; export * from './listMyOrganizationsParams.zod'; +export * from './matchAppliedConditions.zod'; +export * from './matchAppliedFilters.zod'; +export * from './matchCategory.zod'; +export * from './matchConfirmationStatus.zod'; +export * from './matchConfirmedCandidate.zod'; +export * from './matchConfirmedComponents.zod'; +export * from './matchEvidenceCode.zod'; +export * from './matchEvidenceState.zod'; +export * from './matchEvidenceSummary.zod'; +export * from './matchEvidenceSummaryItem.zod'; +export * from './matchGradeFilter.zod'; +export * from './matchNullableScore.zod'; +export * from './matchPublicContext.zod'; +export * from './matchPublicStack.zod'; +export * from './matchScore.zod'; +export * from './matchSearchBankSource.zod'; +export * from './matchSearchByBank.zod'; +export * from './matchSearchByNeed.zod'; +export * from './matchSearchConditions.zod'; +export * from './matchSearchFilters.zod'; +export * from './matchSearchGroups.zod'; +export * from './matchSearchNeedSource.zod'; +export * from './matchSearchRequest.zod'; +export * from './matchSearchResponse.zod'; +export * from './matchSearchSource.zod'; +export * from './matchSearchStackTag.zod'; +export * from './matchStrength.zod'; +export * from './matchUnconfirmedCandidate.zod'; +export * from './matchUnconfirmedComponents.zod'; +export * from './matchUnknownComponent.zod'; +export * from './matchUnknownFlag.zod'; +export * from './matchUnknownFlags.zod'; +export * from './matchUnknownReason.zod'; export * from './membershipState.zod'; export * from './myOrganization.zod'; export * from './myOrganizationList.zod'; @@ -28,4 +61,5 @@ export * from './organizationVerificationBasis.zod'; export * from './organizationVerificationLevel.zod'; export * from './organizationVersion.zod'; export * from './organizationWebsite.zod'; +export * from './searchOrganizationMatchesBody.zod'; export * from './updateOrganizationBody.zod'; diff --git a/frontend/src/shared/api/schemas/organization/matchAppliedConditions.zod.ts b/frontend/src/shared/api/schemas/organization/matchAppliedConditions.zod.ts new file mode 100644 index 0000000..85e8f25 --- /dev/null +++ b/frontend/src/shared/api/schemas/organization/matchAppliedConditions.zod.ts @@ -0,0 +1,18 @@ +/** + * Generated by orval 🍺 + * Do not edit manually. + * Lincodex API + * OpenAPI spec version: 0.1.0 + */ +import * as zod from 'zod'; + +export const matchAppliedConditionsWorkFormatsOneMax = 3; + + +export const MatchAppliedConditions = zod.object({ + "work_formats": zod.union([zod.array(zod.enum(['remote', 'office', 'hybrid']).describe('Acceptable work format: `remote`, `office`, or `hybrid`.')).min(1).max(matchAppliedConditionsWorkFormatsOneMax),zod.null()]), + "salary_compatibility": zod.union([zod.enum(['compatible', 'not_compatible']).describe('A coarse compatibility result only. No salary amount, minimum, range, or threshold is part of the anonymous card.'),zod.null()]) +}).describe('Conditions echoed as a complete snapshot; null means no filter.') + +export type MatchAppliedConditions = zod.input; +export type MatchAppliedConditionsOutput = zod.output; diff --git a/frontend/src/shared/api/schemas/organization/matchAppliedFilters.zod.ts b/frontend/src/shared/api/schemas/organization/matchAppliedFilters.zod.ts new file mode 100644 index 0000000..cb9f2ec --- /dev/null +++ b/frontend/src/shared/api/schemas/organization/matchAppliedFilters.zod.ts @@ -0,0 +1,31 @@ +/** + * Generated by orval 🍺 + * Do not edit manually. + * Lincodex API + * OpenAPI spec version: 0.1.0 + */ +import * as zod from 'zod'; + +export const matchAppliedFiltersStackOneMax = 4; + +export const matchAppliedFiltersConditionsOneWorkFormatsOneMax = 3; + + +export const MatchAppliedFilters = zod.object({ + "specialization": zod.union([zod.enum(['backend', 'frontend', 'mobile', 'network_engineer', 'devops_sre', 'data_analyst', 'ds_ml', 'information_security', 'qa']).describe('Stable code of a specialization. A category is a specialization together with a confirmed grade; programming languages and the technology stack are separate attributes and never form a category of their own, so Backend with Go is the category `backend`, not `go`. Algorithms is a shared assessment module, not a specialization, and has no code here.\n\n- backend: Backend (development).\n- frontend: Frontend (development).\n- mobile: Mobile (development).\n- network_engineer: Network Engineer (infrastructure).\n- devops_sre: DevOps/SRE (infrastructure).\n- data_analyst: Data Analyst (data).\n- ds_ml: DS/ML (data).\n- information_security: Information security (security).\n- qa: QA (quality).\n\nAdding a value is a contract change; renaming or removing one is a breaking change.'),zod.null()]), + "confirmed_grade": zod.union([zod.enum(['intern', 'junior', 'middle', 'senior']).describe('Grade of the MVP scale in ascending order: `intern`, `junior`, `middle`, `senior`. The same codes describe a self-assessed grade, which the candidate states, and a confirmed grade, which only an assessment result establishes. Lead and Architect are planned after the MVP; adding a value is a contract change.'),zod.null()]), + "confirmed_category": zod.union([zod.object({ + "specialization": zod.enum(['backend', 'frontend', 'mobile', 'network_engineer', 'devops_sre', 'data_analyst', 'ds_ml', 'information_security', 'qa']).describe('Stable code of a specialization. A category is a specialization together with a confirmed grade; programming languages and the technology stack are separate attributes and never form a category of their own, so Backend with Go is the category `backend`, not `go`. Algorithms is a shared assessment module, not a specialization, and has no code here.\n\n- backend: Backend (development).\n- frontend: Frontend (development).\n- mobile: Mobile (development).\n- network_engineer: Network Engineer (infrastructure).\n- devops_sre: DevOps/SRE (infrastructure).\n- data_analyst: Data Analyst (data).\n- ds_ml: DS/ML (data).\n- information_security: Information security (security).\n- qa: QA (quality).\n\nAdding a value is a contract change; renaming or removing one is a breaking change.'), + "grade": zod.enum(['intern', 'junior', 'middle', 'senior']).describe('Grade of the MVP scale in ascending order: `intern`, `junior`, `middle`, `senior`. The same codes describe a self-assessed grade, which the candidate states, and a confirmed grade, which only an assessment result establishes. Lead and Architect are planned after the MVP; adding a value is a contract change.') +}).describe('A confirmed category filter, never a candidate declaration.'),zod.null()]), + "confirmation_status": zod.union([zod.enum(['confirmed', 'unconfirmed']).describe('Confirmation state for this specialization only. A result for one specialization never changes the state of another specialization.'),zod.null()]), + "declared_grade": zod.union([zod.enum(['intern', 'junior', 'middle', 'senior']).describe('Grade of the MVP scale in ascending order: `intern`, `junior`, `middle`, `senior`. The same codes describe a self-assessed grade, which the candidate states, and a confirmed grade, which only an assessment result establishes. Lead and Architect are planned after the MVP; adding a value is a contract change.'),zod.null()]), + "stack": zod.union([zod.array(zod.enum(['go', 'postgresql', 'kafka', 'docker']).describe('A stack code that the anonymous card may expose. Search filters do not accept arbitrary profile text or candidate-provided evidence.')).min(1).max(matchAppliedFiltersStackOneMax),zod.null()]), + "conditions": zod.union([zod.object({ + "work_formats": zod.union([zod.array(zod.enum(['remote', 'office', 'hybrid']).describe('Acceptable work format: `remote`, `office`, or `hybrid`.')).min(1).max(matchAppliedFiltersConditionsOneWorkFormatsOneMax),zod.null()]), + "salary_compatibility": zod.union([zod.enum(['compatible', 'not_compatible']).describe('A coarse compatibility result only. No salary amount, minimum, range, or threshold is part of the anonymous card.'),zod.null()]) +}).describe('Conditions echoed as a complete snapshot; null means no filter.'),zod.null()]) +}).describe('A normalized response snapshot of the bank filters. Each key is present; null means the corresponding request filter was omitted. This keeps a search result tied to its exact filter basis.') + +export type MatchAppliedFilters = zod.input; +export type MatchAppliedFiltersOutput = zod.output; diff --git a/frontend/src/shared/api/schemas/organization/matchCategory.zod.ts b/frontend/src/shared/api/schemas/organization/matchCategory.zod.ts new file mode 100644 index 0000000..078ee24 --- /dev/null +++ b/frontend/src/shared/api/schemas/organization/matchCategory.zod.ts @@ -0,0 +1,15 @@ +/** + * Generated by orval 🍺 + * Do not edit manually. + * Lincodex API + * OpenAPI spec version: 0.1.0 + */ +import * as zod from 'zod'; + +export const MatchCategory = zod.object({ + "specialization": zod.enum(['backend', 'frontend', 'mobile', 'network_engineer', 'devops_sre', 'data_analyst', 'ds_ml', 'information_security', 'qa']).describe('Stable code of a specialization. A category is a specialization together with a confirmed grade; programming languages and the technology stack are separate attributes and never form a category of their own, so Backend with Go is the category `backend`, not `go`. Algorithms is a shared assessment module, not a specialization, and has no code here.\n\n- backend: Backend (development).\n- frontend: Frontend (development).\n- mobile: Mobile (development).\n- network_engineer: Network Engineer (infrastructure).\n- devops_sre: DevOps/SRE (infrastructure).\n- data_analyst: Data Analyst (data).\n- ds_ml: DS/ML (data).\n- information_security: Information security (security).\n- qa: QA (quality).\n\nAdding a value is a contract change; renaming or removing one is a breaking change.'), + "grade": zod.enum(['intern', 'junior', 'middle', 'senior']).describe('Grade of the MVP scale in ascending order: `intern`, `junior`, `middle`, `senior`. The same codes describe a self-assessed grade, which the candidate states, and a confirmed grade, which only an assessment result establishes. Lead and Architect are planned after the MVP; adding a value is a contract change.') +}).describe('A confirmed category. Its specialization must equal the enclosing match entry\'s specialization.') + +export type MatchCategory = zod.input; +export type MatchCategoryOutput = zod.output; diff --git a/frontend/src/shared/api/schemas/organization/matchConfirmationStatus.zod.ts b/frontend/src/shared/api/schemas/organization/matchConfirmationStatus.zod.ts new file mode 100644 index 0000000..2551d4f --- /dev/null +++ b/frontend/src/shared/api/schemas/organization/matchConfirmationStatus.zod.ts @@ -0,0 +1,12 @@ +/** + * Generated by orval 🍺 + * Do not edit manually. + * Lincodex API + * OpenAPI spec version: 0.1.0 + */ +import * as zod from 'zod'; + +export const MatchConfirmationStatus = zod.enum(['confirmed', 'unconfirmed']).describe('Confirmation state for this specialization only. A result for one specialization never changes the state of another specialization.') + +export type MatchConfirmationStatus = zod.input; +export type MatchConfirmationStatusOutput = zod.output; diff --git a/frontend/src/shared/api/schemas/organization/matchConfirmedCandidate.zod.ts b/frontend/src/shared/api/schemas/organization/matchConfirmedCandidate.zod.ts new file mode 100644 index 0000000..67c0cd3 --- /dev/null +++ b/frontend/src/shared/api/schemas/organization/matchConfirmedCandidate.zod.ts @@ -0,0 +1,88 @@ +/** + * Generated by orval 🍺 + * Do not edit manually. + * Lincodex API + * OpenAPI spec version: 0.1.0 + */ +import * as zod from 'zod'; + +export const matchConfirmedCandidateCandidateHandleMin = 47; +export const matchConfirmedCandidateCandidateHandleMax = 47; + + +export const matchConfirmedCandidateCandidateHandleRegExp = new RegExp('^cv1_[A-Za-z0-9_-]{43}$'); +export const matchConfirmedCandidatePublicContextStackOneMax = 4; + +export const matchConfirmedCandidatePublicContextWorkFormatsOneMax = 3; + +export const matchConfirmedCandidateEvidenceSummaryMax = 12; + +export const matchConfirmedCandidateComponentsFitMin = 0; +export const matchConfirmedCandidateComponentsFitMax = 1; + +export const matchConfirmedCandidateComponentsCoverageMin = 0; +export const matchConfirmedCandidateComponentsCoverageMax = 1; + +export const matchConfirmedCandidateComponentsDomainMin = 0; +export const matchConfirmedCandidateComponentsDomainMax = 1; + +export const matchConfirmedCandidateComponentsSemanticsMin = 0; +export const matchConfirmedCandidateComponentsSemanticsMax = 1; + +export const matchConfirmedCandidateComponentsPercentileOneMin = 0; +export const matchConfirmedCandidateComponentsPercentileOneMax = 1; + +export const matchConfirmedCandidateComponentsCompetitionMin = 0; +export const matchConfirmedCandidateComponentsCompetitionMax = 1; + +export const matchConfirmedCandidateComponentsFreshnessMin = 0; +export const matchConfirmedCandidateComponentsFreshnessMax = 1; + +export const matchConfirmedCandidateComponentsResponsivenessMin = 0; +export const matchConfirmedCandidateComponentsResponsivenessMax = 1; + +export const matchConfirmedCandidateComponentsRankScoreMin = 0; +export const matchConfirmedCandidateComponentsRankScoreMax = 1; + +export const matchConfirmedCandidateUnknownFlagsMax = 9; + + +export const MatchConfirmedCandidate = zod.object({ + "candidate_handle": zod.string().min(matchConfirmedCandidateCandidateHandleMin).max(matchConfirmedCandidateCandidateHandleMax).regex(matchConfirmedCandidateCandidateHandleRegExp).describe('Opaque reference to a candidate as one organization sees it, taken from the organization-scoped anonymous card. It is a versioned HMAC alias, not a candidate account or profile identifier; it contains no contact information and is meaningless to another organization. The server resolves it only against the current visible cohort of the organization in the path. Clients never parse or construct it. It is shared by the candidate-card read and invitations.'), + "specialization": zod.enum(['backend', 'frontend', 'mobile', 'network_engineer', 'devops_sre', 'data_analyst', 'ds_ml', 'information_security', 'qa']).describe('Stable code of a specialization. A category is a specialization together with a confirmed grade; programming languages and the technology stack are separate attributes and never form a category of their own, so Backend with Go is the category `backend`, not `go`. Algorithms is a shared assessment module, not a specialization, and has no code here.\n\n- backend: Backend (development).\n- frontend: Frontend (development).\n- mobile: Mobile (development).\n- network_engineer: Network Engineer (infrastructure).\n- devops_sre: DevOps/SRE (infrastructure).\n- data_analyst: Data Analyst (data).\n- ds_ml: DS/ML (data).\n- information_security: Information security (security).\n- qa: QA (quality).\n\nAdding a value is a contract change; renaming or removing one is a breaking change.'), + "confirmation_status": zod.enum(['confirmed']), + "declared_grade": zod.union([zod.enum(['intern', 'junior', 'middle', 'senior']).describe('Grade of the MVP scale in ascending order: `intern`, `junior`, `middle`, `senior`. The same codes describe a self-assessed grade, which the candidate states, and a confirmed grade, which only an assessment result establishes. Lead and Architect are planned after the MVP; adding a value is a contract change.'),zod.null()]).describe('Candidate-declared grade for this specialization, never a confirmation.'), + "category": zod.object({ + "specialization": zod.enum(['backend', 'frontend', 'mobile', 'network_engineer', 'devops_sre', 'data_analyst', 'ds_ml', 'information_security', 'qa']).describe('Stable code of a specialization. A category is a specialization together with a confirmed grade; programming languages and the technology stack are separate attributes and never form a category of their own, so Backend with Go is the category `backend`, not `go`. Algorithms is a shared assessment module, not a specialization, and has no code here.\n\n- backend: Backend (development).\n- frontend: Frontend (development).\n- mobile: Mobile (development).\n- network_engineer: Network Engineer (infrastructure).\n- devops_sre: DevOps/SRE (infrastructure).\n- data_analyst: Data Analyst (data).\n- ds_ml: DS/ML (data).\n- information_security: Information security (security).\n- qa: QA (quality).\n\nAdding a value is a contract change; renaming or removing one is a breaking change.'), + "grade": zod.enum(['intern', 'junior', 'middle', 'senior']).describe('Grade of the MVP scale in ascending order: `intern`, `junior`, `middle`, `senior`. The same codes describe a self-assessed grade, which the candidate states, and a confirmed grade, which only an assessment result establishes. Lead and Architect are planned after the MVP; adding a value is a contract change.') +}).describe('A confirmed category. Its specialization must equal the enclosing match entry\'s specialization.'), + "strength": zod.enum(['standard', 'strong']).describe('Coarse strength of a confirmed assessment for this specialization.'), + "public_context": zod.object({ + "stack": zod.union([zod.array(zod.enum(['go', 'postgresql', 'kafka', 'docker']).describe('A stack code that the anonymous card may expose. Search filters do not accept arbitrary profile text or candidate-provided evidence.')).max(matchConfirmedCandidatePublicContextStackOneMax),zod.null()]), + "experience_band": zod.union([zod.enum(['0_1', '1_3', '3_6', '6_plus', '0_3', '3_plus']).describe('Coarse total experience bucket. Rare combinations may be generalized to 0_3 or 3_plus before they are returned.'),zod.null()]), + "work_formats": zod.union([zod.array(zod.enum(['remote', 'office', 'hybrid']).describe('Acceptable work format: `remote`, `office`, or `hybrid`.')).max(matchConfirmedCandidatePublicContextWorkFormatsOneMax),zod.null()]), + "salary_compatibility": zod.union([zod.enum(['compatible', 'not_compatible']).describe('A coarse compatibility result only. No salary amount, minimum, range, or threshold is part of the anonymous card.'),zod.null()]) +}).describe('Safe anonymous-card context only. A null value means that the value is not in the public card or is not present; the response does not reveal which. It contains no contact, candidate location, or salary amount.'), + "evidence_summary": zod.array(zod.object({ + "code": zod.enum(['confirmed_category', 'required_skill_evidence', 'desired_skill_evidence', 'domain_alignment', 'task_alignment', 'work_conditions_match', 'salary_compatibility', 'declared_grade']).describe('Template code for an explanation derived from allowed evidence. It carries no free text, raw answer, or reason for withheld FSP data.'), + "state": zod.enum(['supports', 'partial', 'gap', 'declared_only']) +}).describe('A templated, non-text evidence explanation.')).max(matchConfirmedCandidateEvidenceSummaryMax), + "components": zod.object({ + "fit": zod.number().min(matchConfirmedCandidateComponentsFitMin).max(matchConfirmedCandidateComponentsFitMax).describe('A normalized FR09 ranking component from 0 to 1.'), + "coverage": zod.number().min(matchConfirmedCandidateComponentsCoverageMin).max(matchConfirmedCandidateComponentsCoverageMax).describe('A normalized FR09 ranking component from 0 to 1.'), + "domain": zod.number().min(matchConfirmedCandidateComponentsDomainMin).max(matchConfirmedCandidateComponentsDomainMax).describe('A normalized FR09 ranking component from 0 to 1.'), + "semantics": zod.number().min(matchConfirmedCandidateComponentsSemanticsMin).max(matchConfirmedCandidateComponentsSemanticsMax).describe('A normalized FR09 ranking component from 0 to 1.'), + "percentile": zod.union([zod.number().min(matchConfirmedCandidateComponentsPercentileOneMin).max(matchConfirmedCandidateComponentsPercentileOneMax),zod.null()]).describe('A score from a versioned ranking component, or null when it is not available. Any null component has a matching bounded entry in `unknown_flags`.'), + "competition": zod.number().min(matchConfirmedCandidateComponentsCompetitionMin).max(matchConfirmedCandidateComponentsCompetitionMax).describe('A normalized FR09 ranking component from 0 to 1.'), + "freshness": zod.number().min(matchConfirmedCandidateComponentsFreshnessMin).max(matchConfirmedCandidateComponentsFreshnessMax).describe('A normalized FR09 ranking component from 0 to 1.'), + "responsiveness": zod.number().min(matchConfirmedCandidateComponentsResponsivenessMin).max(matchConfirmedCandidateComponentsResponsivenessMax).describe('A normalized FR09 ranking component from 0 to 1.'), + "rank_score": zod.number().min(matchConfirmedCandidateComponentsRankScoreMin).max(matchConfirmedCandidateComponentsRankScoreMax).describe('A normalized FR09 ranking component from 0 to 1.') +}).describe('Components from the FR09 ranking model for a confirmed category. `percentile` is null when fewer than 30 comparable real candidates are available; the ranking uses neutral T = 0.5 and does not publish a percentile. If ML is unavailable, `semantics` uses neutral 0.5 and the reason appears in `unknown_flags`.'), + "unknown_flags": zod.array(zod.object({ + "component": zod.enum(['semantics', 'percentile', 'assessment', 'freshness', 'responsiveness', 'experience_band', 'work_formats', 'salary_compatibility', 'domain']).describe('Ranking or public-card component whose value is unknown.'), + "reason": zod.enum(['ml_unavailable', 'cohort_below_30', 'no_confirmation_for_specialization', 'not_in_public_card', 'need_field_unconfirmed', 'no_freshness_history', 'no_response_history']).describe('Bounded explanation for an unknown component, not a hiding reason.') +}).describe('A safe, bounded explanation for one unavailable component.')).max(matchConfirmedCandidateUnknownFlagsMax) +}).describe('One confirmed specialization entry in the `main` or `near` group. The group containing it supplies the group label. A candidate may have a separate entry for another specialization.') + +export type MatchConfirmedCandidate = zod.input; +export type MatchConfirmedCandidateOutput = zod.output; diff --git a/frontend/src/shared/api/schemas/organization/matchConfirmedComponents.zod.ts b/frontend/src/shared/api/schemas/organization/matchConfirmedComponents.zod.ts new file mode 100644 index 0000000..4b963c2 --- /dev/null +++ b/frontend/src/shared/api/schemas/organization/matchConfirmedComponents.zod.ts @@ -0,0 +1,50 @@ +/** + * Generated by orval 🍺 + * Do not edit manually. + * Lincodex API + * OpenAPI spec version: 0.1.0 + */ +import * as zod from 'zod'; + +export const matchConfirmedComponentsFitMin = 0; +export const matchConfirmedComponentsFitMax = 1; + +export const matchConfirmedComponentsCoverageMin = 0; +export const matchConfirmedComponentsCoverageMax = 1; + +export const matchConfirmedComponentsDomainMin = 0; +export const matchConfirmedComponentsDomainMax = 1; + +export const matchConfirmedComponentsSemanticsMin = 0; +export const matchConfirmedComponentsSemanticsMax = 1; + +export const matchConfirmedComponentsPercentileOneMin = 0; +export const matchConfirmedComponentsPercentileOneMax = 1; + +export const matchConfirmedComponentsCompetitionMin = 0; +export const matchConfirmedComponentsCompetitionMax = 1; + +export const matchConfirmedComponentsFreshnessMin = 0; +export const matchConfirmedComponentsFreshnessMax = 1; + +export const matchConfirmedComponentsResponsivenessMin = 0; +export const matchConfirmedComponentsResponsivenessMax = 1; + +export const matchConfirmedComponentsRankScoreMin = 0; +export const matchConfirmedComponentsRankScoreMax = 1; + + +export const MatchConfirmedComponents = zod.object({ + "fit": zod.number().min(matchConfirmedComponentsFitMin).max(matchConfirmedComponentsFitMax).describe('A normalized FR09 ranking component from 0 to 1.'), + "coverage": zod.number().min(matchConfirmedComponentsCoverageMin).max(matchConfirmedComponentsCoverageMax).describe('A normalized FR09 ranking component from 0 to 1.'), + "domain": zod.number().min(matchConfirmedComponentsDomainMin).max(matchConfirmedComponentsDomainMax).describe('A normalized FR09 ranking component from 0 to 1.'), + "semantics": zod.number().min(matchConfirmedComponentsSemanticsMin).max(matchConfirmedComponentsSemanticsMax).describe('A normalized FR09 ranking component from 0 to 1.'), + "percentile": zod.union([zod.number().min(matchConfirmedComponentsPercentileOneMin).max(matchConfirmedComponentsPercentileOneMax),zod.null()]).describe('A score from a versioned ranking component, or null when it is not available. Any null component has a matching bounded entry in `unknown_flags`.'), + "competition": zod.number().min(matchConfirmedComponentsCompetitionMin).max(matchConfirmedComponentsCompetitionMax).describe('A normalized FR09 ranking component from 0 to 1.'), + "freshness": zod.number().min(matchConfirmedComponentsFreshnessMin).max(matchConfirmedComponentsFreshnessMax).describe('A normalized FR09 ranking component from 0 to 1.'), + "responsiveness": zod.number().min(matchConfirmedComponentsResponsivenessMin).max(matchConfirmedComponentsResponsivenessMax).describe('A normalized FR09 ranking component from 0 to 1.'), + "rank_score": zod.number().min(matchConfirmedComponentsRankScoreMin).max(matchConfirmedComponentsRankScoreMax).describe('A normalized FR09 ranking component from 0 to 1.') +}).describe('Components from the FR09 ranking model for a confirmed category. `percentile` is null when fewer than 30 comparable real candidates are available; the ranking uses neutral T = 0.5 and does not publish a percentile. If ML is unavailable, `semantics` uses neutral 0.5 and the reason appears in `unknown_flags`.') + +export type MatchConfirmedComponents = zod.input; +export type MatchConfirmedComponentsOutput = zod.output; diff --git a/frontend/src/shared/api/schemas/organization/matchEvidenceCode.zod.ts b/frontend/src/shared/api/schemas/organization/matchEvidenceCode.zod.ts new file mode 100644 index 0000000..ddf14dd --- /dev/null +++ b/frontend/src/shared/api/schemas/organization/matchEvidenceCode.zod.ts @@ -0,0 +1,12 @@ +/** + * Generated by orval 🍺 + * Do not edit manually. + * Lincodex API + * OpenAPI spec version: 0.1.0 + */ +import * as zod from 'zod'; + +export const MatchEvidenceCode = zod.enum(['confirmed_category', 'required_skill_evidence', 'desired_skill_evidence', 'domain_alignment', 'task_alignment', 'work_conditions_match', 'salary_compatibility', 'declared_grade']).describe('Template code for an explanation derived from allowed evidence. It carries no free text, raw answer, or reason for withheld FSP data.') + +export type MatchEvidenceCode = zod.input; +export type MatchEvidenceCodeOutput = zod.output; diff --git a/frontend/src/shared/api/schemas/organization/matchEvidenceState.zod.ts b/frontend/src/shared/api/schemas/organization/matchEvidenceState.zod.ts new file mode 100644 index 0000000..34fcf05 --- /dev/null +++ b/frontend/src/shared/api/schemas/organization/matchEvidenceState.zod.ts @@ -0,0 +1,12 @@ +/** + * Generated by orval 🍺 + * Do not edit manually. + * Lincodex API + * OpenAPI spec version: 0.1.0 + */ +import * as zod from 'zod'; + +export const MatchEvidenceState = zod.enum(['supports', 'partial', 'gap', 'declared_only']) + +export type MatchEvidenceState = zod.input; +export type MatchEvidenceStateOutput = zod.output; diff --git a/frontend/src/shared/api/schemas/organization/matchEvidenceSummary.zod.ts b/frontend/src/shared/api/schemas/organization/matchEvidenceSummary.zod.ts new file mode 100644 index 0000000..cb1d6c9 --- /dev/null +++ b/frontend/src/shared/api/schemas/organization/matchEvidenceSummary.zod.ts @@ -0,0 +1,18 @@ +/** + * Generated by orval 🍺 + * Do not edit manually. + * Lincodex API + * OpenAPI spec version: 0.1.0 + */ +import * as zod from 'zod'; + +export const MatchEvidenceSummaryMax = 12; + + +export const MatchEvidenceSummary = zod.array(zod.object({ + "code": zod.enum(['confirmed_category', 'required_skill_evidence', 'desired_skill_evidence', 'domain_alignment', 'task_alignment', 'work_conditions_match', 'salary_compatibility', 'declared_grade']).describe('Template code for an explanation derived from allowed evidence. It carries no free text, raw answer, or reason for withheld FSP data.'), + "state": zod.enum(['supports', 'partial', 'gap', 'declared_only']) +}).describe('A templated, non-text evidence explanation.')).max(MatchEvidenceSummaryMax) + +export type MatchEvidenceSummary = zod.input; +export type MatchEvidenceSummaryOutput = zod.output; diff --git a/frontend/src/shared/api/schemas/organization/matchEvidenceSummaryItem.zod.ts b/frontend/src/shared/api/schemas/organization/matchEvidenceSummaryItem.zod.ts new file mode 100644 index 0000000..001ad09 --- /dev/null +++ b/frontend/src/shared/api/schemas/organization/matchEvidenceSummaryItem.zod.ts @@ -0,0 +1,15 @@ +/** + * Generated by orval 🍺 + * Do not edit manually. + * Lincodex API + * OpenAPI spec version: 0.1.0 + */ +import * as zod from 'zod'; + +export const MatchEvidenceSummaryItem = zod.object({ + "code": zod.enum(['confirmed_category', 'required_skill_evidence', 'desired_skill_evidence', 'domain_alignment', 'task_alignment', 'work_conditions_match', 'salary_compatibility', 'declared_grade']).describe('Template code for an explanation derived from allowed evidence. It carries no free text, raw answer, or reason for withheld FSP data.'), + "state": zod.enum(['supports', 'partial', 'gap', 'declared_only']) +}).describe('A templated, non-text evidence explanation.') + +export type MatchEvidenceSummaryItem = zod.input; +export type MatchEvidenceSummaryItemOutput = zod.output; diff --git a/frontend/src/shared/api/schemas/organization/matchGradeFilter.zod.ts b/frontend/src/shared/api/schemas/organization/matchGradeFilter.zod.ts new file mode 100644 index 0000000..a52c7cd --- /dev/null +++ b/frontend/src/shared/api/schemas/organization/matchGradeFilter.zod.ts @@ -0,0 +1,15 @@ +/** + * Generated by orval 🍺 + * Do not edit manually. + * Lincodex API + * OpenAPI spec version: 0.1.0 + */ +import * as zod from 'zod'; + +export const MatchGradeFilter = zod.object({ + "specialization": zod.enum(['backend', 'frontend', 'mobile', 'network_engineer', 'devops_sre', 'data_analyst', 'ds_ml', 'information_security', 'qa']).describe('Stable code of a specialization. A category is a specialization together with a confirmed grade; programming languages and the technology stack are separate attributes and never form a category of their own, so Backend with Go is the category `backend`, not `go`. Algorithms is a shared assessment module, not a specialization, and has no code here.\n\n- backend: Backend (development).\n- frontend: Frontend (development).\n- mobile: Mobile (development).\n- network_engineer: Network Engineer (infrastructure).\n- devops_sre: DevOps/SRE (infrastructure).\n- data_analyst: Data Analyst (data).\n- ds_ml: DS/ML (data).\n- information_security: Information security (security).\n- qa: QA (quality).\n\nAdding a value is a contract change; renaming or removing one is a breaking change.'), + "grade": zod.enum(['intern', 'junior', 'middle', 'senior']).describe('Grade of the MVP scale in ascending order: `intern`, `junior`, `middle`, `senior`. The same codes describe a self-assessed grade, which the candidate states, and a confirmed grade, which only an assessment result establishes. Lead and Architect are planned after the MVP; adding a value is a contract change.') +}).describe('A confirmed category filter, never a candidate declaration.') + +export type MatchGradeFilter = zod.input; +export type MatchGradeFilterOutput = zod.output; diff --git a/frontend/src/shared/api/schemas/organization/matchNullableScore.zod.ts b/frontend/src/shared/api/schemas/organization/matchNullableScore.zod.ts new file mode 100644 index 0000000..7e4261d --- /dev/null +++ b/frontend/src/shared/api/schemas/organization/matchNullableScore.zod.ts @@ -0,0 +1,16 @@ +/** + * Generated by orval 🍺 + * Do not edit manually. + * Lincodex API + * OpenAPI spec version: 0.1.0 + */ +import * as zod from 'zod'; + +export const matchNullableScoreOneMin = 0; +export const matchNullableScoreOneMax = 1; + + +export const MatchNullableScore = zod.union([zod.number().min(matchNullableScoreOneMin).max(matchNullableScoreOneMax),zod.null()]).describe('A score from a versioned ranking component, or null when it is not available. Any null component has a matching bounded entry in `unknown_flags`.') + +export type MatchNullableScore = zod.input; +export type MatchNullableScoreOutput = zod.output; diff --git a/frontend/src/shared/api/schemas/organization/matchPublicContext.zod.ts b/frontend/src/shared/api/schemas/organization/matchPublicContext.zod.ts new file mode 100644 index 0000000..b4ce6e4 --- /dev/null +++ b/frontend/src/shared/api/schemas/organization/matchPublicContext.zod.ts @@ -0,0 +1,22 @@ +/** + * Generated by orval 🍺 + * Do not edit manually. + * Lincodex API + * OpenAPI spec version: 0.1.0 + */ +import * as zod from 'zod'; + +export const matchPublicContextStackOneMax = 4; + +export const matchPublicContextWorkFormatsOneMax = 3; + + +export const MatchPublicContext = zod.object({ + "stack": zod.union([zod.array(zod.enum(['go', 'postgresql', 'kafka', 'docker']).describe('A stack code that the anonymous card may expose. Search filters do not accept arbitrary profile text or candidate-provided evidence.')).max(matchPublicContextStackOneMax),zod.null()]), + "experience_band": zod.union([zod.enum(['0_1', '1_3', '3_6', '6_plus', '0_3', '3_plus']).describe('Coarse total experience bucket. Rare combinations may be generalized to 0_3 or 3_plus before they are returned.'),zod.null()]), + "work_formats": zod.union([zod.array(zod.enum(['remote', 'office', 'hybrid']).describe('Acceptable work format: `remote`, `office`, or `hybrid`.')).max(matchPublicContextWorkFormatsOneMax),zod.null()]), + "salary_compatibility": zod.union([zod.enum(['compatible', 'not_compatible']).describe('A coarse compatibility result only. No salary amount, minimum, range, or threshold is part of the anonymous card.'),zod.null()]) +}).describe('Safe anonymous-card context only. A null value means that the value is not in the public card or is not present; the response does not reveal which. It contains no contact, candidate location, or salary amount.') + +export type MatchPublicContext = zod.input; +export type MatchPublicContextOutput = zod.output; diff --git a/frontend/src/shared/api/schemas/organization/matchPublicStack.zod.ts b/frontend/src/shared/api/schemas/organization/matchPublicStack.zod.ts new file mode 100644 index 0000000..000af6b --- /dev/null +++ b/frontend/src/shared/api/schemas/organization/matchPublicStack.zod.ts @@ -0,0 +1,15 @@ +/** + * Generated by orval 🍺 + * Do not edit manually. + * Lincodex API + * OpenAPI spec version: 0.1.0 + */ +import * as zod from 'zod'; + +export const MatchPublicStackMax = 4; + + +export const MatchPublicStack = zod.array(zod.enum(['go', 'postgresql', 'kafka', 'docker']).describe('A stack code that the anonymous card may expose. Search filters do not accept arbitrary profile text or candidate-provided evidence.')).max(MatchPublicStackMax) + +export type MatchPublicStack = zod.input; +export type MatchPublicStackOutput = zod.output; diff --git a/frontend/src/shared/api/schemas/organization/matchScore.zod.ts b/frontend/src/shared/api/schemas/organization/matchScore.zod.ts new file mode 100644 index 0000000..fc7ebd7 --- /dev/null +++ b/frontend/src/shared/api/schemas/organization/matchScore.zod.ts @@ -0,0 +1,16 @@ +/** + * Generated by orval 🍺 + * Do not edit manually. + * Lincodex API + * OpenAPI spec version: 0.1.0 + */ +import * as zod from 'zod'; + +export const MatchScoreMin = 0; +export const MatchScoreMax = 1; + + +export const MatchScore = zod.number().min(MatchScoreMin).max(MatchScoreMax).describe('A normalized FR09 ranking component from 0 to 1.') + +export type MatchScore = zod.input; +export type MatchScoreOutput = zod.output; diff --git a/frontend/src/shared/api/schemas/organization/matchSearchBankSource.zod.ts b/frontend/src/shared/api/schemas/organization/matchSearchBankSource.zod.ts new file mode 100644 index 0000000..a3f67ee --- /dev/null +++ b/frontend/src/shared/api/schemas/organization/matchSearchBankSource.zod.ts @@ -0,0 +1,34 @@ +/** + * Generated by orval 🍺 + * Do not edit manually. + * Lincodex API + * OpenAPI spec version: 0.1.0 + */ +import * as zod from 'zod'; + +export const matchSearchBankSourceFiltersStackOneMax = 4; + +export const matchSearchBankSourceFiltersConditionsOneWorkFormatsOneMax = 3; + + +export const MatchSearchBankSource = zod.object({ + "kind": zod.enum(['bank']), + "filters": zod.object({ + "specialization": zod.union([zod.enum(['backend', 'frontend', 'mobile', 'network_engineer', 'devops_sre', 'data_analyst', 'ds_ml', 'information_security', 'qa']).describe('Stable code of a specialization. A category is a specialization together with a confirmed grade; programming languages and the technology stack are separate attributes and never form a category of their own, so Backend with Go is the category `backend`, not `go`. Algorithms is a shared assessment module, not a specialization, and has no code here.\n\n- backend: Backend (development).\n- frontend: Frontend (development).\n- mobile: Mobile (development).\n- network_engineer: Network Engineer (infrastructure).\n- devops_sre: DevOps/SRE (infrastructure).\n- data_analyst: Data Analyst (data).\n- ds_ml: DS/ML (data).\n- information_security: Information security (security).\n- qa: QA (quality).\n\nAdding a value is a contract change; renaming or removing one is a breaking change.'),zod.null()]), + "confirmed_grade": zod.union([zod.enum(['intern', 'junior', 'middle', 'senior']).describe('Grade of the MVP scale in ascending order: `intern`, `junior`, `middle`, `senior`. The same codes describe a self-assessed grade, which the candidate states, and a confirmed grade, which only an assessment result establishes. Lead and Architect are planned after the MVP; adding a value is a contract change.'),zod.null()]), + "confirmed_category": zod.union([zod.object({ + "specialization": zod.enum(['backend', 'frontend', 'mobile', 'network_engineer', 'devops_sre', 'data_analyst', 'ds_ml', 'information_security', 'qa']).describe('Stable code of a specialization. A category is a specialization together with a confirmed grade; programming languages and the technology stack are separate attributes and never form a category of their own, so Backend with Go is the category `backend`, not `go`. Algorithms is a shared assessment module, not a specialization, and has no code here.\n\n- backend: Backend (development).\n- frontend: Frontend (development).\n- mobile: Mobile (development).\n- network_engineer: Network Engineer (infrastructure).\n- devops_sre: DevOps/SRE (infrastructure).\n- data_analyst: Data Analyst (data).\n- ds_ml: DS/ML (data).\n- information_security: Information security (security).\n- qa: QA (quality).\n\nAdding a value is a contract change; renaming or removing one is a breaking change.'), + "grade": zod.enum(['intern', 'junior', 'middle', 'senior']).describe('Grade of the MVP scale in ascending order: `intern`, `junior`, `middle`, `senior`. The same codes describe a self-assessed grade, which the candidate states, and a confirmed grade, which only an assessment result establishes. Lead and Architect are planned after the MVP; adding a value is a contract change.') +}).describe('A confirmed category filter, never a candidate declaration.'),zod.null()]), + "confirmation_status": zod.union([zod.enum(['confirmed', 'unconfirmed']).describe('Confirmation state for this specialization only. A result for one specialization never changes the state of another specialization.'),zod.null()]), + "declared_grade": zod.union([zod.enum(['intern', 'junior', 'middle', 'senior']).describe('Grade of the MVP scale in ascending order: `intern`, `junior`, `middle`, `senior`. The same codes describe a self-assessed grade, which the candidate states, and a confirmed grade, which only an assessment result establishes. Lead and Architect are planned after the MVP; adding a value is a contract change.'),zod.null()]), + "stack": zod.union([zod.array(zod.enum(['go', 'postgresql', 'kafka', 'docker']).describe('A stack code that the anonymous card may expose. Search filters do not accept arbitrary profile text or candidate-provided evidence.')).min(1).max(matchSearchBankSourceFiltersStackOneMax),zod.null()]), + "conditions": zod.union([zod.object({ + "work_formats": zod.union([zod.array(zod.enum(['remote', 'office', 'hybrid']).describe('Acceptable work format: `remote`, `office`, or `hybrid`.')).min(1).max(matchSearchBankSourceFiltersConditionsOneWorkFormatsOneMax),zod.null()]), + "salary_compatibility": zod.union([zod.enum(['compatible', 'not_compatible']).describe('A coarse compatibility result only. No salary amount, minimum, range, or threshold is part of the anonymous card.'),zod.null()]) +}).describe('Conditions echoed as a complete snapshot; null means no filter.'),zod.null()]) +}).describe('A normalized response snapshot of the bank filters. Each key is present; null means the corresponding request filter was omitted. This keeps a search result tied to its exact filter basis.') +}).describe('The normalized filters used for a bank search.') + +export type MatchSearchBankSource = zod.input; +export type MatchSearchBankSourceOutput = zod.output; diff --git a/frontend/src/shared/api/schemas/organization/matchSearchByBank.zod.ts b/frontend/src/shared/api/schemas/organization/matchSearchByBank.zod.ts new file mode 100644 index 0000000..fcba898 --- /dev/null +++ b/frontend/src/shared/api/schemas/organization/matchSearchByBank.zod.ts @@ -0,0 +1,33 @@ +/** + * Generated by orval 🍺 + * Do not edit manually. + * Lincodex API + * OpenAPI spec version: 0.1.0 + */ +import * as zod from 'zod'; + +export const matchSearchByBankFiltersStackMax = 4; + +export const matchSearchByBankFiltersConditionsWorkFormatsMax = 3; + + +export const MatchSearchByBank = zod.object({ + "filters": zod.object({ + "specialization": zod.enum(['backend', 'frontend', 'mobile', 'network_engineer', 'devops_sre', 'data_analyst', 'ds_ml', 'information_security', 'qa']).exactOptional().describe('Stable code of a specialization. A category is a specialization together with a confirmed grade; programming languages and the technology stack are separate attributes and never form a category of their own, so Backend with Go is the category `backend`, not `go`. Algorithms is a shared assessment module, not a specialization, and has no code here.\n\n- backend: Backend (development).\n- frontend: Frontend (development).\n- mobile: Mobile (development).\n- network_engineer: Network Engineer (infrastructure).\n- devops_sre: DevOps/SRE (infrastructure).\n- data_analyst: Data Analyst (data).\n- ds_ml: DS/ML (data).\n- information_security: Information security (security).\n- qa: QA (quality).\n\nAdding a value is a contract change; renaming or removing one is a breaking change.'), + "confirmed_grade": zod.enum(['intern', 'junior', 'middle', 'senior']).exactOptional().describe('Match only candidates with this currently confirmed grade in the selected specialization. It never matches a declared grade.'), + "confirmed_category": zod.object({ + "specialization": zod.enum(['backend', 'frontend', 'mobile', 'network_engineer', 'devops_sre', 'data_analyst', 'ds_ml', 'information_security', 'qa']).describe('Stable code of a specialization. A category is a specialization together with a confirmed grade; programming languages and the technology stack are separate attributes and never form a category of their own, so Backend with Go is the category `backend`, not `go`. Algorithms is a shared assessment module, not a specialization, and has no code here.\n\n- backend: Backend (development).\n- frontend: Frontend (development).\n- mobile: Mobile (development).\n- network_engineer: Network Engineer (infrastructure).\n- devops_sre: DevOps/SRE (infrastructure).\n- data_analyst: Data Analyst (data).\n- ds_ml: DS/ML (data).\n- information_security: Information security (security).\n- qa: QA (quality).\n\nAdding a value is a contract change; renaming or removing one is a breaking change.'), + "grade": zod.enum(['intern', 'junior', 'middle', 'senior']).describe('Grade of the MVP scale in ascending order: `intern`, `junior`, `middle`, `senior`. The same codes describe a self-assessed grade, which the candidate states, and a confirmed grade, which only an assessment result establishes. Lead and Architect are planned after the MVP; adding a value is a contract change.') +}).exactOptional().describe('A confirmed category filter, never a candidate declaration.'), + "confirmation_status": zod.enum(['confirmed', 'unconfirmed']).exactOptional().describe('Confirmation state for this specialization only. A result for one specialization never changes the state of another specialization.'), + "declared_grade": zod.enum(['intern', 'junior', 'middle', 'senior']).exactOptional().describe('Candidate-declared grade filter. This is a separate claim and cannot satisfy `confirmed_grade` or `confirmed_category`.'), + "stack": zod.array(zod.enum(['go', 'postgresql', 'kafka', 'docker']).describe('A stack code that the anonymous card may expose. Search filters do not accept arbitrary profile text or candidate-provided evidence.')).min(1).max(matchSearchByBankFiltersStackMax).exactOptional(), + "conditions": zod.object({ + "work_formats": zod.array(zod.enum(['remote', 'office', 'hybrid']).describe('Acceptable work format: `remote`, `office`, or `hybrid`.')).min(1).max(matchSearchByBankFiltersConditionsWorkFormatsMax).exactOptional(), + "salary_compatibility": zod.enum(['compatible', 'not_compatible']).exactOptional().describe('A coarse compatibility result only. No salary amount, minimum, range, or threshold is part of the anonymous card.') +}).exactOptional().describe('Filters against safe, coarse card conditions. No candidate location, salary amount, salary minimum, or salary range is accepted.') +}).describe('Optional filters over the current organization-visible bank. An empty object means no additional filter. Confirmed and declared grades are separate fields; a declaration never satisfies a confirmed-grade or category filter. Conditions use only the safe, coarse card fields.') +}).describe('Search the current organization-visible bank. An empty `filters` object includes all otherwise eligible specializations as separate entries.') + +export type MatchSearchByBank = zod.input; +export type MatchSearchByBankOutput = zod.output; diff --git a/frontend/src/shared/api/schemas/organization/matchSearchByNeed.zod.ts b/frontend/src/shared/api/schemas/organization/matchSearchByNeed.zod.ts new file mode 100644 index 0000000..1123986 --- /dev/null +++ b/frontend/src/shared/api/schemas/organization/matchSearchByNeed.zod.ts @@ -0,0 +1,36 @@ +/** + * Generated by orval 🍺 + * Do not edit manually. + * Lincodex API + * OpenAPI spec version: 0.1.0 + */ +import * as zod from 'zod'; + + +export const matchSearchByNeedFiltersStackMax = 4; + +export const matchSearchByNeedFiltersConditionsWorkFormatsMax = 3; + + +export const MatchSearchByNeed = zod.object({ + "need_id": zod.uuid().describe('Need owned by the organization in the path.'), + "requirements_version": zod.int().min(1).describe('Version of an employer need. Creation makes version 1, and every committed change of the need advances it by exactly one, including a change made by the server, such as a planned asynchronous ML suggestion. Each version is an immutable snapshot of the need. `requirements_version` names the version whose confirmed requirements are current, so a change that leaves them unchanged creates a need version without a new requirements version.'), + "filters": zod.object({ + "specialization": zod.enum(['backend', 'frontend', 'mobile', 'network_engineer', 'devops_sre', 'data_analyst', 'ds_ml', 'information_security', 'qa']).exactOptional().describe('Stable code of a specialization. A category is a specialization together with a confirmed grade; programming languages and the technology stack are separate attributes and never form a category of their own, so Backend with Go is the category `backend`, not `go`. Algorithms is a shared assessment module, not a specialization, and has no code here.\n\n- backend: Backend (development).\n- frontend: Frontend (development).\n- mobile: Mobile (development).\n- network_engineer: Network Engineer (infrastructure).\n- devops_sre: DevOps/SRE (infrastructure).\n- data_analyst: Data Analyst (data).\n- ds_ml: DS/ML (data).\n- information_security: Information security (security).\n- qa: QA (quality).\n\nAdding a value is a contract change; renaming or removing one is a breaking change.'), + "confirmed_grade": zod.enum(['intern', 'junior', 'middle', 'senior']).exactOptional().describe('Match only candidates with this currently confirmed grade in the selected specialization. It never matches a declared grade.'), + "confirmed_category": zod.object({ + "specialization": zod.enum(['backend', 'frontend', 'mobile', 'network_engineer', 'devops_sre', 'data_analyst', 'ds_ml', 'information_security', 'qa']).describe('Stable code of a specialization. A category is a specialization together with a confirmed grade; programming languages and the technology stack are separate attributes and never form a category of their own, so Backend with Go is the category `backend`, not `go`. Algorithms is a shared assessment module, not a specialization, and has no code here.\n\n- backend: Backend (development).\n- frontend: Frontend (development).\n- mobile: Mobile (development).\n- network_engineer: Network Engineer (infrastructure).\n- devops_sre: DevOps/SRE (infrastructure).\n- data_analyst: Data Analyst (data).\n- ds_ml: DS/ML (data).\n- information_security: Information security (security).\n- qa: QA (quality).\n\nAdding a value is a contract change; renaming or removing one is a breaking change.'), + "grade": zod.enum(['intern', 'junior', 'middle', 'senior']).describe('Grade of the MVP scale in ascending order: `intern`, `junior`, `middle`, `senior`. The same codes describe a self-assessed grade, which the candidate states, and a confirmed grade, which only an assessment result establishes. Lead and Architect are planned after the MVP; adding a value is a contract change.') +}).exactOptional().describe('A confirmed category filter, never a candidate declaration.'), + "confirmation_status": zod.enum(['confirmed', 'unconfirmed']).exactOptional().describe('Confirmation state for this specialization only. A result for one specialization never changes the state of another specialization.'), + "declared_grade": zod.enum(['intern', 'junior', 'middle', 'senior']).exactOptional().describe('Candidate-declared grade filter. This is a separate claim and cannot satisfy `confirmed_grade` or `confirmed_category`.'), + "stack": zod.array(zod.enum(['go', 'postgresql', 'kafka', 'docker']).describe('A stack code that the anonymous card may expose. Search filters do not accept arbitrary profile text or candidate-provided evidence.')).min(1).max(matchSearchByNeedFiltersStackMax).exactOptional(), + "conditions": zod.object({ + "work_formats": zod.array(zod.enum(['remote', 'office', 'hybrid']).describe('Acceptable work format: `remote`, `office`, or `hybrid`.')).min(1).max(matchSearchByNeedFiltersConditionsWorkFormatsMax).exactOptional(), + "salary_compatibility": zod.enum(['compatible', 'not_compatible']).exactOptional().describe('A coarse compatibility result only. No salary amount, minimum, range, or threshold is part of the anonymous card.') +}).exactOptional().describe('Filters against safe, coarse card conditions. No candidate location, salary amount, salary minimum, or salary range is accepted.') +}).exactOptional().describe('Optional filters over the current organization-visible bank. An empty object means no additional filter. Confirmed and declared grades are separate fields; a declaration never satisfies a confirmed-grade or category filter. Conditions use only the safe, coarse card fields.') +}).describe('Search one immutable set of confirmed requirements. `requirements_version` is the Need.requirements_version, not the general Need.version; text-only or suggestion-only edits do not change this search basis.') + +export type MatchSearchByNeed = zod.input; +export type MatchSearchByNeedOutput = zod.output; diff --git a/frontend/src/shared/api/schemas/organization/matchSearchConditions.zod.ts b/frontend/src/shared/api/schemas/organization/matchSearchConditions.zod.ts new file mode 100644 index 0000000..d89c80b --- /dev/null +++ b/frontend/src/shared/api/schemas/organization/matchSearchConditions.zod.ts @@ -0,0 +1,18 @@ +/** + * Generated by orval 🍺 + * Do not edit manually. + * Lincodex API + * OpenAPI spec version: 0.1.0 + */ +import * as zod from 'zod'; + +export const matchSearchConditionsWorkFormatsMax = 3; + + +export const MatchSearchConditions = zod.object({ + "work_formats": zod.array(zod.enum(['remote', 'office', 'hybrid']).describe('Acceptable work format: `remote`, `office`, or `hybrid`.')).min(1).max(matchSearchConditionsWorkFormatsMax).exactOptional(), + "salary_compatibility": zod.enum(['compatible', 'not_compatible']).exactOptional().describe('A coarse compatibility result only. No salary amount, minimum, range, or threshold is part of the anonymous card.') +}).describe('Filters against safe, coarse card conditions. No candidate location, salary amount, salary minimum, or salary range is accepted.') + +export type MatchSearchConditions = zod.input; +export type MatchSearchConditionsOutput = zod.output; diff --git a/frontend/src/shared/api/schemas/organization/matchSearchFilters.zod.ts b/frontend/src/shared/api/schemas/organization/matchSearchFilters.zod.ts new file mode 100644 index 0000000..4744eac --- /dev/null +++ b/frontend/src/shared/api/schemas/organization/matchSearchFilters.zod.ts @@ -0,0 +1,31 @@ +/** + * Generated by orval 🍺 + * Do not edit manually. + * Lincodex API + * OpenAPI spec version: 0.1.0 + */ +import * as zod from 'zod'; + +export const matchSearchFiltersStackMax = 4; + +export const matchSearchFiltersConditionsWorkFormatsMax = 3; + + +export const MatchSearchFilters = zod.object({ + "specialization": zod.enum(['backend', 'frontend', 'mobile', 'network_engineer', 'devops_sre', 'data_analyst', 'ds_ml', 'information_security', 'qa']).exactOptional().describe('Stable code of a specialization. A category is a specialization together with a confirmed grade; programming languages and the technology stack are separate attributes and never form a category of their own, so Backend with Go is the category `backend`, not `go`. Algorithms is a shared assessment module, not a specialization, and has no code here.\n\n- backend: Backend (development).\n- frontend: Frontend (development).\n- mobile: Mobile (development).\n- network_engineer: Network Engineer (infrastructure).\n- devops_sre: DevOps/SRE (infrastructure).\n- data_analyst: Data Analyst (data).\n- ds_ml: DS/ML (data).\n- information_security: Information security (security).\n- qa: QA (quality).\n\nAdding a value is a contract change; renaming or removing one is a breaking change.'), + "confirmed_grade": zod.enum(['intern', 'junior', 'middle', 'senior']).exactOptional().describe('Match only candidates with this currently confirmed grade in the selected specialization. It never matches a declared grade.'), + "confirmed_category": zod.object({ + "specialization": zod.enum(['backend', 'frontend', 'mobile', 'network_engineer', 'devops_sre', 'data_analyst', 'ds_ml', 'information_security', 'qa']).describe('Stable code of a specialization. A category is a specialization together with a confirmed grade; programming languages and the technology stack are separate attributes and never form a category of their own, so Backend with Go is the category `backend`, not `go`. Algorithms is a shared assessment module, not a specialization, and has no code here.\n\n- backend: Backend (development).\n- frontend: Frontend (development).\n- mobile: Mobile (development).\n- network_engineer: Network Engineer (infrastructure).\n- devops_sre: DevOps/SRE (infrastructure).\n- data_analyst: Data Analyst (data).\n- ds_ml: DS/ML (data).\n- information_security: Information security (security).\n- qa: QA (quality).\n\nAdding a value is a contract change; renaming or removing one is a breaking change.'), + "grade": zod.enum(['intern', 'junior', 'middle', 'senior']).describe('Grade of the MVP scale in ascending order: `intern`, `junior`, `middle`, `senior`. The same codes describe a self-assessed grade, which the candidate states, and a confirmed grade, which only an assessment result establishes. Lead and Architect are planned after the MVP; adding a value is a contract change.') +}).exactOptional().describe('A confirmed category filter, never a candidate declaration.'), + "confirmation_status": zod.enum(['confirmed', 'unconfirmed']).exactOptional().describe('Confirmation state for this specialization only. A result for one specialization never changes the state of another specialization.'), + "declared_grade": zod.enum(['intern', 'junior', 'middle', 'senior']).exactOptional().describe('Candidate-declared grade filter. This is a separate claim and cannot satisfy `confirmed_grade` or `confirmed_category`.'), + "stack": zod.array(zod.enum(['go', 'postgresql', 'kafka', 'docker']).describe('A stack code that the anonymous card may expose. Search filters do not accept arbitrary profile text or candidate-provided evidence.')).min(1).max(matchSearchFiltersStackMax).exactOptional(), + "conditions": zod.object({ + "work_formats": zod.array(zod.enum(['remote', 'office', 'hybrid']).describe('Acceptable work format: `remote`, `office`, or `hybrid`.')).min(1).max(matchSearchFiltersConditionsWorkFormatsMax).exactOptional(), + "salary_compatibility": zod.enum(['compatible', 'not_compatible']).exactOptional().describe('A coarse compatibility result only. No salary amount, minimum, range, or threshold is part of the anonymous card.') +}).exactOptional().describe('Filters against safe, coarse card conditions. No candidate location, salary amount, salary minimum, or salary range is accepted.') +}).describe('Optional filters over the current organization-visible bank. An empty object means no additional filter. Confirmed and declared grades are separate fields; a declaration never satisfies a confirmed-grade or category filter. Conditions use only the safe, coarse card fields.') + +export type MatchSearchFilters = zod.input; +export type MatchSearchFiltersOutput = zod.output; diff --git a/frontend/src/shared/api/schemas/organization/matchSearchGroups.zod.ts b/frontend/src/shared/api/schemas/organization/matchSearchGroups.zod.ts new file mode 100644 index 0000000..227bf73 --- /dev/null +++ b/frontend/src/shared/api/schemas/organization/matchSearchGroups.zod.ts @@ -0,0 +1,211 @@ +/** + * Generated by orval 🍺 + * Do not edit manually. + * Lincodex API + * OpenAPI spec version: 0.1.0 + */ +import * as zod from 'zod'; + +export const matchSearchGroupsMainItemCandidateHandleMin = 47; +export const matchSearchGroupsMainItemCandidateHandleMax = 47; + + +export const matchSearchGroupsMainItemCandidateHandleRegExp = new RegExp('^cv1_[A-Za-z0-9_-]{43}$'); +export const matchSearchGroupsMainItemPublicContextStackOneMax = 4; + +export const matchSearchGroupsMainItemPublicContextWorkFormatsOneMax = 3; + +export const matchSearchGroupsMainItemEvidenceSummaryMax = 12; + +export const matchSearchGroupsMainItemComponentsFitMin = 0; +export const matchSearchGroupsMainItemComponentsFitMax = 1; + +export const matchSearchGroupsMainItemComponentsCoverageMin = 0; +export const matchSearchGroupsMainItemComponentsCoverageMax = 1; + +export const matchSearchGroupsMainItemComponentsDomainMin = 0; +export const matchSearchGroupsMainItemComponentsDomainMax = 1; + +export const matchSearchGroupsMainItemComponentsSemanticsMin = 0; +export const matchSearchGroupsMainItemComponentsSemanticsMax = 1; + +export const matchSearchGroupsMainItemComponentsPercentileOneMin = 0; +export const matchSearchGroupsMainItemComponentsPercentileOneMax = 1; + +export const matchSearchGroupsMainItemComponentsCompetitionMin = 0; +export const matchSearchGroupsMainItemComponentsCompetitionMax = 1; + +export const matchSearchGroupsMainItemComponentsFreshnessMin = 0; +export const matchSearchGroupsMainItemComponentsFreshnessMax = 1; + +export const matchSearchGroupsMainItemComponentsResponsivenessMin = 0; +export const matchSearchGroupsMainItemComponentsResponsivenessMax = 1; + +export const matchSearchGroupsMainItemComponentsRankScoreMin = 0; +export const matchSearchGroupsMainItemComponentsRankScoreMax = 1; + +export const matchSearchGroupsMainItemUnknownFlagsMax = 9; + +export const matchSearchGroupsNearItemCandidateHandleMin = 47; +export const matchSearchGroupsNearItemCandidateHandleMax = 47; + + +export const matchSearchGroupsNearItemCandidateHandleRegExp = new RegExp('^cv1_[A-Za-z0-9_-]{43}$'); +export const matchSearchGroupsNearItemPublicContextStackOneMax = 4; + +export const matchSearchGroupsNearItemPublicContextWorkFormatsOneMax = 3; + +export const matchSearchGroupsNearItemEvidenceSummaryMax = 12; + +export const matchSearchGroupsNearItemComponentsFitMin = 0; +export const matchSearchGroupsNearItemComponentsFitMax = 1; + +export const matchSearchGroupsNearItemComponentsCoverageMin = 0; +export const matchSearchGroupsNearItemComponentsCoverageMax = 1; + +export const matchSearchGroupsNearItemComponentsDomainMin = 0; +export const matchSearchGroupsNearItemComponentsDomainMax = 1; + +export const matchSearchGroupsNearItemComponentsSemanticsMin = 0; +export const matchSearchGroupsNearItemComponentsSemanticsMax = 1; + +export const matchSearchGroupsNearItemComponentsPercentileOneMin = 0; +export const matchSearchGroupsNearItemComponentsPercentileOneMax = 1; + +export const matchSearchGroupsNearItemComponentsCompetitionMin = 0; +export const matchSearchGroupsNearItemComponentsCompetitionMax = 1; + +export const matchSearchGroupsNearItemComponentsFreshnessMin = 0; +export const matchSearchGroupsNearItemComponentsFreshnessMax = 1; + +export const matchSearchGroupsNearItemComponentsResponsivenessMin = 0; +export const matchSearchGroupsNearItemComponentsResponsivenessMax = 1; + +export const matchSearchGroupsNearItemComponentsRankScoreMin = 0; +export const matchSearchGroupsNearItemComponentsRankScoreMax = 1; + +export const matchSearchGroupsNearItemUnknownFlagsMax = 9; + +export const matchSearchGroupsUnconfirmedItemCandidateHandleMin = 47; +export const matchSearchGroupsUnconfirmedItemCandidateHandleMax = 47; + + +export const matchSearchGroupsUnconfirmedItemCandidateHandleRegExp = new RegExp('^cv1_[A-Za-z0-9_-]{43}$'); +export const matchSearchGroupsUnconfirmedItemPublicContextStackOneMax = 4; + +export const matchSearchGroupsUnconfirmedItemPublicContextWorkFormatsOneMax = 3; + +export const matchSearchGroupsUnconfirmedItemEvidenceSummaryMax = 12; + +export const matchSearchGroupsUnconfirmedItemComponentsFitMin = 0; +export const matchSearchGroupsUnconfirmedItemComponentsFitMax = 1; + +export const matchSearchGroupsUnconfirmedItemComponentsCoverageMin = 0; +export const matchSearchGroupsUnconfirmedItemComponentsCoverageMax = 1; + +export const matchSearchGroupsUnconfirmedItemUnknownFlagsMax = 9; + + +export const MatchSearchGroups = zod.object({ + "main": zod.array(zod.object({ + "candidate_handle": zod.string().min(matchSearchGroupsMainItemCandidateHandleMin).max(matchSearchGroupsMainItemCandidateHandleMax).regex(matchSearchGroupsMainItemCandidateHandleRegExp).describe('Opaque reference to a candidate as one organization sees it, taken from the organization-scoped anonymous card. It is a versioned HMAC alias, not a candidate account or profile identifier; it contains no contact information and is meaningless to another organization. The server resolves it only against the current visible cohort of the organization in the path. Clients never parse or construct it. It is shared by the candidate-card read and invitations.'), + "specialization": zod.enum(['backend', 'frontend', 'mobile', 'network_engineer', 'devops_sre', 'data_analyst', 'ds_ml', 'information_security', 'qa']).describe('Stable code of a specialization. A category is a specialization together with a confirmed grade; programming languages and the technology stack are separate attributes and never form a category of their own, so Backend with Go is the category `backend`, not `go`. Algorithms is a shared assessment module, not a specialization, and has no code here.\n\n- backend: Backend (development).\n- frontend: Frontend (development).\n- mobile: Mobile (development).\n- network_engineer: Network Engineer (infrastructure).\n- devops_sre: DevOps/SRE (infrastructure).\n- data_analyst: Data Analyst (data).\n- ds_ml: DS/ML (data).\n- information_security: Information security (security).\n- qa: QA (quality).\n\nAdding a value is a contract change; renaming or removing one is a breaking change.'), + "confirmation_status": zod.enum(['confirmed']), + "declared_grade": zod.union([zod.enum(['intern', 'junior', 'middle', 'senior']).describe('Grade of the MVP scale in ascending order: `intern`, `junior`, `middle`, `senior`. The same codes describe a self-assessed grade, which the candidate states, and a confirmed grade, which only an assessment result establishes. Lead and Architect are planned after the MVP; adding a value is a contract change.'),zod.null()]).describe('Candidate-declared grade for this specialization, never a confirmation.'), + "category": zod.object({ + "specialization": zod.enum(['backend', 'frontend', 'mobile', 'network_engineer', 'devops_sre', 'data_analyst', 'ds_ml', 'information_security', 'qa']).describe('Stable code of a specialization. A category is a specialization together with a confirmed grade; programming languages and the technology stack are separate attributes and never form a category of their own, so Backend with Go is the category `backend`, not `go`. Algorithms is a shared assessment module, not a specialization, and has no code here.\n\n- backend: Backend (development).\n- frontend: Frontend (development).\n- mobile: Mobile (development).\n- network_engineer: Network Engineer (infrastructure).\n- devops_sre: DevOps/SRE (infrastructure).\n- data_analyst: Data Analyst (data).\n- ds_ml: DS/ML (data).\n- information_security: Information security (security).\n- qa: QA (quality).\n\nAdding a value is a contract change; renaming or removing one is a breaking change.'), + "grade": zod.enum(['intern', 'junior', 'middle', 'senior']).describe('Grade of the MVP scale in ascending order: `intern`, `junior`, `middle`, `senior`. The same codes describe a self-assessed grade, which the candidate states, and a confirmed grade, which only an assessment result establishes. Lead and Architect are planned after the MVP; adding a value is a contract change.') +}).describe('A confirmed category. Its specialization must equal the enclosing match entry\'s specialization.'), + "strength": zod.enum(['standard', 'strong']).describe('Coarse strength of a confirmed assessment for this specialization.'), + "public_context": zod.object({ + "stack": zod.union([zod.array(zod.enum(['go', 'postgresql', 'kafka', 'docker']).describe('A stack code that the anonymous card may expose. Search filters do not accept arbitrary profile text or candidate-provided evidence.')).max(matchSearchGroupsMainItemPublicContextStackOneMax),zod.null()]), + "experience_band": zod.union([zod.enum(['0_1', '1_3', '3_6', '6_plus', '0_3', '3_plus']).describe('Coarse total experience bucket. Rare combinations may be generalized to 0_3 or 3_plus before they are returned.'),zod.null()]), + "work_formats": zod.union([zod.array(zod.enum(['remote', 'office', 'hybrid']).describe('Acceptable work format: `remote`, `office`, or `hybrid`.')).max(matchSearchGroupsMainItemPublicContextWorkFormatsOneMax),zod.null()]), + "salary_compatibility": zod.union([zod.enum(['compatible', 'not_compatible']).describe('A coarse compatibility result only. No salary amount, minimum, range, or threshold is part of the anonymous card.'),zod.null()]) +}).describe('Safe anonymous-card context only. A null value means that the value is not in the public card or is not present; the response does not reveal which. It contains no contact, candidate location, or salary amount.'), + "evidence_summary": zod.array(zod.object({ + "code": zod.enum(['confirmed_category', 'required_skill_evidence', 'desired_skill_evidence', 'domain_alignment', 'task_alignment', 'work_conditions_match', 'salary_compatibility', 'declared_grade']).describe('Template code for an explanation derived from allowed evidence. It carries no free text, raw answer, or reason for withheld FSP data.'), + "state": zod.enum(['supports', 'partial', 'gap', 'declared_only']) +}).describe('A templated, non-text evidence explanation.')).max(matchSearchGroupsMainItemEvidenceSummaryMax), + "components": zod.object({ + "fit": zod.number().min(matchSearchGroupsMainItemComponentsFitMin).max(matchSearchGroupsMainItemComponentsFitMax).describe('A normalized FR09 ranking component from 0 to 1.'), + "coverage": zod.number().min(matchSearchGroupsMainItemComponentsCoverageMin).max(matchSearchGroupsMainItemComponentsCoverageMax).describe('A normalized FR09 ranking component from 0 to 1.'), + "domain": zod.number().min(matchSearchGroupsMainItemComponentsDomainMin).max(matchSearchGroupsMainItemComponentsDomainMax).describe('A normalized FR09 ranking component from 0 to 1.'), + "semantics": zod.number().min(matchSearchGroupsMainItemComponentsSemanticsMin).max(matchSearchGroupsMainItemComponentsSemanticsMax).describe('A normalized FR09 ranking component from 0 to 1.'), + "percentile": zod.union([zod.number().min(matchSearchGroupsMainItemComponentsPercentileOneMin).max(matchSearchGroupsMainItemComponentsPercentileOneMax),zod.null()]).describe('A score from a versioned ranking component, or null when it is not available. Any null component has a matching bounded entry in `unknown_flags`.'), + "competition": zod.number().min(matchSearchGroupsMainItemComponentsCompetitionMin).max(matchSearchGroupsMainItemComponentsCompetitionMax).describe('A normalized FR09 ranking component from 0 to 1.'), + "freshness": zod.number().min(matchSearchGroupsMainItemComponentsFreshnessMin).max(matchSearchGroupsMainItemComponentsFreshnessMax).describe('A normalized FR09 ranking component from 0 to 1.'), + "responsiveness": zod.number().min(matchSearchGroupsMainItemComponentsResponsivenessMin).max(matchSearchGroupsMainItemComponentsResponsivenessMax).describe('A normalized FR09 ranking component from 0 to 1.'), + "rank_score": zod.number().min(matchSearchGroupsMainItemComponentsRankScoreMin).max(matchSearchGroupsMainItemComponentsRankScoreMax).describe('A normalized FR09 ranking component from 0 to 1.') +}).describe('Components from the FR09 ranking model for a confirmed category. `percentile` is null when fewer than 30 comparable real candidates are available; the ranking uses neutral T = 0.5 and does not publish a percentile. If ML is unavailable, `semantics` uses neutral 0.5 and the reason appears in `unknown_flags`.'), + "unknown_flags": zod.array(zod.object({ + "component": zod.enum(['semantics', 'percentile', 'assessment', 'freshness', 'responsiveness', 'experience_band', 'work_formats', 'salary_compatibility', 'domain']).describe('Ranking or public-card component whose value is unknown.'), + "reason": zod.enum(['ml_unavailable', 'cohort_below_30', 'no_confirmation_for_specialization', 'not_in_public_card', 'need_field_unconfirmed', 'no_freshness_history', 'no_response_history']).describe('Bounded explanation for an unknown component, not a hiding reason.') +}).describe('A safe, bounded explanation for one unavailable component.')).max(matchSearchGroupsMainItemUnknownFlagsMax) +}).describe('One confirmed specialization entry in the `main` or `near` group. The group containing it supplies the group label. A candidate may have a separate entry for another specialization.')), + "near": zod.array(zod.object({ + "candidate_handle": zod.string().min(matchSearchGroupsNearItemCandidateHandleMin).max(matchSearchGroupsNearItemCandidateHandleMax).regex(matchSearchGroupsNearItemCandidateHandleRegExp).describe('Opaque reference to a candidate as one organization sees it, taken from the organization-scoped anonymous card. It is a versioned HMAC alias, not a candidate account or profile identifier; it contains no contact information and is meaningless to another organization. The server resolves it only against the current visible cohort of the organization in the path. Clients never parse or construct it. It is shared by the candidate-card read and invitations.'), + "specialization": zod.enum(['backend', 'frontend', 'mobile', 'network_engineer', 'devops_sre', 'data_analyst', 'ds_ml', 'information_security', 'qa']).describe('Stable code of a specialization. A category is a specialization together with a confirmed grade; programming languages and the technology stack are separate attributes and never form a category of their own, so Backend with Go is the category `backend`, not `go`. Algorithms is a shared assessment module, not a specialization, and has no code here.\n\n- backend: Backend (development).\n- frontend: Frontend (development).\n- mobile: Mobile (development).\n- network_engineer: Network Engineer (infrastructure).\n- devops_sre: DevOps/SRE (infrastructure).\n- data_analyst: Data Analyst (data).\n- ds_ml: DS/ML (data).\n- information_security: Information security (security).\n- qa: QA (quality).\n\nAdding a value is a contract change; renaming or removing one is a breaking change.'), + "confirmation_status": zod.enum(['confirmed']), + "declared_grade": zod.union([zod.enum(['intern', 'junior', 'middle', 'senior']).describe('Grade of the MVP scale in ascending order: `intern`, `junior`, `middle`, `senior`. The same codes describe a self-assessed grade, which the candidate states, and a confirmed grade, which only an assessment result establishes. Lead and Architect are planned after the MVP; adding a value is a contract change.'),zod.null()]).describe('Candidate-declared grade for this specialization, never a confirmation.'), + "category": zod.object({ + "specialization": zod.enum(['backend', 'frontend', 'mobile', 'network_engineer', 'devops_sre', 'data_analyst', 'ds_ml', 'information_security', 'qa']).describe('Stable code of a specialization. A category is a specialization together with a confirmed grade; programming languages and the technology stack are separate attributes and never form a category of their own, so Backend with Go is the category `backend`, not `go`. Algorithms is a shared assessment module, not a specialization, and has no code here.\n\n- backend: Backend (development).\n- frontend: Frontend (development).\n- mobile: Mobile (development).\n- network_engineer: Network Engineer (infrastructure).\n- devops_sre: DevOps/SRE (infrastructure).\n- data_analyst: Data Analyst (data).\n- ds_ml: DS/ML (data).\n- information_security: Information security (security).\n- qa: QA (quality).\n\nAdding a value is a contract change; renaming or removing one is a breaking change.'), + "grade": zod.enum(['intern', 'junior', 'middle', 'senior']).describe('Grade of the MVP scale in ascending order: `intern`, `junior`, `middle`, `senior`. The same codes describe a self-assessed grade, which the candidate states, and a confirmed grade, which only an assessment result establishes. Lead and Architect are planned after the MVP; adding a value is a contract change.') +}).describe('A confirmed category. Its specialization must equal the enclosing match entry\'s specialization.'), + "strength": zod.enum(['standard', 'strong']).describe('Coarse strength of a confirmed assessment for this specialization.'), + "public_context": zod.object({ + "stack": zod.union([zod.array(zod.enum(['go', 'postgresql', 'kafka', 'docker']).describe('A stack code that the anonymous card may expose. Search filters do not accept arbitrary profile text or candidate-provided evidence.')).max(matchSearchGroupsNearItemPublicContextStackOneMax),zod.null()]), + "experience_band": zod.union([zod.enum(['0_1', '1_3', '3_6', '6_plus', '0_3', '3_plus']).describe('Coarse total experience bucket. Rare combinations may be generalized to 0_3 or 3_plus before they are returned.'),zod.null()]), + "work_formats": zod.union([zod.array(zod.enum(['remote', 'office', 'hybrid']).describe('Acceptable work format: `remote`, `office`, or `hybrid`.')).max(matchSearchGroupsNearItemPublicContextWorkFormatsOneMax),zod.null()]), + "salary_compatibility": zod.union([zod.enum(['compatible', 'not_compatible']).describe('A coarse compatibility result only. No salary amount, minimum, range, or threshold is part of the anonymous card.'),zod.null()]) +}).describe('Safe anonymous-card context only. A null value means that the value is not in the public card or is not present; the response does not reveal which. It contains no contact, candidate location, or salary amount.'), + "evidence_summary": zod.array(zod.object({ + "code": zod.enum(['confirmed_category', 'required_skill_evidence', 'desired_skill_evidence', 'domain_alignment', 'task_alignment', 'work_conditions_match', 'salary_compatibility', 'declared_grade']).describe('Template code for an explanation derived from allowed evidence. It carries no free text, raw answer, or reason for withheld FSP data.'), + "state": zod.enum(['supports', 'partial', 'gap', 'declared_only']) +}).describe('A templated, non-text evidence explanation.')).max(matchSearchGroupsNearItemEvidenceSummaryMax), + "components": zod.object({ + "fit": zod.number().min(matchSearchGroupsNearItemComponentsFitMin).max(matchSearchGroupsNearItemComponentsFitMax).describe('A normalized FR09 ranking component from 0 to 1.'), + "coverage": zod.number().min(matchSearchGroupsNearItemComponentsCoverageMin).max(matchSearchGroupsNearItemComponentsCoverageMax).describe('A normalized FR09 ranking component from 0 to 1.'), + "domain": zod.number().min(matchSearchGroupsNearItemComponentsDomainMin).max(matchSearchGroupsNearItemComponentsDomainMax).describe('A normalized FR09 ranking component from 0 to 1.'), + "semantics": zod.number().min(matchSearchGroupsNearItemComponentsSemanticsMin).max(matchSearchGroupsNearItemComponentsSemanticsMax).describe('A normalized FR09 ranking component from 0 to 1.'), + "percentile": zod.union([zod.number().min(matchSearchGroupsNearItemComponentsPercentileOneMin).max(matchSearchGroupsNearItemComponentsPercentileOneMax),zod.null()]).describe('A score from a versioned ranking component, or null when it is not available. Any null component has a matching bounded entry in `unknown_flags`.'), + "competition": zod.number().min(matchSearchGroupsNearItemComponentsCompetitionMin).max(matchSearchGroupsNearItemComponentsCompetitionMax).describe('A normalized FR09 ranking component from 0 to 1.'), + "freshness": zod.number().min(matchSearchGroupsNearItemComponentsFreshnessMin).max(matchSearchGroupsNearItemComponentsFreshnessMax).describe('A normalized FR09 ranking component from 0 to 1.'), + "responsiveness": zod.number().min(matchSearchGroupsNearItemComponentsResponsivenessMin).max(matchSearchGroupsNearItemComponentsResponsivenessMax).describe('A normalized FR09 ranking component from 0 to 1.'), + "rank_score": zod.number().min(matchSearchGroupsNearItemComponentsRankScoreMin).max(matchSearchGroupsNearItemComponentsRankScoreMax).describe('A normalized FR09 ranking component from 0 to 1.') +}).describe('Components from the FR09 ranking model for a confirmed category. `percentile` is null when fewer than 30 comparable real candidates are available; the ranking uses neutral T = 0.5 and does not publish a percentile. If ML is unavailable, `semantics` uses neutral 0.5 and the reason appears in `unknown_flags`.'), + "unknown_flags": zod.array(zod.object({ + "component": zod.enum(['semantics', 'percentile', 'assessment', 'freshness', 'responsiveness', 'experience_band', 'work_formats', 'salary_compatibility', 'domain']).describe('Ranking or public-card component whose value is unknown.'), + "reason": zod.enum(['ml_unavailable', 'cohort_below_30', 'no_confirmation_for_specialization', 'not_in_public_card', 'need_field_unconfirmed', 'no_freshness_history', 'no_response_history']).describe('Bounded explanation for an unknown component, not a hiding reason.') +}).describe('A safe, bounded explanation for one unavailable component.')).max(matchSearchGroupsNearItemUnknownFlagsMax) +}).describe('One confirmed specialization entry in the `main` or `near` group. The group containing it supplies the group label. A candidate may have a separate entry for another specialization.')), + "unconfirmed": zod.array(zod.object({ + "candidate_handle": zod.string().min(matchSearchGroupsUnconfirmedItemCandidateHandleMin).max(matchSearchGroupsUnconfirmedItemCandidateHandleMax).regex(matchSearchGroupsUnconfirmedItemCandidateHandleRegExp).describe('Opaque reference to a candidate as one organization sees it, taken from the organization-scoped anonymous card. It is a versioned HMAC alias, not a candidate account or profile identifier; it contains no contact information and is meaningless to another organization. The server resolves it only against the current visible cohort of the organization in the path. Clients never parse or construct it. It is shared by the candidate-card read and invitations.'), + "specialization": zod.enum(['backend', 'frontend', 'mobile', 'network_engineer', 'devops_sre', 'data_analyst', 'ds_ml', 'information_security', 'qa']).describe('Stable code of a specialization. A category is a specialization together with a confirmed grade; programming languages and the technology stack are separate attributes and never form a category of their own, so Backend with Go is the category `backend`, not `go`. Algorithms is a shared assessment module, not a specialization, and has no code here.\n\n- backend: Backend (development).\n- frontend: Frontend (development).\n- mobile: Mobile (development).\n- network_engineer: Network Engineer (infrastructure).\n- devops_sre: DevOps/SRE (infrastructure).\n- data_analyst: Data Analyst (data).\n- ds_ml: DS/ML (data).\n- information_security: Information security (security).\n- qa: QA (quality).\n\nAdding a value is a contract change; renaming or removing one is a breaking change.'), + "confirmation_status": zod.enum(['unconfirmed']), + "declared_grade": zod.union([zod.enum(['intern', 'junior', 'middle', 'senior']).describe('Grade of the MVP scale in ascending order: `intern`, `junior`, `middle`, `senior`. The same codes describe a self-assessed grade, which the candidate states, and a confirmed grade, which only an assessment result establishes. Lead and Architect are planned after the MVP; adding a value is a contract change.'),zod.null()]).describe('Candidate-declared grade, separate from assessment confirmation.'), + "category": zod.null().describe('There is no confirmed category for this specialization.'), + "strength": zod.null().describe('Assessment strength is not measured for this specialization.'), + "public_context": zod.object({ + "stack": zod.union([zod.array(zod.enum(['go', 'postgresql', 'kafka', 'docker']).describe('A stack code that the anonymous card may expose. Search filters do not accept arbitrary profile text or candidate-provided evidence.')).max(matchSearchGroupsUnconfirmedItemPublicContextStackOneMax),zod.null()]), + "experience_band": zod.union([zod.enum(['0_1', '1_3', '3_6', '6_plus', '0_3', '3_plus']).describe('Coarse total experience bucket. Rare combinations may be generalized to 0_3 or 3_plus before they are returned.'),zod.null()]), + "work_formats": zod.union([zod.array(zod.enum(['remote', 'office', 'hybrid']).describe('Acceptable work format: `remote`, `office`, or `hybrid`.')).max(matchSearchGroupsUnconfirmedItemPublicContextWorkFormatsOneMax),zod.null()]), + "salary_compatibility": zod.union([zod.enum(['compatible', 'not_compatible']).describe('A coarse compatibility result only. No salary amount, minimum, range, or threshold is part of the anonymous card.'),zod.null()]) +}).describe('Safe anonymous-card context only. A null value means that the value is not in the public card or is not present; the response does not reveal which. It contains no contact, candidate location, or salary amount.'), + "evidence_summary": zod.array(zod.object({ + "code": zod.enum(['confirmed_category', 'required_skill_evidence', 'desired_skill_evidence', 'domain_alignment', 'task_alignment', 'work_conditions_match', 'salary_compatibility', 'declared_grade']).describe('Template code for an explanation derived from allowed evidence. It carries no free text, raw answer, or reason for withheld FSP data.'), + "state": zod.enum(['supports', 'partial', 'gap', 'declared_only']) +}).describe('A templated, non-text evidence explanation.')).max(matchSearchGroupsUnconfirmedItemEvidenceSummaryMax), + "components": zod.object({ + "fit": zod.number().min(matchSearchGroupsUnconfirmedItemComponentsFitMin).max(matchSearchGroupsUnconfirmedItemComponentsFitMax).describe('Job fit for this specialization, never an assessment score.'), + "coverage": zod.number().min(matchSearchGroupsUnconfirmedItemComponentsCoverageMin).max(matchSearchGroupsUnconfirmedItemComponentsCoverageMax).describe('Coverage of confirmed need skills by allowed public evidence.') +}).describe('Unconfirmed entries are ordered only by Fit and coverage. This strict component object has no theta, T, P, test percentile, or confirmed assessment score.'), + "unknown_flags": zod.array(zod.object({ + "component": zod.enum(['semantics', 'percentile', 'assessment', 'freshness', 'responsiveness', 'experience_band', 'work_formats', 'salary_compatibility', 'domain']).describe('Ranking or public-card component whose value is unknown.'), + "reason": zod.enum(['ml_unavailable', 'cohort_below_30', 'no_confirmation_for_specialization', 'not_in_public_card', 'need_field_unconfirmed', 'no_freshness_history', 'no_response_history']).describe('Bounded explanation for an unknown component, not a hiding reason.') +}).describe('A safe, bounded explanation for one unavailable component.')).max(matchSearchGroupsUnconfirmedItemUnknownFlagsMax) +}).describe('One specialization with no confirmed category. `category` and `strength` remain present and null. A confirmation in another specialization never changes this entry. The schema intentionally has no assessment measurement fields.')) +}).describe('Separate ranking groups. Confirmed categories appear in main and near; unconfirmed specializations appear only in the lower unconfirmed group.') + +export type MatchSearchGroups = zod.input; +export type MatchSearchGroupsOutput = zod.output; diff --git a/frontend/src/shared/api/schemas/organization/matchSearchNeedSource.zod.ts b/frontend/src/shared/api/schemas/organization/matchSearchNeedSource.zod.ts new file mode 100644 index 0000000..d2a83b2 --- /dev/null +++ b/frontend/src/shared/api/schemas/organization/matchSearchNeedSource.zod.ts @@ -0,0 +1,18 @@ +/** + * Generated by orval 🍺 + * Do not edit manually. + * Lincodex API + * OpenAPI spec version: 0.1.0 + */ +import * as zod from 'zod'; + + + +export const MatchSearchNeedSource = zod.object({ + "kind": zod.enum(['need']), + "need_id": zod.uuid(), + "requirements_version": zod.int().min(1).describe('Version of an employer need. Creation makes version 1, and every committed change of the need advances it by exactly one, including a change made by the server, such as a planned asynchronous ML suggestion. Each version is an immutable snapshot of the need. `requirements_version` names the version whose confirmed requirements are current, so a change that leaves them unchanged creates a need version without a new requirements version.') +}).describe('The immutable need requirements snapshot used by this result.') + +export type MatchSearchNeedSource = zod.input; +export type MatchSearchNeedSourceOutput = zod.output; diff --git a/frontend/src/shared/api/schemas/organization/matchSearchRequest.zod.ts b/frontend/src/shared/api/schemas/organization/matchSearchRequest.zod.ts new file mode 100644 index 0000000..8081c63 --- /dev/null +++ b/frontend/src/shared/api/schemas/organization/matchSearchRequest.zod.ts @@ -0,0 +1,56 @@ +/** + * Generated by orval 🍺 + * Do not edit manually. + * Lincodex API + * OpenAPI spec version: 0.1.0 + */ +import * as zod from 'zod'; + + +export const matchSearchRequestOneFiltersStackMax = 4; + +export const matchSearchRequestOneFiltersConditionsWorkFormatsMax = 3; + +export const matchSearchRequestTwoFiltersStackMax = 4; + +export const matchSearchRequestTwoFiltersConditionsWorkFormatsMax = 3; + + +export const MatchSearchRequest = zod.union([zod.object({ + "need_id": zod.uuid().describe('Need owned by the organization in the path.'), + "requirements_version": zod.int().min(1).describe('Version of an employer need. Creation makes version 1, and every committed change of the need advances it by exactly one, including a change made by the server, such as a planned asynchronous ML suggestion. Each version is an immutable snapshot of the need. `requirements_version` names the version whose confirmed requirements are current, so a change that leaves them unchanged creates a need version without a new requirements version.'), + "filters": zod.object({ + "specialization": zod.enum(['backend', 'frontend', 'mobile', 'network_engineer', 'devops_sre', 'data_analyst', 'ds_ml', 'information_security', 'qa']).exactOptional().describe('Stable code of a specialization. A category is a specialization together with a confirmed grade; programming languages and the technology stack are separate attributes and never form a category of their own, so Backend with Go is the category `backend`, not `go`. Algorithms is a shared assessment module, not a specialization, and has no code here.\n\n- backend: Backend (development).\n- frontend: Frontend (development).\n- mobile: Mobile (development).\n- network_engineer: Network Engineer (infrastructure).\n- devops_sre: DevOps/SRE (infrastructure).\n- data_analyst: Data Analyst (data).\n- ds_ml: DS/ML (data).\n- information_security: Information security (security).\n- qa: QA (quality).\n\nAdding a value is a contract change; renaming or removing one is a breaking change.'), + "confirmed_grade": zod.enum(['intern', 'junior', 'middle', 'senior']).exactOptional().describe('Match only candidates with this currently confirmed grade in the selected specialization. It never matches a declared grade.'), + "confirmed_category": zod.object({ + "specialization": zod.enum(['backend', 'frontend', 'mobile', 'network_engineer', 'devops_sre', 'data_analyst', 'ds_ml', 'information_security', 'qa']).describe('Stable code of a specialization. A category is a specialization together with a confirmed grade; programming languages and the technology stack are separate attributes and never form a category of their own, so Backend with Go is the category `backend`, not `go`. Algorithms is a shared assessment module, not a specialization, and has no code here.\n\n- backend: Backend (development).\n- frontend: Frontend (development).\n- mobile: Mobile (development).\n- network_engineer: Network Engineer (infrastructure).\n- devops_sre: DevOps/SRE (infrastructure).\n- data_analyst: Data Analyst (data).\n- ds_ml: DS/ML (data).\n- information_security: Information security (security).\n- qa: QA (quality).\n\nAdding a value is a contract change; renaming or removing one is a breaking change.'), + "grade": zod.enum(['intern', 'junior', 'middle', 'senior']).describe('Grade of the MVP scale in ascending order: `intern`, `junior`, `middle`, `senior`. The same codes describe a self-assessed grade, which the candidate states, and a confirmed grade, which only an assessment result establishes. Lead and Architect are planned after the MVP; adding a value is a contract change.') +}).exactOptional().describe('A confirmed category filter, never a candidate declaration.'), + "confirmation_status": zod.enum(['confirmed', 'unconfirmed']).exactOptional().describe('Confirmation state for this specialization only. A result for one specialization never changes the state of another specialization.'), + "declared_grade": zod.enum(['intern', 'junior', 'middle', 'senior']).exactOptional().describe('Candidate-declared grade filter. This is a separate claim and cannot satisfy `confirmed_grade` or `confirmed_category`.'), + "stack": zod.array(zod.enum(['go', 'postgresql', 'kafka', 'docker']).describe('A stack code that the anonymous card may expose. Search filters do not accept arbitrary profile text or candidate-provided evidence.')).min(1).max(matchSearchRequestOneFiltersStackMax).exactOptional(), + "conditions": zod.object({ + "work_formats": zod.array(zod.enum(['remote', 'office', 'hybrid']).describe('Acceptable work format: `remote`, `office`, or `hybrid`.')).min(1).max(matchSearchRequestOneFiltersConditionsWorkFormatsMax).exactOptional(), + "salary_compatibility": zod.enum(['compatible', 'not_compatible']).exactOptional().describe('A coarse compatibility result only. No salary amount, minimum, range, or threshold is part of the anonymous card.') +}).exactOptional().describe('Filters against safe, coarse card conditions. No candidate location, salary amount, salary minimum, or salary range is accepted.') +}).exactOptional().describe('Optional filters over the current organization-visible bank. An empty object means no additional filter. Confirmed and declared grades are separate fields; a declaration never satisfies a confirmed-grade or category filter. Conditions use only the safe, coarse card fields.') +}).describe('Search one immutable set of confirmed requirements. `requirements_version` is the Need.requirements_version, not the general Need.version; text-only or suggestion-only edits do not change this search basis.'),zod.object({ + "filters": zod.object({ + "specialization": zod.enum(['backend', 'frontend', 'mobile', 'network_engineer', 'devops_sre', 'data_analyst', 'ds_ml', 'information_security', 'qa']).exactOptional().describe('Stable code of a specialization. A category is a specialization together with a confirmed grade; programming languages and the technology stack are separate attributes and never form a category of their own, so Backend with Go is the category `backend`, not `go`. Algorithms is a shared assessment module, not a specialization, and has no code here.\n\n- backend: Backend (development).\n- frontend: Frontend (development).\n- mobile: Mobile (development).\n- network_engineer: Network Engineer (infrastructure).\n- devops_sre: DevOps/SRE (infrastructure).\n- data_analyst: Data Analyst (data).\n- ds_ml: DS/ML (data).\n- information_security: Information security (security).\n- qa: QA (quality).\n\nAdding a value is a contract change; renaming or removing one is a breaking change.'), + "confirmed_grade": zod.enum(['intern', 'junior', 'middle', 'senior']).exactOptional().describe('Match only candidates with this currently confirmed grade in the selected specialization. It never matches a declared grade.'), + "confirmed_category": zod.object({ + "specialization": zod.enum(['backend', 'frontend', 'mobile', 'network_engineer', 'devops_sre', 'data_analyst', 'ds_ml', 'information_security', 'qa']).describe('Stable code of a specialization. A category is a specialization together with a confirmed grade; programming languages and the technology stack are separate attributes and never form a category of their own, so Backend with Go is the category `backend`, not `go`. Algorithms is a shared assessment module, not a specialization, and has no code here.\n\n- backend: Backend (development).\n- frontend: Frontend (development).\n- mobile: Mobile (development).\n- network_engineer: Network Engineer (infrastructure).\n- devops_sre: DevOps/SRE (infrastructure).\n- data_analyst: Data Analyst (data).\n- ds_ml: DS/ML (data).\n- information_security: Information security (security).\n- qa: QA (quality).\n\nAdding a value is a contract change; renaming or removing one is a breaking change.'), + "grade": zod.enum(['intern', 'junior', 'middle', 'senior']).describe('Grade of the MVP scale in ascending order: `intern`, `junior`, `middle`, `senior`. The same codes describe a self-assessed grade, which the candidate states, and a confirmed grade, which only an assessment result establishes. Lead and Architect are planned after the MVP; adding a value is a contract change.') +}).exactOptional().describe('A confirmed category filter, never a candidate declaration.'), + "confirmation_status": zod.enum(['confirmed', 'unconfirmed']).exactOptional().describe('Confirmation state for this specialization only. A result for one specialization never changes the state of another specialization.'), + "declared_grade": zod.enum(['intern', 'junior', 'middle', 'senior']).exactOptional().describe('Candidate-declared grade filter. This is a separate claim and cannot satisfy `confirmed_grade` or `confirmed_category`.'), + "stack": zod.array(zod.enum(['go', 'postgresql', 'kafka', 'docker']).describe('A stack code that the anonymous card may expose. Search filters do not accept arbitrary profile text or candidate-provided evidence.')).min(1).max(matchSearchRequestTwoFiltersStackMax).exactOptional(), + "conditions": zod.object({ + "work_formats": zod.array(zod.enum(['remote', 'office', 'hybrid']).describe('Acceptable work format: `remote`, `office`, or `hybrid`.')).min(1).max(matchSearchRequestTwoFiltersConditionsWorkFormatsMax).exactOptional(), + "salary_compatibility": zod.enum(['compatible', 'not_compatible']).exactOptional().describe('A coarse compatibility result only. No salary amount, minimum, range, or threshold is part of the anonymous card.') +}).exactOptional().describe('Filters against safe, coarse card conditions. No candidate location, salary amount, salary minimum, or salary range is accepted.') +}).describe('Optional filters over the current organization-visible bank. An empty object means no additional filter. Confirmed and declared grades are separate fields; a declaration never satisfies a confirmed-grade or category filter. Conditions use only the safe, coarse card fields.') +}).describe('Search the current organization-visible bank. An empty `filters` object includes all otherwise eligible specializations as separate entries.')]).describe('Search either a Need.requirements_version snapshot or the whole organization-visible bank with explicit filters. Unknown fields are rejected by both closed request variants.') + +export type MatchSearchRequest = zod.input; +export type MatchSearchRequestOutput = zod.output; diff --git a/frontend/src/shared/api/schemas/organization/matchSearchResponse.zod.ts b/frontend/src/shared/api/schemas/organization/matchSearchResponse.zod.ts new file mode 100644 index 0000000..574ca25 --- /dev/null +++ b/frontend/src/shared/api/schemas/organization/matchSearchResponse.zod.ts @@ -0,0 +1,240 @@ +/** + * Generated by orval 🍺 + * Do not edit manually. + * Lincodex API + * OpenAPI spec version: 0.1.0 + */ +import * as zod from 'zod'; + + +export const matchSearchResponseSourceTwoFiltersStackOneMax = 4; + +export const matchSearchResponseSourceTwoFiltersConditionsOneWorkFormatsOneMax = 3; + +export const matchSearchResponseGroupsMainItemCandidateHandleMin = 47; +export const matchSearchResponseGroupsMainItemCandidateHandleMax = 47; + + +export const matchSearchResponseGroupsMainItemCandidateHandleRegExp = new RegExp('^cv1_[A-Za-z0-9_-]{43}$'); +export const matchSearchResponseGroupsMainItemPublicContextStackOneMax = 4; + +export const matchSearchResponseGroupsMainItemPublicContextWorkFormatsOneMax = 3; + +export const matchSearchResponseGroupsMainItemEvidenceSummaryMax = 12; + +export const matchSearchResponseGroupsMainItemComponentsFitMin = 0; +export const matchSearchResponseGroupsMainItemComponentsFitMax = 1; + +export const matchSearchResponseGroupsMainItemComponentsCoverageMin = 0; +export const matchSearchResponseGroupsMainItemComponentsCoverageMax = 1; + +export const matchSearchResponseGroupsMainItemComponentsDomainMin = 0; +export const matchSearchResponseGroupsMainItemComponentsDomainMax = 1; + +export const matchSearchResponseGroupsMainItemComponentsSemanticsMin = 0; +export const matchSearchResponseGroupsMainItemComponentsSemanticsMax = 1; + +export const matchSearchResponseGroupsMainItemComponentsPercentileOneMin = 0; +export const matchSearchResponseGroupsMainItemComponentsPercentileOneMax = 1; + +export const matchSearchResponseGroupsMainItemComponentsCompetitionMin = 0; +export const matchSearchResponseGroupsMainItemComponentsCompetitionMax = 1; + +export const matchSearchResponseGroupsMainItemComponentsFreshnessMin = 0; +export const matchSearchResponseGroupsMainItemComponentsFreshnessMax = 1; + +export const matchSearchResponseGroupsMainItemComponentsResponsivenessMin = 0; +export const matchSearchResponseGroupsMainItemComponentsResponsivenessMax = 1; + +export const matchSearchResponseGroupsMainItemComponentsRankScoreMin = 0; +export const matchSearchResponseGroupsMainItemComponentsRankScoreMax = 1; + +export const matchSearchResponseGroupsMainItemUnknownFlagsMax = 9; + +export const matchSearchResponseGroupsNearItemCandidateHandleMin = 47; +export const matchSearchResponseGroupsNearItemCandidateHandleMax = 47; + + +export const matchSearchResponseGroupsNearItemCandidateHandleRegExp = new RegExp('^cv1_[A-Za-z0-9_-]{43}$'); +export const matchSearchResponseGroupsNearItemPublicContextStackOneMax = 4; + +export const matchSearchResponseGroupsNearItemPublicContextWorkFormatsOneMax = 3; + +export const matchSearchResponseGroupsNearItemEvidenceSummaryMax = 12; + +export const matchSearchResponseGroupsNearItemComponentsFitMin = 0; +export const matchSearchResponseGroupsNearItemComponentsFitMax = 1; + +export const matchSearchResponseGroupsNearItemComponentsCoverageMin = 0; +export const matchSearchResponseGroupsNearItemComponentsCoverageMax = 1; + +export const matchSearchResponseGroupsNearItemComponentsDomainMin = 0; +export const matchSearchResponseGroupsNearItemComponentsDomainMax = 1; + +export const matchSearchResponseGroupsNearItemComponentsSemanticsMin = 0; +export const matchSearchResponseGroupsNearItemComponentsSemanticsMax = 1; + +export const matchSearchResponseGroupsNearItemComponentsPercentileOneMin = 0; +export const matchSearchResponseGroupsNearItemComponentsPercentileOneMax = 1; + +export const matchSearchResponseGroupsNearItemComponentsCompetitionMin = 0; +export const matchSearchResponseGroupsNearItemComponentsCompetitionMax = 1; + +export const matchSearchResponseGroupsNearItemComponentsFreshnessMin = 0; +export const matchSearchResponseGroupsNearItemComponentsFreshnessMax = 1; + +export const matchSearchResponseGroupsNearItemComponentsResponsivenessMin = 0; +export const matchSearchResponseGroupsNearItemComponentsResponsivenessMax = 1; + +export const matchSearchResponseGroupsNearItemComponentsRankScoreMin = 0; +export const matchSearchResponseGroupsNearItemComponentsRankScoreMax = 1; + +export const matchSearchResponseGroupsNearItemUnknownFlagsMax = 9; + +export const matchSearchResponseGroupsUnconfirmedItemCandidateHandleMin = 47; +export const matchSearchResponseGroupsUnconfirmedItemCandidateHandleMax = 47; + + +export const matchSearchResponseGroupsUnconfirmedItemCandidateHandleRegExp = new RegExp('^cv1_[A-Za-z0-9_-]{43}$'); +export const matchSearchResponseGroupsUnconfirmedItemPublicContextStackOneMax = 4; + +export const matchSearchResponseGroupsUnconfirmedItemPublicContextWorkFormatsOneMax = 3; + +export const matchSearchResponseGroupsUnconfirmedItemEvidenceSummaryMax = 12; + +export const matchSearchResponseGroupsUnconfirmedItemComponentsFitMin = 0; +export const matchSearchResponseGroupsUnconfirmedItemComponentsFitMax = 1; + +export const matchSearchResponseGroupsUnconfirmedItemComponentsCoverageMin = 0; +export const matchSearchResponseGroupsUnconfirmedItemComponentsCoverageMax = 1; + +export const matchSearchResponseGroupsUnconfirmedItemUnknownFlagsMax = 9; + + +export const MatchSearchResponse = zod.object({ + "source": zod.union([zod.object({ + "kind": zod.enum(['need']), + "need_id": zod.uuid(), + "requirements_version": zod.int().min(1).describe('Version of an employer need. Creation makes version 1, and every committed change of the need advances it by exactly one, including a change made by the server, such as a planned asynchronous ML suggestion. Each version is an immutable snapshot of the need. `requirements_version` names the version whose confirmed requirements are current, so a change that leaves them unchanged creates a need version without a new requirements version.') +}).describe('The immutable need requirements snapshot used by this result.'),zod.object({ + "kind": zod.enum(['bank']), + "filters": zod.object({ + "specialization": zod.union([zod.enum(['backend', 'frontend', 'mobile', 'network_engineer', 'devops_sre', 'data_analyst', 'ds_ml', 'information_security', 'qa']).describe('Stable code of a specialization. A category is a specialization together with a confirmed grade; programming languages and the technology stack are separate attributes and never form a category of their own, so Backend with Go is the category `backend`, not `go`. Algorithms is a shared assessment module, not a specialization, and has no code here.\n\n- backend: Backend (development).\n- frontend: Frontend (development).\n- mobile: Mobile (development).\n- network_engineer: Network Engineer (infrastructure).\n- devops_sre: DevOps/SRE (infrastructure).\n- data_analyst: Data Analyst (data).\n- ds_ml: DS/ML (data).\n- information_security: Information security (security).\n- qa: QA (quality).\n\nAdding a value is a contract change; renaming or removing one is a breaking change.'),zod.null()]), + "confirmed_grade": zod.union([zod.enum(['intern', 'junior', 'middle', 'senior']).describe('Grade of the MVP scale in ascending order: `intern`, `junior`, `middle`, `senior`. The same codes describe a self-assessed grade, which the candidate states, and a confirmed grade, which only an assessment result establishes. Lead and Architect are planned after the MVP; adding a value is a contract change.'),zod.null()]), + "confirmed_category": zod.union([zod.object({ + "specialization": zod.enum(['backend', 'frontend', 'mobile', 'network_engineer', 'devops_sre', 'data_analyst', 'ds_ml', 'information_security', 'qa']).describe('Stable code of a specialization. A category is a specialization together with a confirmed grade; programming languages and the technology stack are separate attributes and never form a category of their own, so Backend with Go is the category `backend`, not `go`. Algorithms is a shared assessment module, not a specialization, and has no code here.\n\n- backend: Backend (development).\n- frontend: Frontend (development).\n- mobile: Mobile (development).\n- network_engineer: Network Engineer (infrastructure).\n- devops_sre: DevOps/SRE (infrastructure).\n- data_analyst: Data Analyst (data).\n- ds_ml: DS/ML (data).\n- information_security: Information security (security).\n- qa: QA (quality).\n\nAdding a value is a contract change; renaming or removing one is a breaking change.'), + "grade": zod.enum(['intern', 'junior', 'middle', 'senior']).describe('Grade of the MVP scale in ascending order: `intern`, `junior`, `middle`, `senior`. The same codes describe a self-assessed grade, which the candidate states, and a confirmed grade, which only an assessment result establishes. Lead and Architect are planned after the MVP; adding a value is a contract change.') +}).describe('A confirmed category filter, never a candidate declaration.'),zod.null()]), + "confirmation_status": zod.union([zod.enum(['confirmed', 'unconfirmed']).describe('Confirmation state for this specialization only. A result for one specialization never changes the state of another specialization.'),zod.null()]), + "declared_grade": zod.union([zod.enum(['intern', 'junior', 'middle', 'senior']).describe('Grade of the MVP scale in ascending order: `intern`, `junior`, `middle`, `senior`. The same codes describe a self-assessed grade, which the candidate states, and a confirmed grade, which only an assessment result establishes. Lead and Architect are planned after the MVP; adding a value is a contract change.'),zod.null()]), + "stack": zod.union([zod.array(zod.enum(['go', 'postgresql', 'kafka', 'docker']).describe('A stack code that the anonymous card may expose. Search filters do not accept arbitrary profile text or candidate-provided evidence.')).min(1).max(matchSearchResponseSourceTwoFiltersStackOneMax),zod.null()]), + "conditions": zod.union([zod.object({ + "work_formats": zod.union([zod.array(zod.enum(['remote', 'office', 'hybrid']).describe('Acceptable work format: `remote`, `office`, or `hybrid`.')).min(1).max(matchSearchResponseSourceTwoFiltersConditionsOneWorkFormatsOneMax),zod.null()]), + "salary_compatibility": zod.union([zod.enum(['compatible', 'not_compatible']).describe('A coarse compatibility result only. No salary amount, minimum, range, or threshold is part of the anonymous card.'),zod.null()]) +}).describe('Conditions echoed as a complete snapshot; null means no filter.'),zod.null()]) +}).describe('A normalized response snapshot of the bank filters. Each key is present; null means the corresponding request filter was omitted. This keeps a search result tied to its exact filter basis.') +}).describe('The normalized filters used for a bank search.')]).describe('Search basis echoed with the response so the displayed result remains tied to its need requirements version or bank filters.'), + "groups": zod.object({ + "main": zod.array(zod.object({ + "candidate_handle": zod.string().min(matchSearchResponseGroupsMainItemCandidateHandleMin).max(matchSearchResponseGroupsMainItemCandidateHandleMax).regex(matchSearchResponseGroupsMainItemCandidateHandleRegExp).describe('Opaque reference to a candidate as one organization sees it, taken from the organization-scoped anonymous card. It is a versioned HMAC alias, not a candidate account or profile identifier; it contains no contact information and is meaningless to another organization. The server resolves it only against the current visible cohort of the organization in the path. Clients never parse or construct it. It is shared by the candidate-card read and invitations.'), + "specialization": zod.enum(['backend', 'frontend', 'mobile', 'network_engineer', 'devops_sre', 'data_analyst', 'ds_ml', 'information_security', 'qa']).describe('Stable code of a specialization. A category is a specialization together with a confirmed grade; programming languages and the technology stack are separate attributes and never form a category of their own, so Backend with Go is the category `backend`, not `go`. Algorithms is a shared assessment module, not a specialization, and has no code here.\n\n- backend: Backend (development).\n- frontend: Frontend (development).\n- mobile: Mobile (development).\n- network_engineer: Network Engineer (infrastructure).\n- devops_sre: DevOps/SRE (infrastructure).\n- data_analyst: Data Analyst (data).\n- ds_ml: DS/ML (data).\n- information_security: Information security (security).\n- qa: QA (quality).\n\nAdding a value is a contract change; renaming or removing one is a breaking change.'), + "confirmation_status": zod.enum(['confirmed']), + "declared_grade": zod.union([zod.enum(['intern', 'junior', 'middle', 'senior']).describe('Grade of the MVP scale in ascending order: `intern`, `junior`, `middle`, `senior`. The same codes describe a self-assessed grade, which the candidate states, and a confirmed grade, which only an assessment result establishes. Lead and Architect are planned after the MVP; adding a value is a contract change.'),zod.null()]).describe('Candidate-declared grade for this specialization, never a confirmation.'), + "category": zod.object({ + "specialization": zod.enum(['backend', 'frontend', 'mobile', 'network_engineer', 'devops_sre', 'data_analyst', 'ds_ml', 'information_security', 'qa']).describe('Stable code of a specialization. A category is a specialization together with a confirmed grade; programming languages and the technology stack are separate attributes and never form a category of their own, so Backend with Go is the category `backend`, not `go`. Algorithms is a shared assessment module, not a specialization, and has no code here.\n\n- backend: Backend (development).\n- frontend: Frontend (development).\n- mobile: Mobile (development).\n- network_engineer: Network Engineer (infrastructure).\n- devops_sre: DevOps/SRE (infrastructure).\n- data_analyst: Data Analyst (data).\n- ds_ml: DS/ML (data).\n- information_security: Information security (security).\n- qa: QA (quality).\n\nAdding a value is a contract change; renaming or removing one is a breaking change.'), + "grade": zod.enum(['intern', 'junior', 'middle', 'senior']).describe('Grade of the MVP scale in ascending order: `intern`, `junior`, `middle`, `senior`. The same codes describe a self-assessed grade, which the candidate states, and a confirmed grade, which only an assessment result establishes. Lead and Architect are planned after the MVP; adding a value is a contract change.') +}).describe('A confirmed category. Its specialization must equal the enclosing match entry\'s specialization.'), + "strength": zod.enum(['standard', 'strong']).describe('Coarse strength of a confirmed assessment for this specialization.'), + "public_context": zod.object({ + "stack": zod.union([zod.array(zod.enum(['go', 'postgresql', 'kafka', 'docker']).describe('A stack code that the anonymous card may expose. Search filters do not accept arbitrary profile text or candidate-provided evidence.')).max(matchSearchResponseGroupsMainItemPublicContextStackOneMax),zod.null()]), + "experience_band": zod.union([zod.enum(['0_1', '1_3', '3_6', '6_plus', '0_3', '3_plus']).describe('Coarse total experience bucket. Rare combinations may be generalized to 0_3 or 3_plus before they are returned.'),zod.null()]), + "work_formats": zod.union([zod.array(zod.enum(['remote', 'office', 'hybrid']).describe('Acceptable work format: `remote`, `office`, or `hybrid`.')).max(matchSearchResponseGroupsMainItemPublicContextWorkFormatsOneMax),zod.null()]), + "salary_compatibility": zod.union([zod.enum(['compatible', 'not_compatible']).describe('A coarse compatibility result only. No salary amount, minimum, range, or threshold is part of the anonymous card.'),zod.null()]) +}).describe('Safe anonymous-card context only. A null value means that the value is not in the public card or is not present; the response does not reveal which. It contains no contact, candidate location, or salary amount.'), + "evidence_summary": zod.array(zod.object({ + "code": zod.enum(['confirmed_category', 'required_skill_evidence', 'desired_skill_evidence', 'domain_alignment', 'task_alignment', 'work_conditions_match', 'salary_compatibility', 'declared_grade']).describe('Template code for an explanation derived from allowed evidence. It carries no free text, raw answer, or reason for withheld FSP data.'), + "state": zod.enum(['supports', 'partial', 'gap', 'declared_only']) +}).describe('A templated, non-text evidence explanation.')).max(matchSearchResponseGroupsMainItemEvidenceSummaryMax), + "components": zod.object({ + "fit": zod.number().min(matchSearchResponseGroupsMainItemComponentsFitMin).max(matchSearchResponseGroupsMainItemComponentsFitMax).describe('A normalized FR09 ranking component from 0 to 1.'), + "coverage": zod.number().min(matchSearchResponseGroupsMainItemComponentsCoverageMin).max(matchSearchResponseGroupsMainItemComponentsCoverageMax).describe('A normalized FR09 ranking component from 0 to 1.'), + "domain": zod.number().min(matchSearchResponseGroupsMainItemComponentsDomainMin).max(matchSearchResponseGroupsMainItemComponentsDomainMax).describe('A normalized FR09 ranking component from 0 to 1.'), + "semantics": zod.number().min(matchSearchResponseGroupsMainItemComponentsSemanticsMin).max(matchSearchResponseGroupsMainItemComponentsSemanticsMax).describe('A normalized FR09 ranking component from 0 to 1.'), + "percentile": zod.union([zod.number().min(matchSearchResponseGroupsMainItemComponentsPercentileOneMin).max(matchSearchResponseGroupsMainItemComponentsPercentileOneMax),zod.null()]).describe('A score from a versioned ranking component, or null when it is not available. Any null component has a matching bounded entry in `unknown_flags`.'), + "competition": zod.number().min(matchSearchResponseGroupsMainItemComponentsCompetitionMin).max(matchSearchResponseGroupsMainItemComponentsCompetitionMax).describe('A normalized FR09 ranking component from 0 to 1.'), + "freshness": zod.number().min(matchSearchResponseGroupsMainItemComponentsFreshnessMin).max(matchSearchResponseGroupsMainItemComponentsFreshnessMax).describe('A normalized FR09 ranking component from 0 to 1.'), + "responsiveness": zod.number().min(matchSearchResponseGroupsMainItemComponentsResponsivenessMin).max(matchSearchResponseGroupsMainItemComponentsResponsivenessMax).describe('A normalized FR09 ranking component from 0 to 1.'), + "rank_score": zod.number().min(matchSearchResponseGroupsMainItemComponentsRankScoreMin).max(matchSearchResponseGroupsMainItemComponentsRankScoreMax).describe('A normalized FR09 ranking component from 0 to 1.') +}).describe('Components from the FR09 ranking model for a confirmed category. `percentile` is null when fewer than 30 comparable real candidates are available; the ranking uses neutral T = 0.5 and does not publish a percentile. If ML is unavailable, `semantics` uses neutral 0.5 and the reason appears in `unknown_flags`.'), + "unknown_flags": zod.array(zod.object({ + "component": zod.enum(['semantics', 'percentile', 'assessment', 'freshness', 'responsiveness', 'experience_band', 'work_formats', 'salary_compatibility', 'domain']).describe('Ranking or public-card component whose value is unknown.'), + "reason": zod.enum(['ml_unavailable', 'cohort_below_30', 'no_confirmation_for_specialization', 'not_in_public_card', 'need_field_unconfirmed', 'no_freshness_history', 'no_response_history']).describe('Bounded explanation for an unknown component, not a hiding reason.') +}).describe('A safe, bounded explanation for one unavailable component.')).max(matchSearchResponseGroupsMainItemUnknownFlagsMax) +}).describe('One confirmed specialization entry in the `main` or `near` group. The group containing it supplies the group label. A candidate may have a separate entry for another specialization.')), + "near": zod.array(zod.object({ + "candidate_handle": zod.string().min(matchSearchResponseGroupsNearItemCandidateHandleMin).max(matchSearchResponseGroupsNearItemCandidateHandleMax).regex(matchSearchResponseGroupsNearItemCandidateHandleRegExp).describe('Opaque reference to a candidate as one organization sees it, taken from the organization-scoped anonymous card. It is a versioned HMAC alias, not a candidate account or profile identifier; it contains no contact information and is meaningless to another organization. The server resolves it only against the current visible cohort of the organization in the path. Clients never parse or construct it. It is shared by the candidate-card read and invitations.'), + "specialization": zod.enum(['backend', 'frontend', 'mobile', 'network_engineer', 'devops_sre', 'data_analyst', 'ds_ml', 'information_security', 'qa']).describe('Stable code of a specialization. A category is a specialization together with a confirmed grade; programming languages and the technology stack are separate attributes and never form a category of their own, so Backend with Go is the category `backend`, not `go`. Algorithms is a shared assessment module, not a specialization, and has no code here.\n\n- backend: Backend (development).\n- frontend: Frontend (development).\n- mobile: Mobile (development).\n- network_engineer: Network Engineer (infrastructure).\n- devops_sre: DevOps/SRE (infrastructure).\n- data_analyst: Data Analyst (data).\n- ds_ml: DS/ML (data).\n- information_security: Information security (security).\n- qa: QA (quality).\n\nAdding a value is a contract change; renaming or removing one is a breaking change.'), + "confirmation_status": zod.enum(['confirmed']), + "declared_grade": zod.union([zod.enum(['intern', 'junior', 'middle', 'senior']).describe('Grade of the MVP scale in ascending order: `intern`, `junior`, `middle`, `senior`. The same codes describe a self-assessed grade, which the candidate states, and a confirmed grade, which only an assessment result establishes. Lead and Architect are planned after the MVP; adding a value is a contract change.'),zod.null()]).describe('Candidate-declared grade for this specialization, never a confirmation.'), + "category": zod.object({ + "specialization": zod.enum(['backend', 'frontend', 'mobile', 'network_engineer', 'devops_sre', 'data_analyst', 'ds_ml', 'information_security', 'qa']).describe('Stable code of a specialization. A category is a specialization together with a confirmed grade; programming languages and the technology stack are separate attributes and never form a category of their own, so Backend with Go is the category `backend`, not `go`. Algorithms is a shared assessment module, not a specialization, and has no code here.\n\n- backend: Backend (development).\n- frontend: Frontend (development).\n- mobile: Mobile (development).\n- network_engineer: Network Engineer (infrastructure).\n- devops_sre: DevOps/SRE (infrastructure).\n- data_analyst: Data Analyst (data).\n- ds_ml: DS/ML (data).\n- information_security: Information security (security).\n- qa: QA (quality).\n\nAdding a value is a contract change; renaming or removing one is a breaking change.'), + "grade": zod.enum(['intern', 'junior', 'middle', 'senior']).describe('Grade of the MVP scale in ascending order: `intern`, `junior`, `middle`, `senior`. The same codes describe a self-assessed grade, which the candidate states, and a confirmed grade, which only an assessment result establishes. Lead and Architect are planned after the MVP; adding a value is a contract change.') +}).describe('A confirmed category. Its specialization must equal the enclosing match entry\'s specialization.'), + "strength": zod.enum(['standard', 'strong']).describe('Coarse strength of a confirmed assessment for this specialization.'), + "public_context": zod.object({ + "stack": zod.union([zod.array(zod.enum(['go', 'postgresql', 'kafka', 'docker']).describe('A stack code that the anonymous card may expose. Search filters do not accept arbitrary profile text or candidate-provided evidence.')).max(matchSearchResponseGroupsNearItemPublicContextStackOneMax),zod.null()]), + "experience_band": zod.union([zod.enum(['0_1', '1_3', '3_6', '6_plus', '0_3', '3_plus']).describe('Coarse total experience bucket. Rare combinations may be generalized to 0_3 or 3_plus before they are returned.'),zod.null()]), + "work_formats": zod.union([zod.array(zod.enum(['remote', 'office', 'hybrid']).describe('Acceptable work format: `remote`, `office`, or `hybrid`.')).max(matchSearchResponseGroupsNearItemPublicContextWorkFormatsOneMax),zod.null()]), + "salary_compatibility": zod.union([zod.enum(['compatible', 'not_compatible']).describe('A coarse compatibility result only. No salary amount, minimum, range, or threshold is part of the anonymous card.'),zod.null()]) +}).describe('Safe anonymous-card context only. A null value means that the value is not in the public card or is not present; the response does not reveal which. It contains no contact, candidate location, or salary amount.'), + "evidence_summary": zod.array(zod.object({ + "code": zod.enum(['confirmed_category', 'required_skill_evidence', 'desired_skill_evidence', 'domain_alignment', 'task_alignment', 'work_conditions_match', 'salary_compatibility', 'declared_grade']).describe('Template code for an explanation derived from allowed evidence. It carries no free text, raw answer, or reason for withheld FSP data.'), + "state": zod.enum(['supports', 'partial', 'gap', 'declared_only']) +}).describe('A templated, non-text evidence explanation.')).max(matchSearchResponseGroupsNearItemEvidenceSummaryMax), + "components": zod.object({ + "fit": zod.number().min(matchSearchResponseGroupsNearItemComponentsFitMin).max(matchSearchResponseGroupsNearItemComponentsFitMax).describe('A normalized FR09 ranking component from 0 to 1.'), + "coverage": zod.number().min(matchSearchResponseGroupsNearItemComponentsCoverageMin).max(matchSearchResponseGroupsNearItemComponentsCoverageMax).describe('A normalized FR09 ranking component from 0 to 1.'), + "domain": zod.number().min(matchSearchResponseGroupsNearItemComponentsDomainMin).max(matchSearchResponseGroupsNearItemComponentsDomainMax).describe('A normalized FR09 ranking component from 0 to 1.'), + "semantics": zod.number().min(matchSearchResponseGroupsNearItemComponentsSemanticsMin).max(matchSearchResponseGroupsNearItemComponentsSemanticsMax).describe('A normalized FR09 ranking component from 0 to 1.'), + "percentile": zod.union([zod.number().min(matchSearchResponseGroupsNearItemComponentsPercentileOneMin).max(matchSearchResponseGroupsNearItemComponentsPercentileOneMax),zod.null()]).describe('A score from a versioned ranking component, or null when it is not available. Any null component has a matching bounded entry in `unknown_flags`.'), + "competition": zod.number().min(matchSearchResponseGroupsNearItemComponentsCompetitionMin).max(matchSearchResponseGroupsNearItemComponentsCompetitionMax).describe('A normalized FR09 ranking component from 0 to 1.'), + "freshness": zod.number().min(matchSearchResponseGroupsNearItemComponentsFreshnessMin).max(matchSearchResponseGroupsNearItemComponentsFreshnessMax).describe('A normalized FR09 ranking component from 0 to 1.'), + "responsiveness": zod.number().min(matchSearchResponseGroupsNearItemComponentsResponsivenessMin).max(matchSearchResponseGroupsNearItemComponentsResponsivenessMax).describe('A normalized FR09 ranking component from 0 to 1.'), + "rank_score": zod.number().min(matchSearchResponseGroupsNearItemComponentsRankScoreMin).max(matchSearchResponseGroupsNearItemComponentsRankScoreMax).describe('A normalized FR09 ranking component from 0 to 1.') +}).describe('Components from the FR09 ranking model for a confirmed category. `percentile` is null when fewer than 30 comparable real candidates are available; the ranking uses neutral T = 0.5 and does not publish a percentile. If ML is unavailable, `semantics` uses neutral 0.5 and the reason appears in `unknown_flags`.'), + "unknown_flags": zod.array(zod.object({ + "component": zod.enum(['semantics', 'percentile', 'assessment', 'freshness', 'responsiveness', 'experience_band', 'work_formats', 'salary_compatibility', 'domain']).describe('Ranking or public-card component whose value is unknown.'), + "reason": zod.enum(['ml_unavailable', 'cohort_below_30', 'no_confirmation_for_specialization', 'not_in_public_card', 'need_field_unconfirmed', 'no_freshness_history', 'no_response_history']).describe('Bounded explanation for an unknown component, not a hiding reason.') +}).describe('A safe, bounded explanation for one unavailable component.')).max(matchSearchResponseGroupsNearItemUnknownFlagsMax) +}).describe('One confirmed specialization entry in the `main` or `near` group. The group containing it supplies the group label. A candidate may have a separate entry for another specialization.')), + "unconfirmed": zod.array(zod.object({ + "candidate_handle": zod.string().min(matchSearchResponseGroupsUnconfirmedItemCandidateHandleMin).max(matchSearchResponseGroupsUnconfirmedItemCandidateHandleMax).regex(matchSearchResponseGroupsUnconfirmedItemCandidateHandleRegExp).describe('Opaque reference to a candidate as one organization sees it, taken from the organization-scoped anonymous card. It is a versioned HMAC alias, not a candidate account or profile identifier; it contains no contact information and is meaningless to another organization. The server resolves it only against the current visible cohort of the organization in the path. Clients never parse or construct it. It is shared by the candidate-card read and invitations.'), + "specialization": zod.enum(['backend', 'frontend', 'mobile', 'network_engineer', 'devops_sre', 'data_analyst', 'ds_ml', 'information_security', 'qa']).describe('Stable code of a specialization. A category is a specialization together with a confirmed grade; programming languages and the technology stack are separate attributes and never form a category of their own, so Backend with Go is the category `backend`, not `go`. Algorithms is a shared assessment module, not a specialization, and has no code here.\n\n- backend: Backend (development).\n- frontend: Frontend (development).\n- mobile: Mobile (development).\n- network_engineer: Network Engineer (infrastructure).\n- devops_sre: DevOps/SRE (infrastructure).\n- data_analyst: Data Analyst (data).\n- ds_ml: DS/ML (data).\n- information_security: Information security (security).\n- qa: QA (quality).\n\nAdding a value is a contract change; renaming or removing one is a breaking change.'), + "confirmation_status": zod.enum(['unconfirmed']), + "declared_grade": zod.union([zod.enum(['intern', 'junior', 'middle', 'senior']).describe('Grade of the MVP scale in ascending order: `intern`, `junior`, `middle`, `senior`. The same codes describe a self-assessed grade, which the candidate states, and a confirmed grade, which only an assessment result establishes. Lead and Architect are planned after the MVP; adding a value is a contract change.'),zod.null()]).describe('Candidate-declared grade, separate from assessment confirmation.'), + "category": zod.null().describe('There is no confirmed category for this specialization.'), + "strength": zod.null().describe('Assessment strength is not measured for this specialization.'), + "public_context": zod.object({ + "stack": zod.union([zod.array(zod.enum(['go', 'postgresql', 'kafka', 'docker']).describe('A stack code that the anonymous card may expose. Search filters do not accept arbitrary profile text or candidate-provided evidence.')).max(matchSearchResponseGroupsUnconfirmedItemPublicContextStackOneMax),zod.null()]), + "experience_band": zod.union([zod.enum(['0_1', '1_3', '3_6', '6_plus', '0_3', '3_plus']).describe('Coarse total experience bucket. Rare combinations may be generalized to 0_3 or 3_plus before they are returned.'),zod.null()]), + "work_formats": zod.union([zod.array(zod.enum(['remote', 'office', 'hybrid']).describe('Acceptable work format: `remote`, `office`, or `hybrid`.')).max(matchSearchResponseGroupsUnconfirmedItemPublicContextWorkFormatsOneMax),zod.null()]), + "salary_compatibility": zod.union([zod.enum(['compatible', 'not_compatible']).describe('A coarse compatibility result only. No salary amount, minimum, range, or threshold is part of the anonymous card.'),zod.null()]) +}).describe('Safe anonymous-card context only. A null value means that the value is not in the public card or is not present; the response does not reveal which. It contains no contact, candidate location, or salary amount.'), + "evidence_summary": zod.array(zod.object({ + "code": zod.enum(['confirmed_category', 'required_skill_evidence', 'desired_skill_evidence', 'domain_alignment', 'task_alignment', 'work_conditions_match', 'salary_compatibility', 'declared_grade']).describe('Template code for an explanation derived from allowed evidence. It carries no free text, raw answer, or reason for withheld FSP data.'), + "state": zod.enum(['supports', 'partial', 'gap', 'declared_only']) +}).describe('A templated, non-text evidence explanation.')).max(matchSearchResponseGroupsUnconfirmedItemEvidenceSummaryMax), + "components": zod.object({ + "fit": zod.number().min(matchSearchResponseGroupsUnconfirmedItemComponentsFitMin).max(matchSearchResponseGroupsUnconfirmedItemComponentsFitMax).describe('Job fit for this specialization, never an assessment score.'), + "coverage": zod.number().min(matchSearchResponseGroupsUnconfirmedItemComponentsCoverageMin).max(matchSearchResponseGroupsUnconfirmedItemComponentsCoverageMax).describe('Coverage of confirmed need skills by allowed public evidence.') +}).describe('Unconfirmed entries are ordered only by Fit and coverage. This strict component object has no theta, T, P, test percentile, or confirmed assessment score.'), + "unknown_flags": zod.array(zod.object({ + "component": zod.enum(['semantics', 'percentile', 'assessment', 'freshness', 'responsiveness', 'experience_band', 'work_formats', 'salary_compatibility', 'domain']).describe('Ranking or public-card component whose value is unknown.'), + "reason": zod.enum(['ml_unavailable', 'cohort_below_30', 'no_confirmation_for_specialization', 'not_in_public_card', 'need_field_unconfirmed', 'no_freshness_history', 'no_response_history']).describe('Bounded explanation for an unknown component, not a hiding reason.') +}).describe('A safe, bounded explanation for one unavailable component.')).max(matchSearchResponseGroupsUnconfirmedItemUnknownFlagsMax) +}).describe('One specialization with no confirmed category. `category` and `strength` remain present and null. A confirmation in another specialization never changes this entry. The schema intentionally has no assessment measurement fields.')) +}).describe('Separate ranking groups. Confirmed categories appear in main and near; unconfirmed specializations appear only in the lower unconfirmed group.') +}).describe('Anonymous search result grouped by specialization state. Repeated organization-scoped handles are allowed when the same candidate has different specialization entries; entries never transfer confirmation between specializations.') + +export type MatchSearchResponse = zod.input; +export type MatchSearchResponseOutput = zod.output; diff --git a/frontend/src/shared/api/schemas/organization/matchSearchSource.zod.ts b/frontend/src/shared/api/schemas/organization/matchSearchSource.zod.ts new file mode 100644 index 0000000..b69204a --- /dev/null +++ b/frontend/src/shared/api/schemas/organization/matchSearchSource.zod.ts @@ -0,0 +1,39 @@ +/** + * Generated by orval 🍺 + * Do not edit manually. + * Lincodex API + * OpenAPI spec version: 0.1.0 + */ +import * as zod from 'zod'; + + +export const matchSearchSourceTwoFiltersStackOneMax = 4; + +export const matchSearchSourceTwoFiltersConditionsOneWorkFormatsOneMax = 3; + + +export const MatchSearchSource = zod.union([zod.object({ + "kind": zod.enum(['need']), + "need_id": zod.uuid(), + "requirements_version": zod.int().min(1).describe('Version of an employer need. Creation makes version 1, and every committed change of the need advances it by exactly one, including a change made by the server, such as a planned asynchronous ML suggestion. Each version is an immutable snapshot of the need. `requirements_version` names the version whose confirmed requirements are current, so a change that leaves them unchanged creates a need version without a new requirements version.') +}).describe('The immutable need requirements snapshot used by this result.'),zod.object({ + "kind": zod.enum(['bank']), + "filters": zod.object({ + "specialization": zod.union([zod.enum(['backend', 'frontend', 'mobile', 'network_engineer', 'devops_sre', 'data_analyst', 'ds_ml', 'information_security', 'qa']).describe('Stable code of a specialization. A category is a specialization together with a confirmed grade; programming languages and the technology stack are separate attributes and never form a category of their own, so Backend with Go is the category `backend`, not `go`. Algorithms is a shared assessment module, not a specialization, and has no code here.\n\n- backend: Backend (development).\n- frontend: Frontend (development).\n- mobile: Mobile (development).\n- network_engineer: Network Engineer (infrastructure).\n- devops_sre: DevOps/SRE (infrastructure).\n- data_analyst: Data Analyst (data).\n- ds_ml: DS/ML (data).\n- information_security: Information security (security).\n- qa: QA (quality).\n\nAdding a value is a contract change; renaming or removing one is a breaking change.'),zod.null()]), + "confirmed_grade": zod.union([zod.enum(['intern', 'junior', 'middle', 'senior']).describe('Grade of the MVP scale in ascending order: `intern`, `junior`, `middle`, `senior`. The same codes describe a self-assessed grade, which the candidate states, and a confirmed grade, which only an assessment result establishes. Lead and Architect are planned after the MVP; adding a value is a contract change.'),zod.null()]), + "confirmed_category": zod.union([zod.object({ + "specialization": zod.enum(['backend', 'frontend', 'mobile', 'network_engineer', 'devops_sre', 'data_analyst', 'ds_ml', 'information_security', 'qa']).describe('Stable code of a specialization. A category is a specialization together with a confirmed grade; programming languages and the technology stack are separate attributes and never form a category of their own, so Backend with Go is the category `backend`, not `go`. Algorithms is a shared assessment module, not a specialization, and has no code here.\n\n- backend: Backend (development).\n- frontend: Frontend (development).\n- mobile: Mobile (development).\n- network_engineer: Network Engineer (infrastructure).\n- devops_sre: DevOps/SRE (infrastructure).\n- data_analyst: Data Analyst (data).\n- ds_ml: DS/ML (data).\n- information_security: Information security (security).\n- qa: QA (quality).\n\nAdding a value is a contract change; renaming or removing one is a breaking change.'), + "grade": zod.enum(['intern', 'junior', 'middle', 'senior']).describe('Grade of the MVP scale in ascending order: `intern`, `junior`, `middle`, `senior`. The same codes describe a self-assessed grade, which the candidate states, and a confirmed grade, which only an assessment result establishes. Lead and Architect are planned after the MVP; adding a value is a contract change.') +}).describe('A confirmed category filter, never a candidate declaration.'),zod.null()]), + "confirmation_status": zod.union([zod.enum(['confirmed', 'unconfirmed']).describe('Confirmation state for this specialization only. A result for one specialization never changes the state of another specialization.'),zod.null()]), + "declared_grade": zod.union([zod.enum(['intern', 'junior', 'middle', 'senior']).describe('Grade of the MVP scale in ascending order: `intern`, `junior`, `middle`, `senior`. The same codes describe a self-assessed grade, which the candidate states, and a confirmed grade, which only an assessment result establishes. Lead and Architect are planned after the MVP; adding a value is a contract change.'),zod.null()]), + "stack": zod.union([zod.array(zod.enum(['go', 'postgresql', 'kafka', 'docker']).describe('A stack code that the anonymous card may expose. Search filters do not accept arbitrary profile text or candidate-provided evidence.')).min(1).max(matchSearchSourceTwoFiltersStackOneMax),zod.null()]), + "conditions": zod.union([zod.object({ + "work_formats": zod.union([zod.array(zod.enum(['remote', 'office', 'hybrid']).describe('Acceptable work format: `remote`, `office`, or `hybrid`.')).min(1).max(matchSearchSourceTwoFiltersConditionsOneWorkFormatsOneMax),zod.null()]), + "salary_compatibility": zod.union([zod.enum(['compatible', 'not_compatible']).describe('A coarse compatibility result only. No salary amount, minimum, range, or threshold is part of the anonymous card.'),zod.null()]) +}).describe('Conditions echoed as a complete snapshot; null means no filter.'),zod.null()]) +}).describe('A normalized response snapshot of the bank filters. Each key is present; null means the corresponding request filter was omitted. This keeps a search result tied to its exact filter basis.') +}).describe('The normalized filters used for a bank search.')]).describe('Search basis echoed with the response so the displayed result remains tied to its need requirements version or bank filters.') + +export type MatchSearchSource = zod.input; +export type MatchSearchSourceOutput = zod.output; diff --git a/frontend/src/shared/api/schemas/organization/matchSearchStackTag.zod.ts b/frontend/src/shared/api/schemas/organization/matchSearchStackTag.zod.ts new file mode 100644 index 0000000..1d3e4b6 --- /dev/null +++ b/frontend/src/shared/api/schemas/organization/matchSearchStackTag.zod.ts @@ -0,0 +1,12 @@ +/** + * Generated by orval 🍺 + * Do not edit manually. + * Lincodex API + * OpenAPI spec version: 0.1.0 + */ +import * as zod from 'zod'; + +export const MatchSearchStackTag = zod.enum(['go', 'postgresql', 'kafka', 'docker']).describe('A stack code that the anonymous card may expose. Search filters do not accept arbitrary profile text or candidate-provided evidence.') + +export type MatchSearchStackTag = zod.input; +export type MatchSearchStackTagOutput = zod.output; diff --git a/frontend/src/shared/api/schemas/organization/matchStrength.zod.ts b/frontend/src/shared/api/schemas/organization/matchStrength.zod.ts new file mode 100644 index 0000000..e1f2c3f --- /dev/null +++ b/frontend/src/shared/api/schemas/organization/matchStrength.zod.ts @@ -0,0 +1,12 @@ +/** + * Generated by orval 🍺 + * Do not edit manually. + * Lincodex API + * OpenAPI spec version: 0.1.0 + */ +import * as zod from 'zod'; + +export const MatchStrength = zod.enum(['standard', 'strong']).describe('Coarse strength of a confirmed assessment for this specialization.') + +export type MatchStrength = zod.input; +export type MatchStrengthOutput = zod.output; diff --git a/frontend/src/shared/api/schemas/organization/matchUnconfirmedCandidate.zod.ts b/frontend/src/shared/api/schemas/organization/matchUnconfirmedCandidate.zod.ts new file mode 100644 index 0000000..7efafdc --- /dev/null +++ b/frontend/src/shared/api/schemas/organization/matchUnconfirmedCandidate.zod.ts @@ -0,0 +1,57 @@ +/** + * Generated by orval 🍺 + * Do not edit manually. + * Lincodex API + * OpenAPI spec version: 0.1.0 + */ +import * as zod from 'zod'; + +export const matchUnconfirmedCandidateCandidateHandleMin = 47; +export const matchUnconfirmedCandidateCandidateHandleMax = 47; + + +export const matchUnconfirmedCandidateCandidateHandleRegExp = new RegExp('^cv1_[A-Za-z0-9_-]{43}$'); +export const matchUnconfirmedCandidatePublicContextStackOneMax = 4; + +export const matchUnconfirmedCandidatePublicContextWorkFormatsOneMax = 3; + +export const matchUnconfirmedCandidateEvidenceSummaryMax = 12; + +export const matchUnconfirmedCandidateComponentsFitMin = 0; +export const matchUnconfirmedCandidateComponentsFitMax = 1; + +export const matchUnconfirmedCandidateComponentsCoverageMin = 0; +export const matchUnconfirmedCandidateComponentsCoverageMax = 1; + +export const matchUnconfirmedCandidateUnknownFlagsMax = 9; + + +export const MatchUnconfirmedCandidate = zod.object({ + "candidate_handle": zod.string().min(matchUnconfirmedCandidateCandidateHandleMin).max(matchUnconfirmedCandidateCandidateHandleMax).regex(matchUnconfirmedCandidateCandidateHandleRegExp).describe('Opaque reference to a candidate as one organization sees it, taken from the organization-scoped anonymous card. It is a versioned HMAC alias, not a candidate account or profile identifier; it contains no contact information and is meaningless to another organization. The server resolves it only against the current visible cohort of the organization in the path. Clients never parse or construct it. It is shared by the candidate-card read and invitations.'), + "specialization": zod.enum(['backend', 'frontend', 'mobile', 'network_engineer', 'devops_sre', 'data_analyst', 'ds_ml', 'information_security', 'qa']).describe('Stable code of a specialization. A category is a specialization together with a confirmed grade; programming languages and the technology stack are separate attributes and never form a category of their own, so Backend with Go is the category `backend`, not `go`. Algorithms is a shared assessment module, not a specialization, and has no code here.\n\n- backend: Backend (development).\n- frontend: Frontend (development).\n- mobile: Mobile (development).\n- network_engineer: Network Engineer (infrastructure).\n- devops_sre: DevOps/SRE (infrastructure).\n- data_analyst: Data Analyst (data).\n- ds_ml: DS/ML (data).\n- information_security: Information security (security).\n- qa: QA (quality).\n\nAdding a value is a contract change; renaming or removing one is a breaking change.'), + "confirmation_status": zod.enum(['unconfirmed']), + "declared_grade": zod.union([zod.enum(['intern', 'junior', 'middle', 'senior']).describe('Grade of the MVP scale in ascending order: `intern`, `junior`, `middle`, `senior`. The same codes describe a self-assessed grade, which the candidate states, and a confirmed grade, which only an assessment result establishes. Lead and Architect are planned after the MVP; adding a value is a contract change.'),zod.null()]).describe('Candidate-declared grade, separate from assessment confirmation.'), + "category": zod.null().describe('There is no confirmed category for this specialization.'), + "strength": zod.null().describe('Assessment strength is not measured for this specialization.'), + "public_context": zod.object({ + "stack": zod.union([zod.array(zod.enum(['go', 'postgresql', 'kafka', 'docker']).describe('A stack code that the anonymous card may expose. Search filters do not accept arbitrary profile text or candidate-provided evidence.')).max(matchUnconfirmedCandidatePublicContextStackOneMax),zod.null()]), + "experience_band": zod.union([zod.enum(['0_1', '1_3', '3_6', '6_plus', '0_3', '3_plus']).describe('Coarse total experience bucket. Rare combinations may be generalized to 0_3 or 3_plus before they are returned.'),zod.null()]), + "work_formats": zod.union([zod.array(zod.enum(['remote', 'office', 'hybrid']).describe('Acceptable work format: `remote`, `office`, or `hybrid`.')).max(matchUnconfirmedCandidatePublicContextWorkFormatsOneMax),zod.null()]), + "salary_compatibility": zod.union([zod.enum(['compatible', 'not_compatible']).describe('A coarse compatibility result only. No salary amount, minimum, range, or threshold is part of the anonymous card.'),zod.null()]) +}).describe('Safe anonymous-card context only. A null value means that the value is not in the public card or is not present; the response does not reveal which. It contains no contact, candidate location, or salary amount.'), + "evidence_summary": zod.array(zod.object({ + "code": zod.enum(['confirmed_category', 'required_skill_evidence', 'desired_skill_evidence', 'domain_alignment', 'task_alignment', 'work_conditions_match', 'salary_compatibility', 'declared_grade']).describe('Template code for an explanation derived from allowed evidence. It carries no free text, raw answer, or reason for withheld FSP data.'), + "state": zod.enum(['supports', 'partial', 'gap', 'declared_only']) +}).describe('A templated, non-text evidence explanation.')).max(matchUnconfirmedCandidateEvidenceSummaryMax), + "components": zod.object({ + "fit": zod.number().min(matchUnconfirmedCandidateComponentsFitMin).max(matchUnconfirmedCandidateComponentsFitMax).describe('Job fit for this specialization, never an assessment score.'), + "coverage": zod.number().min(matchUnconfirmedCandidateComponentsCoverageMin).max(matchUnconfirmedCandidateComponentsCoverageMax).describe('Coverage of confirmed need skills by allowed public evidence.') +}).describe('Unconfirmed entries are ordered only by Fit and coverage. This strict component object has no theta, T, P, test percentile, or confirmed assessment score.'), + "unknown_flags": zod.array(zod.object({ + "component": zod.enum(['semantics', 'percentile', 'assessment', 'freshness', 'responsiveness', 'experience_band', 'work_formats', 'salary_compatibility', 'domain']).describe('Ranking or public-card component whose value is unknown.'), + "reason": zod.enum(['ml_unavailable', 'cohort_below_30', 'no_confirmation_for_specialization', 'not_in_public_card', 'need_field_unconfirmed', 'no_freshness_history', 'no_response_history']).describe('Bounded explanation for an unknown component, not a hiding reason.') +}).describe('A safe, bounded explanation for one unavailable component.')).max(matchUnconfirmedCandidateUnknownFlagsMax) +}).describe('One specialization with no confirmed category. `category` and `strength` remain present and null. A confirmation in another specialization never changes this entry. The schema intentionally has no assessment measurement fields.') + +export type MatchUnconfirmedCandidate = zod.input; +export type MatchUnconfirmedCandidateOutput = zod.output; diff --git a/frontend/src/shared/api/schemas/organization/matchUnconfirmedComponents.zod.ts b/frontend/src/shared/api/schemas/organization/matchUnconfirmedComponents.zod.ts new file mode 100644 index 0000000..58fd1fa --- /dev/null +++ b/frontend/src/shared/api/schemas/organization/matchUnconfirmedComponents.zod.ts @@ -0,0 +1,22 @@ +/** + * Generated by orval 🍺 + * Do not edit manually. + * Lincodex API + * OpenAPI spec version: 0.1.0 + */ +import * as zod from 'zod'; + +export const matchUnconfirmedComponentsFitMin = 0; +export const matchUnconfirmedComponentsFitMax = 1; + +export const matchUnconfirmedComponentsCoverageMin = 0; +export const matchUnconfirmedComponentsCoverageMax = 1; + + +export const MatchUnconfirmedComponents = zod.object({ + "fit": zod.number().min(matchUnconfirmedComponentsFitMin).max(matchUnconfirmedComponentsFitMax).describe('Job fit for this specialization, never an assessment score.'), + "coverage": zod.number().min(matchUnconfirmedComponentsCoverageMin).max(matchUnconfirmedComponentsCoverageMax).describe('Coverage of confirmed need skills by allowed public evidence.') +}).describe('Unconfirmed entries are ordered only by Fit and coverage. This strict component object has no theta, T, P, test percentile, or confirmed assessment score.') + +export type MatchUnconfirmedComponents = zod.input; +export type MatchUnconfirmedComponentsOutput = zod.output; diff --git a/frontend/src/shared/api/schemas/organization/matchUnknownComponent.zod.ts b/frontend/src/shared/api/schemas/organization/matchUnknownComponent.zod.ts new file mode 100644 index 0000000..5ebdc40 --- /dev/null +++ b/frontend/src/shared/api/schemas/organization/matchUnknownComponent.zod.ts @@ -0,0 +1,12 @@ +/** + * Generated by orval 🍺 + * Do not edit manually. + * Lincodex API + * OpenAPI spec version: 0.1.0 + */ +import * as zod from 'zod'; + +export const MatchUnknownComponent = zod.enum(['semantics', 'percentile', 'assessment', 'freshness', 'responsiveness', 'experience_band', 'work_formats', 'salary_compatibility', 'domain']).describe('Ranking or public-card component whose value is unknown.') + +export type MatchUnknownComponent = zod.input; +export type MatchUnknownComponentOutput = zod.output; diff --git a/frontend/src/shared/api/schemas/organization/matchUnknownFlag.zod.ts b/frontend/src/shared/api/schemas/organization/matchUnknownFlag.zod.ts new file mode 100644 index 0000000..96f4f59 --- /dev/null +++ b/frontend/src/shared/api/schemas/organization/matchUnknownFlag.zod.ts @@ -0,0 +1,15 @@ +/** + * Generated by orval 🍺 + * Do not edit manually. + * Lincodex API + * OpenAPI spec version: 0.1.0 + */ +import * as zod from 'zod'; + +export const MatchUnknownFlag = zod.object({ + "component": zod.enum(['semantics', 'percentile', 'assessment', 'freshness', 'responsiveness', 'experience_band', 'work_formats', 'salary_compatibility', 'domain']).describe('Ranking or public-card component whose value is unknown.'), + "reason": zod.enum(['ml_unavailable', 'cohort_below_30', 'no_confirmation_for_specialization', 'not_in_public_card', 'need_field_unconfirmed', 'no_freshness_history', 'no_response_history']).describe('Bounded explanation for an unknown component, not a hiding reason.') +}).describe('A safe, bounded explanation for one unavailable component.') + +export type MatchUnknownFlag = zod.input; +export type MatchUnknownFlagOutput = zod.output; diff --git a/frontend/src/shared/api/schemas/organization/matchUnknownFlags.zod.ts b/frontend/src/shared/api/schemas/organization/matchUnknownFlags.zod.ts new file mode 100644 index 0000000..41536d7 --- /dev/null +++ b/frontend/src/shared/api/schemas/organization/matchUnknownFlags.zod.ts @@ -0,0 +1,18 @@ +/** + * Generated by orval 🍺 + * Do not edit manually. + * Lincodex API + * OpenAPI spec version: 0.1.0 + */ +import * as zod from 'zod'; + +export const MatchUnknownFlagsMax = 9; + + +export const MatchUnknownFlags = zod.array(zod.object({ + "component": zod.enum(['semantics', 'percentile', 'assessment', 'freshness', 'responsiveness', 'experience_band', 'work_formats', 'salary_compatibility', 'domain']).describe('Ranking or public-card component whose value is unknown.'), + "reason": zod.enum(['ml_unavailable', 'cohort_below_30', 'no_confirmation_for_specialization', 'not_in_public_card', 'need_field_unconfirmed', 'no_freshness_history', 'no_response_history']).describe('Bounded explanation for an unknown component, not a hiding reason.') +}).describe('A safe, bounded explanation for one unavailable component.')).max(MatchUnknownFlagsMax) + +export type MatchUnknownFlags = zod.input; +export type MatchUnknownFlagsOutput = zod.output; diff --git a/frontend/src/shared/api/schemas/organization/matchUnknownReason.zod.ts b/frontend/src/shared/api/schemas/organization/matchUnknownReason.zod.ts new file mode 100644 index 0000000..f7d586e --- /dev/null +++ b/frontend/src/shared/api/schemas/organization/matchUnknownReason.zod.ts @@ -0,0 +1,12 @@ +/** + * Generated by orval 🍺 + * Do not edit manually. + * Lincodex API + * OpenAPI spec version: 0.1.0 + */ +import * as zod from 'zod'; + +export const MatchUnknownReason = zod.enum(['ml_unavailable', 'cohort_below_30', 'no_confirmation_for_specialization', 'not_in_public_card', 'need_field_unconfirmed', 'no_freshness_history', 'no_response_history']).describe('Bounded explanation for an unknown component, not a hiding reason.') + +export type MatchUnknownReason = zod.input; +export type MatchUnknownReasonOutput = zod.output; diff --git a/frontend/src/shared/api/schemas/organization/searchOrganizationMatchesBody.zod.ts b/frontend/src/shared/api/schemas/organization/searchOrganizationMatchesBody.zod.ts new file mode 100644 index 0000000..f00080f --- /dev/null +++ b/frontend/src/shared/api/schemas/organization/searchOrganizationMatchesBody.zod.ts @@ -0,0 +1,56 @@ +/** + * Generated by orval 🍺 + * Do not edit manually. + * Lincodex API + * OpenAPI spec version: 0.1.0 + */ +import * as zod from 'zod'; + + +export const searchOrganizationMatchesBodyOneFiltersStackMax = 4; + +export const searchOrganizationMatchesBodyOneFiltersConditionsWorkFormatsMax = 3; + +export const searchOrganizationMatchesBodyTwoFiltersStackMax = 4; + +export const searchOrganizationMatchesBodyTwoFiltersConditionsWorkFormatsMax = 3; + + +export const SearchOrganizationMatchesBody = zod.union([zod.object({ + "need_id": zod.uuid().describe('Need owned by the organization in the path.'), + "requirements_version": zod.int().min(1).describe('Version of an employer need. Creation makes version 1, and every committed change of the need advances it by exactly one, including a change made by the server, such as a planned asynchronous ML suggestion. Each version is an immutable snapshot of the need. `requirements_version` names the version whose confirmed requirements are current, so a change that leaves them unchanged creates a need version without a new requirements version.'), + "filters": zod.object({ + "specialization": zod.enum(['backend', 'frontend', 'mobile', 'network_engineer', 'devops_sre', 'data_analyst', 'ds_ml', 'information_security', 'qa']).exactOptional().describe('Stable code of a specialization. A category is a specialization together with a confirmed grade; programming languages and the technology stack are separate attributes and never form a category of their own, so Backend with Go is the category `backend`, not `go`. Algorithms is a shared assessment module, not a specialization, and has no code here.\n\n- backend: Backend (development).\n- frontend: Frontend (development).\n- mobile: Mobile (development).\n- network_engineer: Network Engineer (infrastructure).\n- devops_sre: DevOps/SRE (infrastructure).\n- data_analyst: Data Analyst (data).\n- ds_ml: DS/ML (data).\n- information_security: Information security (security).\n- qa: QA (quality).\n\nAdding a value is a contract change; renaming or removing one is a breaking change.'), + "confirmed_grade": zod.enum(['intern', 'junior', 'middle', 'senior']).exactOptional().describe('Match only candidates with this currently confirmed grade in the selected specialization. It never matches a declared grade.'), + "confirmed_category": zod.object({ + "specialization": zod.enum(['backend', 'frontend', 'mobile', 'network_engineer', 'devops_sre', 'data_analyst', 'ds_ml', 'information_security', 'qa']).describe('Stable code of a specialization. A category is a specialization together with a confirmed grade; programming languages and the technology stack are separate attributes and never form a category of their own, so Backend with Go is the category `backend`, not `go`. Algorithms is a shared assessment module, not a specialization, and has no code here.\n\n- backend: Backend (development).\n- frontend: Frontend (development).\n- mobile: Mobile (development).\n- network_engineer: Network Engineer (infrastructure).\n- devops_sre: DevOps/SRE (infrastructure).\n- data_analyst: Data Analyst (data).\n- ds_ml: DS/ML (data).\n- information_security: Information security (security).\n- qa: QA (quality).\n\nAdding a value is a contract change; renaming or removing one is a breaking change.'), + "grade": zod.enum(['intern', 'junior', 'middle', 'senior']).describe('Grade of the MVP scale in ascending order: `intern`, `junior`, `middle`, `senior`. The same codes describe a self-assessed grade, which the candidate states, and a confirmed grade, which only an assessment result establishes. Lead and Architect are planned after the MVP; adding a value is a contract change.') +}).exactOptional().describe('A confirmed category filter, never a candidate declaration.'), + "confirmation_status": zod.enum(['confirmed', 'unconfirmed']).exactOptional().describe('Confirmation state for this specialization only. A result for one specialization never changes the state of another specialization.'), + "declared_grade": zod.enum(['intern', 'junior', 'middle', 'senior']).exactOptional().describe('Candidate-declared grade filter. This is a separate claim and cannot satisfy `confirmed_grade` or `confirmed_category`.'), + "stack": zod.array(zod.enum(['go', 'postgresql', 'kafka', 'docker']).describe('A stack code that the anonymous card may expose. Search filters do not accept arbitrary profile text or candidate-provided evidence.')).min(1).max(searchOrganizationMatchesBodyOneFiltersStackMax).exactOptional(), + "conditions": zod.object({ + "work_formats": zod.array(zod.enum(['remote', 'office', 'hybrid']).describe('Acceptable work format: `remote`, `office`, or `hybrid`.')).min(1).max(searchOrganizationMatchesBodyOneFiltersConditionsWorkFormatsMax).exactOptional(), + "salary_compatibility": zod.enum(['compatible', 'not_compatible']).exactOptional().describe('A coarse compatibility result only. No salary amount, minimum, range, or threshold is part of the anonymous card.') +}).exactOptional().describe('Filters against safe, coarse card conditions. No candidate location, salary amount, salary minimum, or salary range is accepted.') +}).exactOptional().describe('Optional filters over the current organization-visible bank. An empty object means no additional filter. Confirmed and declared grades are separate fields; a declaration never satisfies a confirmed-grade or category filter. Conditions use only the safe, coarse card fields.') +}).describe('Search one immutable set of confirmed requirements. `requirements_version` is the Need.requirements_version, not the general Need.version; text-only or suggestion-only edits do not change this search basis.'),zod.object({ + "filters": zod.object({ + "specialization": zod.enum(['backend', 'frontend', 'mobile', 'network_engineer', 'devops_sre', 'data_analyst', 'ds_ml', 'information_security', 'qa']).exactOptional().describe('Stable code of a specialization. A category is a specialization together with a confirmed grade; programming languages and the technology stack are separate attributes and never form a category of their own, so Backend with Go is the category `backend`, not `go`. Algorithms is a shared assessment module, not a specialization, and has no code here.\n\n- backend: Backend (development).\n- frontend: Frontend (development).\n- mobile: Mobile (development).\n- network_engineer: Network Engineer (infrastructure).\n- devops_sre: DevOps/SRE (infrastructure).\n- data_analyst: Data Analyst (data).\n- ds_ml: DS/ML (data).\n- information_security: Information security (security).\n- qa: QA (quality).\n\nAdding a value is a contract change; renaming or removing one is a breaking change.'), + "confirmed_grade": zod.enum(['intern', 'junior', 'middle', 'senior']).exactOptional().describe('Match only candidates with this currently confirmed grade in the selected specialization. It never matches a declared grade.'), + "confirmed_category": zod.object({ + "specialization": zod.enum(['backend', 'frontend', 'mobile', 'network_engineer', 'devops_sre', 'data_analyst', 'ds_ml', 'information_security', 'qa']).describe('Stable code of a specialization. A category is a specialization together with a confirmed grade; programming languages and the technology stack are separate attributes and never form a category of their own, so Backend with Go is the category `backend`, not `go`. Algorithms is a shared assessment module, not a specialization, and has no code here.\n\n- backend: Backend (development).\n- frontend: Frontend (development).\n- mobile: Mobile (development).\n- network_engineer: Network Engineer (infrastructure).\n- devops_sre: DevOps/SRE (infrastructure).\n- data_analyst: Data Analyst (data).\n- ds_ml: DS/ML (data).\n- information_security: Information security (security).\n- qa: QA (quality).\n\nAdding a value is a contract change; renaming or removing one is a breaking change.'), + "grade": zod.enum(['intern', 'junior', 'middle', 'senior']).describe('Grade of the MVP scale in ascending order: `intern`, `junior`, `middle`, `senior`. The same codes describe a self-assessed grade, which the candidate states, and a confirmed grade, which only an assessment result establishes. Lead and Architect are planned after the MVP; adding a value is a contract change.') +}).exactOptional().describe('A confirmed category filter, never a candidate declaration.'), + "confirmation_status": zod.enum(['confirmed', 'unconfirmed']).exactOptional().describe('Confirmation state for this specialization only. A result for one specialization never changes the state of another specialization.'), + "declared_grade": zod.enum(['intern', 'junior', 'middle', 'senior']).exactOptional().describe('Candidate-declared grade filter. This is a separate claim and cannot satisfy `confirmed_grade` or `confirmed_category`.'), + "stack": zod.array(zod.enum(['go', 'postgresql', 'kafka', 'docker']).describe('A stack code that the anonymous card may expose. Search filters do not accept arbitrary profile text or candidate-provided evidence.')).min(1).max(searchOrganizationMatchesBodyTwoFiltersStackMax).exactOptional(), + "conditions": zod.object({ + "work_formats": zod.array(zod.enum(['remote', 'office', 'hybrid']).describe('Acceptable work format: `remote`, `office`, or `hybrid`.')).min(1).max(searchOrganizationMatchesBodyTwoFiltersConditionsWorkFormatsMax).exactOptional(), + "salary_compatibility": zod.enum(['compatible', 'not_compatible']).exactOptional().describe('A coarse compatibility result only. No salary amount, minimum, range, or threshold is part of the anonymous card.') +}).exactOptional().describe('Filters against safe, coarse card conditions. No candidate location, salary amount, salary minimum, or salary range is accepted.') +}).describe('Optional filters over the current organization-visible bank. An empty object means no additional filter. Confirmed and declared grades are separate fields; a declaration never satisfies a confirmed-grade or category filter. Conditions use only the safe, coarse card fields.') +}).describe('Search the current organization-visible bank. An empty `filters` object includes all otherwise eligible specializations as separate entries.')]).describe('Search either a Need.requirements_version snapshot or the whole organization-visible bank with explicit filters. Unknown fields are rejected by both closed request variants.') + +export type SearchOrganizationMatchesBody = zod.input; +export type SearchOrganizationMatchesBodyOutput = zod.output; diff --git a/frontend/src/shared/api/schemas/privacy/index.ts b/frontend/src/shared/api/schemas/privacy/index.ts index c95744b..0325e9f 100644 --- a/frontend/src/shared/api/schemas/privacy/index.ts +++ b/frontend/src/shared/api/schemas/privacy/index.ts @@ -6,8 +6,6 @@ */ export * from './anonymousCardContent.zod'; -export * from './candidateExperienceBand.zod'; -export * from './candidateSalaryCompatibility.zod'; export * from './candidateWorkFormat.zod'; export * from './cardAccess.zod'; export * from './cardAccessKind.zod'; diff --git a/scripts/test_match_contract.py b/scripts/test_match_contract.py new file mode 100644 index 0000000..c03127b --- /dev/null +++ b/scripts/test_match_contract.py @@ -0,0 +1,610 @@ +"""Check the split match contract without requiring a generated API bundle.""" + +from __future__ import annotations + +import copy +import json +import subprocess +import tempfile +import unittest +from pathlib import Path +from typing import Any + +import yaml + +ROOT = Path(__file__).resolve().parents[1] +CORE = ROOT / "api" / "core" +API_ROOT = ROOT / "api" +SCHEMA_PATH = CORE / "components" / "schemas" / "match_schemas.yml" +ROUTE_PATH = CORE / "routes" / "matches.yml" +EXAMPLES_PATH = CORE / "components" / "examples" / "matches.yml" +REDOCLY_PATH = API_ROOT / "node_modules" / ".bin" / "redocly" + +FORBIDDEN_PROPERTIES = { + "account_id", + "answers", + "candidate_name", + "candidate_id", + "candidate_internal_id", + "contact", + "contacts", + "contact_email", + "contact_phone", + "email", + "full_name", + "fsp_hiding_reason", + "fsp_reason", + "fsp_suppression_reason", + "fsp_visibility_reason", + "hidden_fsp_reason", + "hidden_reason", + "min_salary", + "phone", + "phone_number", + "profile_id", + "raw_answer", + "raw_answers", + "salary", + "salary_amount", + "salary_minimum", + "candidate_minimum", + "salary_from", + "salary_range", + "salary_to", + "source_text", + "telegram", +} + +FORBIDDEN_PROPERTY_FRAGMENTS = { + "suppression_reason", + "hidden_reason", + "fsp_hidden", + "fsp_suppress", +} + +UNCONFIRMED_MEASUREMENTS = { + "ability_estimate", + "percentile", + "p", + "t", + "test_percentile", + "theta", +} + + +def load_yaml(path: Path) -> dict[str, Any]: + with path.open(encoding="utf-8") as stream: + value = yaml.safe_load(stream) + if not isinstance(value, dict): + raise TypeError(f"{path} must contain a YAML mapping") + return value + + +def load_contract() -> tuple[dict[str, Any], dict[str, Any], dict[str, Any]]: + schema_document = load_yaml(SCHEMA_PATH) + route_document = load_yaml(ROUTE_PATH) + examples_document = load_yaml(EXAMPLES_PATH) + return ( + schema_document.get("schemas", {}), + route_document, + examples_document, + ) + + +def resolve_local(schema: dict[str, Any], schemas: dict[str, Any]) -> dict[str, Any]: + current = schema + visited: set[str] = set() + while "$ref" in current: + reference = current["$ref"] + if not reference.startswith("#/schemas/"): + return current + name = reference.rsplit("/", 1)[1] + if name in visited: + raise AssertionError(f"cyclic local schema reference: {name}") + visited.add(name) + current = schemas[name] + return current + + +def local_reference_name(schema: dict[str, Any]) -> str: + reference = schema.get("$ref", "") + if not reference.startswith("#/schemas/"): + raise AssertionError(f"expected local schema reference, got {reference!r}") + return reference.rsplit("/", 1)[1] + + +def walk_schema( + schema: dict[str, Any], schemas: dict[str, Any], seen: set[str] | None = None +): + """Yield a local schema and its locally referenced child schemas.""" + active = set() if seen is None else seen + current = schema + reference = current.get("$ref") + if isinstance(reference, str) and reference.startswith("#/schemas/"): + name = reference.rsplit("/", 1)[1] + if name in active: + return + active.add(name) + current = schemas[name] + yield current + for key in ("properties",): + properties = current.get(key, {}) + if isinstance(properties, dict): + for child in properties.values(): + if isinstance(child, dict): + yield from walk_schema(child, schemas, active) + items = current.get("items") + if isinstance(items, dict): + yield from walk_schema(items, schemas, active) + for key in ("oneOf", "anyOf", "allOf"): + branches = current.get(key, []) + if isinstance(branches, list): + for child in branches: + if isinstance(child, dict): + yield from walk_schema(child, schemas, active) + + +def property_names(schema: dict[str, Any], schemas: dict[str, Any]) -> set[str]: + names: set[str] = set() + for node in walk_schema(schema, schemas): + properties = node.get("properties", {}) + if isinstance(properties, dict): + names.update(properties) + return names + + +def example_value(examples: dict[str, Any], name: str) -> dict[str, Any]: + example = examples[name] + value = example.get("value") + if not isinstance(value, dict): + raise TypeError(f"example {name} must contain an object value") + return value + + +def card_properties(card: dict[str, Any], schemas: dict[str, Any]) -> set[str]: + properties = property_names(card, schemas) + return properties + + +def assert_no_sensitive_keys(test: unittest.TestCase, value: Any) -> None: + if isinstance(value, dict): + for key, child in value.items(): + test.assertNotIn(key, FORBIDDEN_PROPERTIES) + test.assertFalse( + any( + fragment in key.lower() for fragment in FORBIDDEN_PROPERTY_FRAGMENTS + ), + key, + ) + assert_no_sensitive_keys(test, child) + elif isinstance(value, list): + for child in value: + assert_no_sensitive_keys(test, child) + + +def lint_match_examples( + request_examples: dict[str, Any], response_examples: dict[str, Any] +) -> subprocess.CompletedProcess[str]: + if not REDOCLY_PATH.is_file(): + raise AssertionError(f"Redocly CLI is unavailable: {REDOCLY_PATH}") + + schema_path = Path("..") / "core" / "components" / "schemas" / "match_schemas.yml" + with tempfile.TemporaryDirectory( + prefix="match-contract-", dir=API_ROOT + ) as directory: + temporary = Path(directory) + config_path = temporary / "redocly.yml" + config_path.write_text( + yaml.safe_dump( + { + "extends": [], + "rules": {"no-invalid-media-type-examples": "error"}, + }, + sort_keys=False, + ), + encoding="utf-8", + ) + + content: dict[str, Any] = {} + if request_examples: + content["requestBody"] = { + "required": True, + "content": { + "application/json": { + "schema": { + "$ref": f"{schema_path.as_posix()}#/schemas/MatchSearchRequest" + }, + "examples": { + name: {"value": value} + for name, value in request_examples.items() + }, + } + }, + } + content["responses"] = { + "200": { + "description": "Match results", + "content": { + "application/json": { + "schema": { + "$ref": f"{schema_path.as_posix()}#/schemas/MatchSearchResponse" + }, + "examples": { + name: {"value": value} + for name, value in response_examples.items() + }, + } + }, + } + } + document_path = temporary / "openapi.yml" + document_path.write_text( + yaml.safe_dump( + { + "openapi": "3.2.0", + "info": {"title": "Match contract test", "version": "1.0.0"}, + "paths": {"/matches": {"post": content}}, + }, + sort_keys=False, + ), + encoding="utf-8", + ) + return subprocess.run( + [ + str(REDOCLY_PATH), + "lint", + str(document_path), + "--config", + str(config_path), + "--format", + "json", + ], + cwd=API_ROOT, + capture_output=True, + check=False, + text=True, + timeout=30, + ) + + +class MatchContractTest(unittest.TestCase): + @classmethod + def setUpClass(cls) -> None: + cls.schemas, cls.route, cls.examples = load_contract() + + def test_request_selects_need_requirements_version_or_bank_filters(self) -> None: + request = self.schemas["MatchSearchRequest"] + branches = {local_reference_name(branch) for branch in request["oneOf"]} + self.assertEqual(branches, {"MatchSearchByNeed", "MatchSearchByBank"}) + + need = self.schemas["MatchSearchByNeed"] + self.assertFalse(need["additionalProperties"]) + self.assertEqual(set(need["required"]), {"need_id", "requirements_version"}) + self.assertEqual(need["properties"]["need_id"]["format"], "uuid") + self.assertEqual( + need["properties"]["requirements_version"]["$ref"], + "./need_schemas.yml#/schemas/NeedVersion", + ) + self.assertIn("Need.requirements_version", need["description"]) + self.assertNotIn("version", need["properties"]) + + bank = self.schemas["MatchSearchByBank"] + self.assertFalse(bank["additionalProperties"]) + self.assertEqual(bank["required"], ["filters"]) + filters = resolve_local(bank["properties"]["filters"], self.schemas) + self.assertFalse(filters["additionalProperties"]) + fields = filters["properties"] + self.assertTrue( + { + "specialization", + "confirmed_grade", + "confirmed_category", + "confirmation_status", + "declared_grade", + "stack", + "conditions", + }.issubset(fields) + ) + self.assertEqual( + fields["confirmed_category"]["$ref"], "#/schemas/MatchGradeFilter" + ) + self.assertEqual( + fields["confirmed_grade"]["$ref"], + "./catalog_schemas.yml#/schemas/GradeCode", + ) + self.assertEqual( + fields["declared_grade"]["$ref"], + "./catalog_schemas.yml#/schemas/GradeCode", + ) + self.assertIn("separate", fields["declared_grade"]["description"]) + self.assertNotIn("salary", fields) + + need_example = example_value(self.examples, "SearchByNeed") + self.assertEqual( + set(need_example), {"need_id", "requirements_version", "filters"} + ) + self.assertGreaterEqual(need_example["requirements_version"], 1) + bank_example = example_value(self.examples, "SearchByBank") + self.assertEqual(set(bank_example), {"filters"}) + self.assertEqual( + bank_example["filters"]["confirmed_category"], + {"specialization": "backend", "grade": "middle"}, + ) + self.assertEqual(bank_example["filters"]["declared_grade"], "junior") + + conditions = resolve_local(fields["conditions"], self.schemas) + self.assertEqual( + set(conditions["properties"]), {"work_formats", "salary_compatibility"} + ) + self.assertFalse(conditions["additionalProperties"]) + self.assertNotIn("salary_from", conditions["properties"]) + self.assertNotIn("salary_minimum", conditions["properties"]) + + def test_every_local_object_schema_is_closed(self) -> None: + for name, schema in self.schemas.items(): + with self.subTest(schema=name): + for node in walk_schema(schema, self.schemas): + if node.get("type") == "object": + self.assertIs(node.get("additionalProperties"), False) + + def test_unconfirmed_schema_keeps_nullable_category_and_strength(self) -> None: + unconfirmed = self.schemas["MatchUnconfirmedCandidate"] + properties = unconfirmed["properties"] + self.assertFalse(unconfirmed["additionalProperties"]) + self.assertTrue({"category", "strength"}.issubset(unconfirmed["required"])) + self.assertEqual(properties["category"]["type"], "null") + self.assertEqual(properties["strength"]["type"], "null") + self.assertEqual(properties["confirmation_status"]["enum"], ["unconfirmed"]) + + components = resolve_local(properties["components"], self.schemas) + self.assertEqual(set(components["properties"]), {"fit", "coverage"}) + self.assertFalse( + UNCONFIRMED_MEASUREMENTS.intersection(components["properties"]) + ) + self.assertFalse( + UNCONFIRMED_MEASUREMENTS.intersection( + property_names(unconfirmed, self.schemas) + ) + ) + self.assertEqual( + properties["candidate_handle"]["$ref"], + "./common_schemas.yml#/schemas/CandidateHandle", + ) + + confirmed_components = resolve_local( + self.schemas["MatchConfirmedCandidate"]["properties"]["components"], + self.schemas, + ) + self.assertEqual( + set(confirmed_components["properties"]), + { + "fit", + "coverage", + "domain", + "semantics", + "percentile", + "competition", + "freshness", + "responsiveness", + "rank_score", + }, + ) + for name, component in confirmed_components["properties"].items(): + with self.subTest(component=name): + resolved = resolve_local(component, self.schemas) + if name == "percentile": + self.assertIn("oneOf", resolved) + self.assertIn({"type": "null"}, resolved["oneOf"]) + else: + self.assertEqual(resolved["type"], "number") + + def test_unknown_flags_are_bounded_and_explain_required_unknowns(self) -> None: + reasons = set(self.schemas["MatchUnknownReason"]["enum"]) + self.assertTrue( + { + "ml_unavailable", + "cohort_below_30", + "no_confirmation_for_specialization", + "not_in_public_card", + }.issubset(reasons) + ) + self.assertFalse(any("fsp" in reason.lower() for reason in reasons)) + flags = self.schemas["MatchUnknownFlags"] + self.assertEqual(flags["maxItems"], len(self.schemas["MatchUnknownComponent"]["enum"])) + self.assertIn( + "unknown_flags", self.schemas["MatchUnconfirmedCandidate"]["required"] + ) + + def test_result_schema_exposes_only_anonymous_card_allowlist(self) -> None: + for name in ("MatchConfirmedCandidate", "MatchUnconfirmedCandidate"): + with self.subTest(schema=name): + properties = property_names(self.schemas[name], self.schemas) + self.assertFalse(FORBIDDEN_PROPERTIES.intersection(properties)) + self.assertIn("candidate_handle", properties) + self.assertNotIn("candidate_id", properties) + self.assertNotIn("email", properties) + self.assertNotIn("salary_minimum", properties) + + context = resolve_local( + self.schemas["MatchConfirmedCandidate"]["properties"]["public_context"], + self.schemas, + ) + self.assertEqual( + set(context["properties"]), + {"stack", "experience_band", "work_formats", "salary_compatibility"}, + ) + + def test_route_declares_protected_no_store_operation_and_source_examples( + self, + ) -> None: + self.assertEqual(self.route["post"]["operationId"], "SearchOrganizationMatches") + self.assertEqual( + self.route["post"]["security"], + [{"sessionCookie": [], "sessionCsrf": []}], + ) + self.assertEqual( + self.route["post"]["parameters"][0]["$ref"], + "../components/parameters.yml#/OrganizationId", + ) + operation = self.route["post"] + request_schema_ref = operation["requestBody"]["content"]["application/json"][ + "schema" + ]["$ref"] + self.assertEqual( + request_schema_ref, "../components/schemas.yml#/MatchSearchRequest" + ) + response = operation["responses"]["200"] + self.assertEqual( + response["headers"]["Cache-Control"]["$ref"], + "../components/headers.yml#/CacheControlNoStore", + ) + self.assertEqual( + response["content"]["application/json"]["schema"]["$ref"], + "../components/schemas.yml#/MatchSearchResponse", + ) + example_names = set(self.examples) + for collection in ( + operation["requestBody"]["content"]["application/json"]["examples"], + response["content"]["application/json"]["examples"], + ): + for example in collection.values(): + reference = example["$ref"] + self.assertTrue( + reference.startswith("../components/examples/matches.yml#/") + ) + self.assertIn(reference.rsplit("/", 1)[1], example_names) + + def test_examples_cover_empty_three_groups_and_specialization_independence( + self, + ) -> None: + three_groups = example_value(self.examples, "ThreeGroups") + groups = three_groups["groups"] + self.assertEqual(set(groups), {"main", "near", "unconfirmed"}) + self.assertTrue(groups["main"]) + self.assertTrue(groups["near"]) + self.assertTrue(groups["unconfirmed"]) + self.assertEqual( + example_value(self.examples, "Empty")["groups"], + {"main": [], "near": [], "unconfirmed": []}, + ) + + backend = groups["main"][0] + network = groups["unconfirmed"][0] + for card in (*groups["main"], *groups["near"], *groups["unconfirmed"]): + with self.subTest(handle=card["candidate_handle"]): + self.assertRegex(card["candidate_handle"], r"^cv1_[A-Za-z0-9_-]{43}$") + self.assertEqual(backend["specialization"], "backend") + self.assertEqual(network["specialization"], "network_engineer") + self.assertEqual(backend["confirmation_status"], "confirmed") + self.assertEqual(network["confirmation_status"], "unconfirmed") + self.assertEqual(backend["candidate_handle"], network["candidate_handle"]) + self.assertEqual(backend["category"]["specialization"], "backend") + self.assertIsNone(network["category"]) + self.assertIsNone(network["strength"]) + self.assertEqual( + network["unknown_flags"][0]["reason"], "no_confirmation_for_specialization" + ) + for group_name in ("main", "near"): + for card in groups[group_name]: + with self.subTest( + group=group_name, specialization=card["specialization"] + ): + self.assertEqual(card["confirmation_status"], "confirmed") + self.assertEqual( + card["category"]["specialization"], card["specialization"] + ) + self.assertIn(card["strength"], {"standard", "strong"}) + + def test_ml_and_small_cohort_examples_use_explicit_unknowns(self) -> None: + ml_response = example_value(self.examples, "MLUnavailable") + ml_card = ml_response["groups"]["main"][0] + self.assertEqual(ml_card["components"]["semantics"], 0.5) + self.assertIn( + {"component": "semantics", "reason": "ml_unavailable"}, + ml_card["unknown_flags"], + ) + + cohort_response = example_value(self.examples, "CohortBelow30") + cohort_card = cohort_response["groups"]["main"][0] + self.assertIsNone(cohort_card["components"]["percentile"]) + self.assertIn( + {"component": "percentile", "reason": "cohort_below_30"}, + cohort_card["unknown_flags"], + ) + self.assertNotIn("cohort_size", cohort_card) + + def test_bank_response_echoes_normalized_filter_snapshot(self) -> None: + fields = set(self.schemas["MatchAppliedFilters"]["required"]) + self.assertEqual(fields, set(self.schemas["MatchAppliedFilters"]["properties"])) + for name in ("ThreeGroups", "Empty", "MLUnavailable", "CohortBelow30"): + with self.subTest(example=name): + source = example_value(self.examples, name)["source"] + self.assertEqual(source["kind"], "bank") + self.assertEqual(set(source["filters"]), fields) + + def test_examples_do_not_contain_private_keys(self) -> None: + for name, example in self.examples.items(): + with self.subTest(example=name): + assert_no_sensitive_keys(self, example.get("value")) + + def test_source_examples_validate_against_local_and_external_schemas(self) -> None: + request_names = ("SearchByNeed", "SearchByBank") + request_examples = { + name: example_value(self.examples, name) for name in request_names + } + response_names = tuple( + name for name in self.examples if name not in request_names + ) + response_examples = { + name: example_value(self.examples, name) for name in response_names + } + + groups = example_value(self.examples, "ThreeGroups")["groups"] + self.assertEqual(set(groups), {"main", "near", "unconfirmed"}) + self.assertTrue(groups["main"]) + self.assertTrue(groups["near"]) + self.assertEqual( + example_value(self.examples, "Empty")["groups"], + {"main": [], "near": [], "unconfirmed": []}, + ) + + result = lint_match_examples(request_examples, response_examples) + self.assertEqual(result.returncode, 0, result.stdout or result.stderr) + + def test_schema_validation_rejects_private_card_fields(self) -> None: + invalid_examples: dict[str, Any] = {} + forbidden_values = { + "email": "candidate@example.test", + "candidate_internal_id": "candidate-123", + "salary_minimum": 1000, + } + baseline = example_value(self.examples, "ThreeGroups") + for field, value in forbidden_values.items(): + response = copy.deepcopy(baseline) + response["groups"]["main"][0][field] = value + invalid_examples[field] = response + + result = lint_match_examples({}, invalid_examples) + self.assertNotEqual(result.returncode, 0, result.stdout or result.stderr) + try: + problems = json.loads(result.stdout).get("problems", []) + except json.JSONDecodeError as error: + self.fail( + f"Redocly did not return JSON diagnostics: {error}: {result.stdout}" + ) + messages = [problem.get("message", "") for problem in problems] + self.assertTrue(messages, result.stdout or result.stderr) + for field in forbidden_values: + with self.subTest(field=field): + self.assertTrue( + any( + problem.get("ruleId") == "no-invalid-media-type-examples" + and field in problem.get("message", "") + for problem in problems + ), + result.stdout or result.stderr, + ) + + +if __name__ == "__main__": + unittest.main()