schemas: ConsentPurposeCode: type: string description: |- One of the independent consents of PRD FR01. A grant or a revocation of one purpose never changes another. - c1: processing of personal data, given at registration. - c2: publication of the candidate card. The record proves the consent to the published text; which fields were published and when is evidence of the publication history (TASK-088), not of this record. Adding a field scope to c2 records later is an additive change. - c3: automatic categorization. Without it the candidate can request a manual assessment by the same rubric. - c4: transfer of the selected contact data to one organization, currently given only in an invitation acceptance. - c5: import of FSP results. ConsentPurpose lists the subset whose text the client may read before an account exists. enum: - c1 - c2 - c3 - c4 - c5 ConsentState: type: string description: |- State of a consent record, computed from the ledger. - active: the consent holds. For c1, c2, c3, and c5 it is the newest unrevoked record of its purpose; every unrevoked c4 record is active, one per accepted invitation. - superseded: the subject later accepted another text version of the same purpose and has not revoked either. The record stays as evidence for its own time; it never applies to c4. - revoked: the consent was revoked. The record keeps its grant and its one revocation time; a later grant is a new record and never reopens it. enum: - active - superseded - revoked ConsentSource: type: string description: |- Where the subject gave the consent. - registration: the c1 acceptance of RegisterAccount. - consent_settings: the consent settings of the account, for c1, c2, c3, and c5 (planned, TASK-063 and TASK-064). - invitation_acceptance: the c4 acceptance of AcceptMyInvitation. A c4 given when sending an application (PRD Q9) is planned as an additional value. enum: - registration - consent_settings - invitation_acceptance ConsentRevocationSource: type: string description: |- Who recorded a revocation. - consent_settings: the subject revoked the consent in the product. - support_request: an operator recorded a revocation that the subject requested through support. enum: - consent_settings - support_request ConsentOrganization: type: object description: >- Organization of a c4 consent as the consent recorded it. `name` is a snapshot of the name that the shown consent text carried at the time of the consent, and the stored text hash proves that text with this name; a later rename of the organization does not change it, so it can differ from the current name. additionalProperties: false required: - id - name properties: id: type: string format: uuid description: Identifier of the organization. name: type: string minLength: 1 maxLength: 200 description: >- Name of the organization in the consent text at the time of the consent. Plain text; clients show it as text, never as HTML. ConsentRecord: type: object description: >- One record of the consent ledger as its subject reads it: the purpose, the text version the subject accepted, where and when the consent was given, its state, and the revocation. A c4 record also names the organization, the contact fields, and the invitation with its terms version; these fields are null for every other purpose. The server also stores the SHA-256 hash of exactly the text the subject saw, which a client never sends or receives. additionalProperties: false required: - id - purpose - state - text_version - source - granted_at - revoked_at - revocation_source - organization - fields - invitation_id - invitation_terms_version properties: id: type: string format: uuid description: Identifier of the record. purpose: $ref: "#/schemas/ConsentPurposeCode" state: $ref: "#/schemas/ConsentState" text_version: description: Version of the consent text that the subject accepted. allOf: - $ref: "./identity_schemas.yml#/schemas/ConsentTextVersion" source: $ref: "#/schemas/ConsentSource" granted_at: $ref: "./common_schemas.yml#/schemas/Timestamp" revoked_at: description: Moment of the revocation, or null unless `state` is `revoked`. oneOf: - $ref: "./common_schemas.yml#/schemas/Timestamp" - type: "null" revocation_source: description: Who recorded the revocation, or null unless `state` is `revoked`. oneOf: - $ref: "#/schemas/ConsentRevocationSource" - type: "null" organization: description: >- Organization that a c4 consent allows to read the fields, with the name the consent text showed, or null for every other purpose. oneOf: - $ref: "#/schemas/ConsentOrganization" - type: "null" fields: type: - array - "null" minItems: 1 maxItems: 4 uniqueItems: true description: >- Contact fields that a c4 consent covers, or null for every other purpose. One kind never implies another. items: $ref: "./contact_grant_schemas.yml#/schemas/ContactFieldKind" invitation_id: type: - string - "null" format: uuid description: >- Invitation whose acceptance gave a c4 consent, or null for every other purpose. invitation_terms_version: description: >- Terms version that the acceptance accepted, or null for every other purpose. oneOf: - $ref: "./invitation_schemas.yml#/schemas/InvitationTermsVersion" - type: "null" ConsentRecordList: type: object description: >- One page of the consent ledger of the current account, newest grant first. additionalProperties: false required: - items - page properties: items: type: array maxItems: 100 description: Records of the page. items: $ref: "#/schemas/ConsentRecord" page: $ref: "./common_schemas.yml#/schemas/PageInfo"