{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/secondappraisal-com/json-schema/secondappraisal-com-plan-enrollment-schema.json",
  "title": "PlanEnrollment",
  "description": "A membership enrollment (snake_case). Ignore fields you don't know.",
  "x-generated": "2026-11-24",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/secondappraisal-com-openapi.json#/components/schemas/PlanEnrollment",
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "x-data-class": "institution_confidential"
    },
    "vin": {
      "type": "string",
      "x-data-class": "borrower_personal"
    },
    "status": {
      "type": "string",
      "enum": [
        "PENDING",
        "ACTIVE",
        "PAST_DUE",
        "LAPSED",
        "CANCELLED"
      ],
      "description": "PENDING (direct-collect, awaiting the member's activation), ACTIVE, PAST_DUE, LAPSED or CANCELLED. New values may be added: treat one you don't recognise as unknown, and don't fail.",
      "x-data-class": "public"
    },
    "billing_mode": {
      "type": "string",
      "enum": [
        "PARTNER_BILLED",
        "DIRECT_COLLECT"
      ],
      "description": "PARTNER_BILLED: you pay the wholesale price per vehicle-month and bill the member yourself. DIRECT_COLLECT: we charge the member's card your price and settle the difference with you monthly. New values may be added: treat one you don't recognise as unknown, and don't fail.",
      "x-data-class": "institution_confidential"
    },
    "external_ref": {
      "x-data-class": "institution_confidential",
      "type": [
        "string",
        "null"
      ]
    },
    "vehicle": {
      "type": "object",
      "properties": {
        "year": {
          "x-data-class": "borrower_personal",
          "type": [
            "integer",
            "null"
          ]
        },
        "make": {
          "x-data-class": "borrower_personal",
          "type": [
            "string",
            "null"
          ]
        },
        "model": {
          "x-data-class": "borrower_personal",
          "type": [
            "string",
            "null"
          ]
        },
        "garaged_state": {
          "x-data-class": "borrower_personal",
          "type": [
            "string",
            "null"
          ]
        }
      },
      "required": [
        "year",
        "make",
        "model",
        "garaged_state"
      ]
    },
    "member": {
      "type": "object",
      "properties": {
        "first_name": {
          "x-data-class": "borrower_personal",
          "type": [
            "string",
            "null"
          ]
        },
        "last_name": {
          "x-data-class": "borrower_personal",
          "type": [
            "string",
            "null"
          ]
        },
        "email": {
          "x-data-class": "borrower_contact",
          "x-requires-permission": "referrals.contact:read",
          "type": [
            "string",
            "null"
          ]
        }
      },
      "required": [
        "first_name",
        "last_name",
        "email"
      ]
    },
    "member_price_cents": {
      "type": "integer",
      "description": "0 for partner-billed rows.",
      "x-data-class": "institution_confidential"
    },
    "wholesale_cents": {
      "x-data-class": "institution_confidential",
      "type": [
        "integer",
        "null"
      ]
    },
    "started_at": {
      "anyOf": [
        {
          "type": "string",
          "format": "date-time"
        },
        {
          "type": "null"
        }
      ],
      "x-data-class": "institution_confidential"
    },
    "eligible_from": {
      "anyOf": [
        {
          "type": "string",
          "format": "date-time"
        },
        {
          "type": "null"
        }
      ],
      "description": "When this vehicle's membership started: at enrollment for partner-billed, at the member's activation for direct-collect, and at the change after a vehicle change. A total loss dated on or after that date (U.S. Eastern time) qualifies for the member consultation; one dated earlier doesn't. Null until the membership starts.",
      "x-data-class": "institution_confidential"
    },
    "current_period_end": {
      "anyOf": [
        {
          "type": "string",
          "format": "date-time"
        },
        {
          "type": "null"
        }
      ],
      "x-data-class": "institution_confidential"
    },
    "cancel_at_period_end": {
      "type": "boolean",
      "x-data-class": "institution_confidential"
    },
    "cancelled_at": {
      "anyOf": [
        {
          "type": "string",
          "format": "date-time"
        },
        {
          "type": "null"
        }
      ],
      "x-data-class": "institution_confidential"
    },
    "activation_url": {
      "description": "Direct-collect only, while PENDING: the co-branded page where the member activates. Anyone holding it can activate, so send it only to the member.",
      "x-data-class": "credential",
      "x-requires-permission": "members:activation-link",
      "type": [
        "string",
        "null"
      ]
    },
    "activation_expires_at": {
      "anyOf": [
        {
          "type": "string",
          "format": "date-time"
        },
        {
          "type": "null"
        }
      ],
      "x-data-class": "institution_confidential"
    },
    "test": {
      "type": "boolean",
      "description": "Created through a test key.",
      "x-data-class": "public"
    },
    "created_at": {
      "type": "string",
      "format": "date-time",
      "x-data-class": "institution_confidential"
    }
  },
  "required": [
    "id",
    "vin",
    "status",
    "billing_mode",
    "external_ref",
    "vehicle",
    "member",
    "member_price_cents",
    "wholesale_cents",
    "started_at",
    "eligible_from",
    "current_period_end",
    "cancel_at_period_end",
    "cancelled_at",
    "activation_url",
    "activation_expires_at",
    "test",
    "created_at"
  ]
}