{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://raw.githubusercontent.com/api-evangelist/bodyspec/main/json-schema/bodyspec-intake-create-request-schema.json",
  "title": "IntakeCreateRequest",
  "description": "Request to create an intake for a user.",
  "x-generated": "2026-10-02",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/bodyspec-openapi.json#/components/schemas/IntakeCreateRequest",
  "properties": {
    "user": {
      "$ref": "#/$defs/IntakeUser",
      "description": "User information"
    },
    "qualifiers": {
      "$ref": "#/$defs/IntakeQualifiers",
      "description": "Qualification questions"
    },
    "disqualifiers": {
      "$ref": "#/$defs/IntakeDisqualifiers",
      "description": "Disqualification questions"
    },
    "addl_contact": {
      "anyOf": [
        {
          "$ref": "#/$defs/IntakeAdditionalContact"
        },
        {
          "type": "null"
        }
      ],
      "description": "Optional additional contact"
    }
  },
  "type": "object",
  "required": [
    "user",
    "qualifiers",
    "disqualifiers"
  ],
  "x-internal": true,
  "$defs": {
    "IntakeAdditionalContact": {
      "properties": {
        "name": {
          "type": "string",
          "minLength": 1,
          "title": "Name",
          "description": "Contact name"
        },
        "relationship": {
          "type": "string",
          "minLength": 1,
          "title": "Relationship",
          "description": "Relationship to user"
        },
        "email": {
          "type": "string",
          "format": "email",
          "title": "Email",
          "description": "Contact email"
        },
        "phone_number": {
          "type": "string",
          "title": "Phone Number",
          "description": "Contact phone number"
        }
      },
      "type": "object",
      "required": [
        "name",
        "relationship",
        "email",
        "phone_number"
      ],
      "title": "IntakeAdditionalContact",
      "description": "Optional additional contact information.",
      "x-internal": true
    },
    "IntakeDisqualifiers": {
      "properties": {
        "neg_q1_pregnant": {
          "type": "boolean",
          "title": "Neg Q1 Pregnant",
          "description": "Pregnant or possibly pregnant",
          "default": false
        },
        "neg_q2_barium_xray": {
          "type": "boolean",
          "title": "Neg Q2 Barium Xray",
          "description": "Barium X-ray in last 2 weeks",
          "default": false
        },
        "neg_q3_nuclear": {
          "type": "boolean",
          "title": "Neg Q3 Nuclear",
          "description": "Nuclear medicine test in last 2 weeks",
          "default": false
        }
      },
      "type": "object",
      "title": "IntakeDisqualifiers",
      "description": "Disqualifier questions - all must be false.",
      "x-internal": true
    },
    "IntakeQualifiers": {
      "properties": {
        "qual_q1_weight": {
          "type": "boolean",
          "title": "Qual Q1 Weight",
          "description": "Weight management qualification",
          "default": false
        },
        "qual_q2_body_fat": {
          "type": "boolean",
          "title": "Qual Q2 Body Fat",
          "description": "Body fat tracking qualification",
          "default": false
        },
        "qual_q3_athlete": {
          "type": "boolean",
          "title": "Qual Q3 Athlete",
          "description": "Athletic performance qualification",
          "default": false
        },
        "qual_q4_heart_disease": {
          "type": "boolean",
          "title": "Qual Q4 Heart Disease",
          "description": "Heart disease risk qualification",
          "default": false
        },
        "qual_q5_high_blood_pressure": {
          "type": "boolean",
          "title": "Qual Q5 High Blood Pressure",
          "description": "High blood pressure qualification",
          "default": false
        },
        "qual_q6_injuries": {
          "type": "boolean",
          "title": "Qual Q6 Injuries",
          "description": "Injury recovery qualification",
          "default": false
        },
        "qual_q7_research_study": {
          "type": "boolean",
          "title": "Qual Q7 Research Study",
          "description": "Research study qualification",
          "default": false
        }
      },
      "type": "object",
      "title": "IntakeQualifiers",
      "description": "Qualifier questions - at least one must be true.",
      "x-internal": true
    },
    "IntakeUser": {
      "properties": {
        "first_name": {
          "type": "string",
          "minLength": 1,
          "title": "First Name",
          "description": "User's first name"
        },
        "last_name": {
          "type": "string",
          "minLength": 1,
          "title": "Last Name",
          "description": "User's last name"
        },
        "email": {
          "type": "string",
          "format": "email",
          "title": "Email",
          "description": "User's email address"
        },
        "phone_number": {
          "type": "string",
          "title": "Phone Number",
          "description": "Phone number"
        },
        "birth_date": {
          "type": "string",
          "title": "Birth Date",
          "description": "Birth date in ISO format (YYYY-MM-DD)"
        },
        "gender": {
          "type": "string",
          "title": "Gender",
          "description": "Gender (Male, Female)"
        },
        "height_inches": {
          "type": "integer",
          "maximum": 96.0,
          "minimum": 30.0,
          "title": "Height Inches",
          "description": "Height in inches (30-96)"
        },
        "weight_pounds": {
          "type": "integer",
          "maximum": 600.0,
          "minimum": 30.0,
          "title": "Weight Pounds",
          "description": "Weight in pounds (30-600)"
        },
        "ethnicity": {
          "type": "string",
          "title": "Ethnicity",
          "description": "Ethnicity (Asian, Black, Hispanic, White, Other)"
        },
        "signature": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Signature",
          "description": "PNG signature image, max 500KB. Provide as raw base64 or data URL (data:image/png;base64,...)."
        }
      },
      "type": "object",
      "required": [
        "first_name",
        "last_name",
        "email",
        "phone_number",
        "birth_date",
        "gender",
        "height_inches",
        "weight_pounds",
        "ethnicity"
      ],
      "title": "IntakeUser",
      "description": "User information for intake.",
      "x-internal": true
    }
  }
}