trusted-contact.schema.json

{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://titip.id/schemas/trusted-contact.schema.json",
  "title": "TrustedContact",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "id",
    "user_id",
    "display_name",
    "channel",
    "status"
  ],
  "properties": {
    "id": {
      "type": "string",
      "pattern": "^tc_[a-zA-Z0-9]+$"
    },
    "user_id": {
      "type": "string",
      "pattern": "^usr_[a-zA-Z0-9]+$"
    },
    "display_name": {
      "type": "string",
      "minLength": 1,
      "maxLength": 80
    },
    "channel": {
      "enum": [
        "email",
        "sms",
        "push"
      ]
    },
    "email": {
      "type": "string",
      "format": "email"
    },
    "phone_e164": {
      "type": "string",
      "pattern": "^\\+[1-9][0-9]{7,14}$"
    },
    "status": {
      "enum": [
        "INVITED",
        "ACCEPTED",
        "REJECTED",
        "REMOVED"
      ]
    },
    "channel_verified": {
      "type": "boolean"
    }
  }
}