{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/publiq/json-schema/publiq-association-membership-schema.json",
  "title": "AssociationMembership",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/publiq-associations-api-openapi.yml#/components/schemas/AssociationMembership",
  "x-stoplight": {
    "id": "mb1bs9upl614a"
  },
  "type": "object",
  "properties": {
    "association": {
      "$ref": "#/$defs/Association"
    },
    "status": {
      "type": "string",
      "x-stoplight": {
        "id": "kdp35yno8ebht"
      },
      "enum": [
        "ACTIVE",
        "EXPIRED",
        "NONE"
      ],
      "description": "Status of the membership. This field is always available in responses.",
      "readOnly": true
    },
    "endDate": {
      "type": "string",
      "x-stoplight": {
        "id": "eradjp82wpqv0"
      },
      "format": "date",
      "description": "End date of the membership. This field is available in responses if status is `ACTIVE` or `EXPIRED`. This field is required in requests for association with a `CUSTOM` endDateType."
    },
    "renewable": {
      "type": "boolean",
      "x-stoplight": {
        "id": "ahns1w7wy66mj"
      },
      "description": "True if this membership can currently be renewed. This fields is always available in responses.",
      "readOnly": true
    },
    "newEndDate": {
      "type": "string",
      "x-stoplight": {
        "id": "lxwcvxz2cbqrz"
      },
      "format": "date",
      "description": "New end date of the membership in case it is renewed or created. This field can be used to pre-fill the endDate field in a front-end UI. It is only available when: `endDateCalculation` of the association is `CUSTOM`, and the status is `NONE` (new membership) or `renewable` is true (renew membership).",
      "readOnly": true
    }
  },
  "required": [
    "association"
  ],
  "$defs": {
    "Association": {
      "title": "Association",
      "x-stoplight": {
        "id": "0cqmy2cuzwux0"
      },
      "type": "object",
      "description": "Association",
      "properties": {
        "id": {
          "type": "string",
          "description": "ID of the association"
        },
        "name": {
          "type": "string",
          "x-stoplight": {
            "id": "bl1hgz5y2wooc"
          },
          "description": "Name of the association. This field is always available in responses",
          "readOnly": true
        },
        "endDateType": {
          "type": "string",
          "x-stoplight": {
            "id": "siqftnrb8ax7e"
          },
          "description": "Indicates how end dates are set for memberships of this association. This field is always available in responses.",
          "enum": [
            "CUSTOM",
            "BASED_ON_DATE_OF_BIRTH",
            "BASED_ON_REGISTRATION_DATE"
          ],
          "readOnly": true
        }
      },
      "required": [
        "id"
      ]
    }
  }
}