{
  "openapi": "3.0.1",
  "info": {
    "title": "Wellness Management",
    "description": "This portion of the API provides endpoints for managing wellness plans and benefits. **Note:** These wellness endpoints are not recommended for new integrations. They remain fully supported, but are not suitable for all use cases and are expected to be superseded by an improved set of endpoints in a future release. Where possible, avoid building new functionality against them.",
    "version": "1.0"
  },
  "servers": [
    {
      "url": "https://api.ezyvet.com",
      "description": "ezyVet production environment"
    },
    {
      "url": "https://api.trial.ezyvet.com",
      "description": "ezyVet trial environment"
    }
  ],
  "security": [],
  "components": {
    "securitySchemes": {
      "bearerAuth": {
        "type": "oauth2",
        "flows": {
          "clientCredentials": {
            "tokenUrl": "https://api.ezyvet.com/v1/oauth/access_token",
            "scopes": {
              "read-wellnessplan": "Read wellness plan resources",
              "read-wellnessplanbenefit": "Read wellness plan benefit resources",
              "read-wellnessplanbenefititem": "Read wellness plan benefit item resources",
              "read-wellnessplanmembership": "Read wellness plan membership resources",
              "write-wellnessplan": "Create and update wellness plan resources",
              "write-wellnessplanmembership": "Create and update wellness plan membership resources"
            }
          }
        }
      }
    },
    "responses": {
      "BadRequest": {
        "description": "Bad Request",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/BadRequest"
            }
          }
        }
      },
      "InternalError": {
        "description": "Internal error",
        "content": {
          "application/json": {
            "schema": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "example": "error_5JBMuXC69QQoPpKDFoBow"
                },
                "status": {
                  "type": "string",
                  "example": "500"
                },
                "code": {
                  "type": "string",
                  "example": ""
                },
                "title": {
                  "type": "string",
                  "example": "An internal server error occurred"
                },
                "detail": {
                  "type": "string",
                  "example": "An error occured, please contact API support with the id, status and code provided with the response."
                }
              }
            }
          }
        }
      },
      "NotFound": {
        "description": "Not Found",
        "content": {
          "text/html": {
            "schema": {
              "type": "string",
              "example": "No input file specified."
            }
          }
        }
      },
      "TooManyRequests": {
        "description": "Too Many Requests",
        "content": {
          "application/json": {
            "schema": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "example": "error_5JBMuXC69QQoPpKDFoBow"
                },
                "status": {
                  "type": "string",
                  "example": "429"
                },
                "code": {
                  "type": "string",
                  "example": ""
                },
                "title": {
                  "type": "string",
                  "example": "Too Many Requests"
                },
                "detail": {
                  "type": "string",
                  "example": "Too Many Requests"
                }
              }
            }
          }
        }
      },
      "Unauthorized": {
        "description": "Unauthorized",
        "content": {
          "application/json": {
            "schema": {
              "type": "object",
              "properties": {
                "messages": {
                  "type": "array",
                  "items": {
                    "properties": {
                      "level": {
                        "type": "string",
                        "example": "error"
                      },
                      "type": {
                        "type": "string",
                        "example": "InvalidRequestException"
                      },
                      "text": {
                        "type": "string",
                        "example": "The request is missing a required parameter, includes an invalid parameter value, includes a parameter more than once, or is otherwise malformed. Check the \\\"access token\\\" parameter."
                      },
                      "fields": {
                        "type": "array",
                        "example": [],
                        "items": {
                          "type": "string"
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        }
      },
      "UnprocessableEntity": {
        "description": "Unprocessable Entity",
        "content": {
          "application/json": {
            "schema": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "example": "error_5JBMuXC69QQoPpKDFoBow"
                },
                "status": {
                  "type": "string",
                  "example": "422"
                },
                "code": {
                  "type": "string",
                  "example": ""
                },
                "title": {
                  "type": "string",
                  "example": "Unprocessable Entity"
                },
                "detail": {
                  "type": "string",
                  "example": "Unprocessable Entity"
                }
              }
            }
          }
        }
      }
    },
    "schemas": {
      "BadRequest": {
        "description": "Bad Request",
        "type": "object",
        "properties": {
          "errors": {
            "type": "array",
            "items": {
              "properties": {
                "id": {
                  "type": "string",
                  "example": "error_3YLvb0V7eXcHqgGauTjDy"
                },
                "status": {
                  "type": "string",
                  "example": "400"
                },
                "code": {
                  "type": "string",
                  "example": "100001"
                },
                "title": {
                  "type": "string",
                  "example": "The authorization grant type is not supported by the authorization server."
                },
                "detail": {
                  "type": "string",
                  "example": "The authorization grant type is not supported by the authorization server."
                }
              }
            }
          }
        }
      },
      "BenefitConfigv1": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "enum": [
              "percentage",
              "value"
            ]
          },
          "allocation": {
            "type": "string",
            "enum": [
              "unit",
              "line"
            ]
          },
          "type_value": {
            "type": "number"
          },
          "usages": {
            "type": "number"
          },
          "renewable": {
            "type": "boolean"
          },
          "option_cost_exc_tax": {
            "type": "number"
          },
          "refresh_cycle_quantity": {
            "type": "number"
          }
        },
        "required": [
          "type",
          "allocation",
          "type_value",
          "usages",
          "renewable",
          "option_cost_exc_tax",
          "refresh_cycle_quantity"
        ]
      },
      "Configv1": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "enum": [
              "percentage",
              "value"
            ]
          },
          "allocation": {
            "type": "string",
            "enum": [
              "unit",
              "line"
            ]
          },
          "renewable": {
            "type": "boolean"
          },
          "option_cost_exc_tax": {
            "type": "number"
          },
          "refresh_cycle_quantity": {
            "type": "number"
          }
        }
      },
      "CreateWellnessPlanBenefitResponsev1": {
        "type": "object",
        "properties": {
          "meta": {
            "type": "object",
            "properties": {
              "transaction_id": {
                "type": "string"
              },
              "timestamp": {
                "type": "number"
              }
            },
            "required": [
              "transaction_id",
              "timestamp"
            ]
          },
          "items": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "wellnessplanbenefit": {
                  "$ref": "#/components/schemas/WellnessPlanBenefitv1"
                }
              },
              "required": [
                "wellnessplanbenefit"
              ]
            }
          },
          "messages": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        },
        "required": [
          "meta",
          "items",
          "messages"
        ]
      },
      "DeleteResponsev1": {
        "type": "object",
        "properties": {
          "meta": {
            "type": "object",
            "properties": {
              "timestamp": {
                "type": "string"
              },
              "items_matched": {
                "type": "number"
              },
              "items_processed": {
                "type": "number"
              }
            }
          },
          "items": {
            "type": "array",
            "items": {}
          },
          "messages": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        }
      },
      "WellnessPlanBenefitv1": {
        "type": "object",
        "properties": {
          "id": {
            "type": "number"
          },
          "created_at": {
            "type": "number"
          },
          "modified_at": {
            "type": "number"
          },
          "active": {
            "type": "boolean",
            "default": true
          },
          "name": {
            "type": "string"
          },
          "earn_method": {
            "type": "string",
            "enum": [
              "default",
              "percent",
              "value"
            ]
          },
          "earn_amount": {
            "type": "number"
          },
          "optional": {
            "type": "boolean"
          },
          "benefit_type": {
            "type": "string",
            "enum": [
              "percentage",
              "value"
            ]
          },
          "benefit_config": {
            "$ref": "#/components/schemas/Configv1"
          },
          "wellnessplan_id": {
            "type": "number"
          }
        }
      }
    }
  },
  "paths": {
    "/v2/wellnessplan": {
      "post": {
        "summary": "Creates a single Wellness Plan",
        "description": "Creates a new Wellness Plan with the specified details.",
        "operationId": "create-wellnessplan",
        "tags": [
          "Wellness Plan"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "description": "The name of the Wellness Plan."
                  },
                  "subscription_cycle_unit": {
                    "type": "string",
                    "enum": [
                      "year",
                      "month",
                      "week",
                      "day"
                    ],
                    "default": "month",
                    "description": "The unit for the period of time the Wellness Plan runs and how often the clients are billed."
                  },
                  "subscription_cycle_qty": {
                    "type": "number",
                    "default": 1,
                    "description": "The quantity of units for the period of time the Wellness Plan runs and how often the clients are billed."
                  },
                  "subscription_fee_product": {
                    "type": "number",
                    "description": "The Product ID that is charged each cycle of the subscription_fee_product subscription."
                  },
                  "fixed_subscription_price": {
                    "type": "number",
                    "nullable": true,
                    "description": "The override price of the subscription if this value is null, the Wellness Plan will use the price of the subscription_fee_product Product."
                  },
                  "min_cycle_qty_on_signup": {
                    "type": "number",
                    "default": 3,
                    "description": "The amount of subscription cycles that must be paid in advance."
                  },
                  "term_qty": {
                    "type": "number",
                    "default": 12,
                    "description": "The term length of the Wellness Plan."
                  },
                  "pause_limit_qty": {
                    "type": "number",
                    "default": 6,
                    "description": "The amount of cycles that a Wellness Plan can be paused for."
                  },
                  "extends_end_date": {
                    "type": "boolean",
                    "default": true,
                    "description": "Whether pausing a Wellness Plan extends the plan's end date for the amount paused."
                  },
                  "portion_revenue_payable": {
                    "oneOf": [
                      {
                        "type": "string"
                      },
                      {
                        "type": "number"
                      }
                    ],
                    "default": 0.2,
                    "description": "The percentage of the Wellness Plan Benefits discounting that will be recorded as earnings."
                  },
                  "enrollment_fee_product": {
                    "type": "number",
                    "nullable": true,
                    "description": "The ID of a Product that is a fixed charge for enrollment to a wellness plan."
                  },
                  "replacement_wellness_plan": {
                    "type": "number",
                    "nullable": true,
                    "description": "The ID of the Wellness Plan that will replace the current plan once completed."
                  },
                  "cancellation_product": {
                    "type": "number",
                    "description": "The ID of the Product that is charged when the Wellness Plan is cancelled."
                  },
                  "default_renew": {
                    "type": "boolean",
                    "description": "If true, the Wellness Plan will renew by default."
                  },
                  "renewal_fee_product": {
                    "type": "number",
                    "nullable": true,
                    "description": "The ID of the Product that is charge when the Wellness Plan is renewed."
                  },
                  "ownership_id": {
                    "type": "number",
                    "description": "The ID of the ownership Separation to which this Wellness Plan belongs."
                  }
                },
                "required": [
                  "name",
                  "subscription_fee_product",
                  "min_cycle_qty_on_signup",
                  "cancellation_product"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "A successful response with the created Wellness Plan.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "meta": {
                      "type": "object",
                      "properties": {
                        "transaction_id": {
                          "type": "string"
                        },
                        "timestamp": {
                          "type": "number"
                        }
                      }
                    },
                    "items": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "wellnessplan": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "number"
                              },
                              "created_at": {
                                "type": "number"
                              },
                              "modified_at": {
                                "type": "number"
                              },
                              "active": {
                                "type": "boolean",
                                "default": true
                              },
                              "name": {
                                "type": "string"
                              },
                              "subscription_cycle_unit": {
                                "type": "string",
                                "enum": [
                                  "year",
                                  "month",
                                  "week",
                                  "day"
                                ],
                                "default": "month"
                              },
                              "subscription_cycle_qty": {
                                "type": "number",
                                "default": 1
                              },
                              "subscription_fee_product": {
                                "type": "number"
                              },
                              "fixed_subscription_price": {
                                "type": "number",
                                "nullable": true
                              },
                              "min_cycle_qty_on_signup": {
                                "type": "number"
                              },
                              "term_qty": {
                                "type": "number",
                                "default": 12
                              },
                              "pause_limit_qty": {
                                "type": "number",
                                "default": 6
                              },
                              "extends_end_date": {
                                "type": "boolean",
                                "default": true
                              },
                              "portion_revenue_payable": {
                                "oneOf": [
                                  {
                                    "type": "string"
                                  },
                                  {
                                    "type": "number"
                                  }
                                ],
                                "default": 0.2
                              },
                              "enrollment_fee_product": {
                                "type": "number",
                                "nullable": true
                              },
                              "replacement_wellness_plan": {
                                "type": "number",
                                "nullable": true
                              },
                              "discontinued": {
                                "type": "boolean",
                                "default": false
                              },
                              "cancellation_product": {
                                "type": "number"
                              },
                              "default_renew": {
                                "type": "boolean"
                              },
                              "renewal_fee_product": {
                                "type": "number",
                                "nullable": true
                              },
                              "ownership_id": {
                                "type": "number"
                              }
                            }
                          }
                        }
                      }
                    },
                    "messages": {
                      "type": "array",
                      "items": {}
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "422": {
            "$ref": "#/components/responses/UnprocessableEntity"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        },
        "security": [
          {
            "bearerAuth": [
              "write-wellnessplan"
            ]
          }
        ]
      },
      "get": {
        "summary": "Fetches a list of Wellness Plans",
        "operationId": "get-wellnessplan",
        "security": [
          {
            "bearerAuth": [
              "read-wellnessplan"
            ]
          }
        ],
        "tags": [
          "Wellness Plan"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "query",
            "schema": {
              "type": "number"
            },
            "description": "The ID number used by the system to uniquely identify a Wellness Plan."
          },
          {
            "name": "created_at",
            "in": "query",
            "schema": {
              "type": "number"
            },
            "description": "The epoch time when the Wellness Plan was created."
          },
          {
            "name": "modified_at",
            "in": "query",
            "schema": {
              "type": "number"
            },
            "description": "The epoch time when the Wellness Plan was last modified."
          },
          {
            "name": "active",
            "in": "query",
            "schema": {
              "type": "boolean"
            },
            "description": "If true, the Wellness Plan is active and usable in ezyVet."
          },
          {
            "name": "name",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "The name of the Wellness Plan."
          }
        ],
        "responses": {
          "200": {
            "description": "A list of Wellness Plans",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "meta": {
                      "type": "object",
                      "properties": {
                        "items_page": {
                          "type": "number"
                        },
                        "items_page_total": {
                          "type": "number"
                        },
                        "items_page_size": {
                          "type": "number"
                        },
                        "items_total": {
                          "type": "number"
                        },
                        "transaction_id": {
                          "type": "string"
                        },
                        "timestamp": {
                          "type": "number"
                        }
                      }
                    },
                    "items": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "wellnessplan": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "number"
                              },
                              "created_at": {
                                "type": "number"
                              },
                              "modified_at": {
                                "type": "number"
                              },
                              "active": {
                                "type": "boolean"
                              },
                              "name": {
                                "type": "string"
                              },
                              "subscription_cycle_unit": {
                                "type": "string",
                                "enum": [
                                  "year",
                                  "month",
                                  "week",
                                  "day"
                                ]
                              },
                              "subscription_cycle_qty": {
                                "type": "number"
                              },
                              "subscription_fee_product": {
                                "type": "number"
                              },
                              "fixed_subscription_price": {
                                "type": "number",
                                "nullable": true
                              },
                              "min_cycle_qty_on_signup": {
                                "type": "number"
                              },
                              "term_qty": {
                                "type": "number"
                              },
                              "pause_limit_qty": {
                                "type": "number"
                              },
                              "extends_end_date": {
                                "type": "boolean"
                              },
                              "portion_revenue_payable": {
                                "type": "string"
                              },
                              "enrollment_fee_product": {
                                "type": "number",
                                "nullable": true
                              },
                              "replacement_wellness_plan": {
                                "type": "number",
                                "nullable": true
                              },
                              "discontinued": {
                                "type": "boolean"
                              },
                              "cancellation_product": {
                                "type": "number"
                              },
                              "default_renew": {
                                "type": "boolean"
                              },
                              "renewal_fee_product": {
                                "type": "number",
                                "nullable": true
                              },
                              "ownership_id": {
                                "type": "number"
                              }
                            }
                          }
                        }
                      }
                    },
                    "messages": {
                      "type": "array",
                      "items": {}
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "422": {
            "$ref": "#/components/responses/UnprocessableEntity"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/v2/wellnessplan/{id}": {
      "patch": {
        "summary": "Updates a single Wellness Plan",
        "operationId": "update-wellnessplan",
        "tags": [
          "Wellness Plan"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "The ID of the Wellness Plan to update",
            "schema": {
              "type": "number"
            }
          },
          {
            "name": "authorization",
            "in": "header",
            "required": true,
            "description": "Bearer token for authorization",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string"
                  },
                  "subscription_cycle_unit": {
                    "type": "string",
                    "enum": [
                      "year",
                      "month",
                      "week",
                      "day"
                    ]
                  },
                  "subscription_cycle_qty": {
                    "type": "number"
                  },
                  "subscription_fee_product": {
                    "type": "number"
                  },
                  "fixed_subscription_price": {
                    "type": "number"
                  },
                  "min_cycle_qty_on_signup": {
                    "type": "number"
                  },
                  "term_qty": {
                    "type": "number"
                  },
                  "pause_limit_qty": {
                    "type": "number"
                  },
                  "portion_revenue_payable": {
                    "type": "string"
                  },
                  "enrollment_fee_product": {
                    "type": "number"
                  },
                  "replacement_wellness_plan": {
                    "type": "number"
                  },
                  "discontinued": {
                    "type": "boolean"
                  },
                  "cancellation_product": {
                    "type": "number"
                  },
                  "default_renew": {
                    "type": "boolean"
                  },
                  "renewal_fee_product": {
                    "type": "number"
                  },
                  "ownership_id": {
                    "type": "number"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful update",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "meta": {
                      "type": "object",
                      "properties": {
                        "items_processed": {
                          "type": "number"
                        },
                        "transaction_id": {
                          "type": "string"
                        },
                        "timestamp": {
                          "type": "number"
                        }
                      }
                    },
                    "items": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "wellnessplan": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "number"
                              },
                              "created_at": {
                                "type": "number"
                              },
                              "modified_at": {
                                "type": "number"
                              },
                              "active": {
                                "type": "boolean"
                              },
                              "name": {
                                "type": "string"
                              },
                              "subscription_cycle_unit": {
                                "type": "string",
                                "enum": [
                                  "year",
                                  "month",
                                  "week",
                                  "day"
                                ]
                              },
                              "subscription_cycle_qty": {
                                "type": "number"
                              },
                              "subscription_fee_product": {
                                "type": "number"
                              },
                              "fixed_subscription_price": {
                                "type": "number"
                              },
                              "min_cycle_qty_on_signup": {
                                "type": "number"
                              },
                              "term_qty": {
                                "type": "number"
                              },
                              "pause_limit_qty": {
                                "type": "number"
                              },
                              "extends_end_date": {
                                "type": "boolean"
                              },
                              "portion_revenue_payable": {
                                "anyOf": [
                                  {
                                    "type": "string"
                                  },
                                  {
                                    "type": "number"
                                  }
                                ]
                              },
                              "enrollment_fee_product": {
                                "type": "number"
                              },
                              "replacement_wellness_plan": {
                                "type": "number"
                              },
                              "discontinued": {
                                "type": "boolean"
                              },
                              "cancellation_product": {
                                "type": "number"
                              },
                              "default_renew": {
                                "type": "boolean"
                              },
                              "renewal_fee_product": {
                                "type": "number"
                              },
                              "ownership_id": {
                                "type": "number"
                              }
                            }
                          }
                        }
                      }
                    },
                    "messages": {
                      "type": "array",
                      "items": {
                        "type": "object"
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "422": {
            "$ref": "#/components/responses/UnprocessableEntity"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        },
        "security": [
          {
            "bearerAuth": [
              "write-wellnessplan"
            ]
          }
        ]
      },
      "delete": {
        "summary": "Deletes a Wellness Plan",
        "operationId": "delete-wellnessplan",
        "tags": [
          "Wellness Plan"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "description": "The ID of the Wellness Plan to delete",
            "required": true,
            "schema": {
              "type": "number"
            }
          }
        ],
        "security": [
          {
            "bearerAuth": [
              "write-wellnessplan"
            ]
          }
        ],
        "responses": {
          "200": {
            "description": "Wellness Plan deleted successfully",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DeleteResponsev1"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "422": {
            "$ref": "#/components/responses/UnprocessableEntity"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "default": {
            "description": "An unexpected error occurred",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/v2/wellnessplanbenefit": {
      "get": {
        "summary": "Fetch Wellness Plan Benefit",
        "operationId": "get-wellnessplanbenefit",
        "security": [
          {
            "bearerAuth": [
              "read-wellnessplanbenefit"
            ]
          }
        ],
        "tags": [
          "Wellness Plan Benefit"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "query",
            "description": "The ID number used by the system to uniquely identify a Wellness Plan Benefit.",
            "schema": {
              "type": "number"
            }
          },
          {
            "name": "created_at",
            "in": "query",
            "description": "The epoch time when the Wellness Plan Benefit was created.",
            "schema": {
              "type": "number"
            }
          },
          {
            "name": "modified_at",
            "in": "query",
            "description": "The epoch time when the Wellness Plan Benefit was last modified.",
            "schema": {
              "type": "number"
            }
          },
          {
            "name": "active",
            "in": "query",
            "description": "If true, the Wellness Plan Benefit is active and usable in ezyVet.",
            "schema": {
              "type": "boolean"
            }
          },
          {
            "name": "wellnessplan_id",
            "in": "query",
            "description": "The ID of the Wellness Plan that the Wellness Plan Benefit is associated with.",
            "schema": {
              "type": "number"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "A list containing Wellness Plan Benefits.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "meta": {
                      "type": "object",
                      "properties": {
                        "items_page": {
                          "type": "number"
                        },
                        "items_page_total": {
                          "type": "number"
                        },
                        "items_page_size": {
                          "type": "number"
                        },
                        "items_total": {
                          "type": "number"
                        },
                        "transaction_id": {
                          "type": "string"
                        },
                        "timestamp": {
                          "type": "number"
                        }
                      }
                    },
                    "items": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "wellnessplanbenefit": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "number"
                              },
                              "created_at": {
                                "type": "number"
                              },
                              "modified_at": {
                                "type": "number"
                              },
                              "active": {
                                "type": "boolean"
                              },
                              "name": {
                                "type": "string"
                              },
                              "earn_method": {
                                "type": "string",
                                "enum": [
                                  "default",
                                  "percent",
                                  "value"
                                ]
                              },
                              "earn_amount": {
                                "type": "number",
                                "nullable": true
                              },
                              "optional": {
                                "type": "boolean"
                              },
                              "benefit_type": {
                                "type": "string",
                                "enum": [
                                  "percentage",
                                  "value"
                                ]
                              },
                              "benefit_config": {
                                "type": "object",
                                "properties": {
                                  "type": {
                                    "type": "string",
                                    "enum": [
                                      "percentage",
                                      "value"
                                    ]
                                  },
                                  "allocation": {
                                    "type": "string",
                                    "enum": [
                                      "unit",
                                      "line"
                                    ]
                                  },
                                  "type_value": {
                                    "type": "number"
                                  },
                                  "usages": {
                                    "type": "number"
                                  },
                                  "renewable": {
                                    "type": "boolean"
                                  },
                                  "option_cost_exc_tax": {
                                    "type": "number"
                                  },
                                  "refresh_cycle_quantity": {
                                    "type": "number"
                                  }
                                }
                              },
                              "wellnessplan_id": {
                                "type": "number"
                              }
                            }
                          }
                        }
                      }
                    },
                    "messages": {
                      "type": "array",
                      "items": {
                        "type": "object"
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "422": {
            "$ref": "#/components/responses/UnprocessableEntity"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      },
      "post": {
        "summary": "Creates a single Wellness Plan Benefit",
        "operationId": "create-wellnessplanbenefit",
        "tags": [
          "Wellness Plan Benefit"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string"
                  },
                  "earn_amount": {
                    "type": "number"
                  },
                  "earn_method": {
                    "type": "string",
                    "enum": [
                      "default",
                      "percent",
                      "value"
                    ]
                  },
                  "optional": {
                    "type": "boolean"
                  },
                  "benefit_type": {
                    "type": "string",
                    "enum": [
                      "percentage",
                      "value"
                    ]
                  },
                  "benefit_config": {
                    "$ref": "#/components/schemas/BenefitConfigv1"
                  },
                  "wellnessplan_id": {
                    "type": "number"
                  }
                },
                "required": [
                  "earn_method",
                  "earn_amount",
                  "optional",
                  "benefit_config",
                  "wellnessplan_id"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "A successful response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CreateWellnessPlanBenefitResponsev1"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "422": {
            "$ref": "#/components/responses/UnprocessableEntity"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        },
        "security": [
          {
            "bearerAuth": [
              "write-wellnessplanbenefit"
            ]
          }
        ]
      }
    },
    "/v2/wellnessplanbenefit/{id}": {
      "patch": {
        "summary": "Update a Wellness Plan Benefit",
        "operationId": "update-wellnessplanbenefit",
        "tags": [
          "Wellness Plan Benefit"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "description": "The ID of the Wellness Plan Benefit to update",
            "required": true,
            "schema": {
              "type": "number"
            }
          },
          {
            "name": "active",
            "in": "query",
            "description": "If true, the Wellness Plan Benefit is active and usable in ezyVet.",
            "schema": {
              "type": "boolean",
              "default": true
            }
          },
          {
            "name": "earn_method",
            "in": "query",
            "description": "This value can be 'default', 'percent' or 'value'. If the value is 'default' it means this benefit will use the associated Wellness Plan's portion_revenue_payable percentage value.",
            "schema": {
              "type": "string",
              "enum": [
                "default",
                "percent",
                "value"
              ]
            }
          },
          {
            "name": "earn_amount",
            "in": "query",
            "description": "Defines the value of the benefit items discount is recorded as earnings.",
            "schema": {
              "type": "number"
            }
          },
          {
            "name": "optional",
            "in": "query",
            "description": "If true, The client can choose to opt in or out at the time of signing up.",
            "schema": {
              "type": "boolean"
            }
          },
          {
            "name": "benefit_config",
            "in": "query",
            "description": "This object defines how the Wellness Plan Benefit behaves.",
            "schema": {
              "$ref": "#/components/schemas/Configv1"
            }
          },
          {
            "name": "wellnessplan_id",
            "in": "query",
            "description": "The ID of the a Wellness Plan the Wellness Plan Benefit is associated with.",
            "schema": {
              "type": "number"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string"
                  },
                  "benefit_config": {
                    "$ref": "#/components/schemas/Configv1"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "meta": {
                      "type": "object",
                      "properties": {
                        "items_processed": {
                          "type": "number"
                        },
                        "transaction_id": {
                          "type": "string"
                        },
                        "timestamp": {
                          "type": "number"
                        }
                      }
                    },
                    "items": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "wellnessplanbenefit": {
                            "$ref": "#/components/schemas/WellnessPlanBenefitv1"
                          }
                        }
                      }
                    },
                    "messages": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "422": {
            "$ref": "#/components/responses/UnprocessableEntity"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        },
        "security": [
          {
            "bearerAuth": [
              "write-wellnessplan"
            ]
          }
        ]
      }
    },
    "/v2/wellnessplanbenefititem": {
      "get": {
        "summary": "Fetches a list of Wellness Plan Benefit Items",
        "operationId": "get-wellnessplanbenefititem",
        "tags": [
          "Wellness Plan Benefit Item"
        ],
        "parameters": [
          {
            "name": "wellness_plan_benefit",
            "in": "query",
            "description": "The ID of the Wellness Plan Benefit the Wellness Plan Benefit Item is associated with.",
            "required": true,
            "schema": {
              "type": "number"
            }
          },
          {
            "name": "id",
            "in": "query",
            "description": "The ID number used by the system to uniquely identify a Wellness Plan Benefit Item.",
            "required": false,
            "schema": {
              "type": "number"
            }
          },
          {
            "name": "created_at",
            "in": "query",
            "description": "The epoch time when the Wellness Plan Benefit Item was created.",
            "required": false,
            "schema": {
              "type": "number"
            }
          },
          {
            "name": "modified_at",
            "in": "query",
            "description": "The epoch time when the Wellness Plan Benefit Item was last modified.",
            "required": false,
            "schema": {
              "type": "number"
            }
          },
          {
            "name": "active",
            "in": "query",
            "description": "If true, the Wellness Plan Benefit Item is active and usable in ezyVet.",
            "required": false,
            "schema": {
              "type": "boolean"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "A list of Wellness Plan Benefit Items",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "meta": {
                      "type": "object",
                      "properties": {
                        "timestamp": {
                          "type": "number"
                        },
                        "items_page": {
                          "type": "number"
                        },
                        "items_page_total": {
                          "type": "number"
                        },
                        "items_page_size": {
                          "type": "number"
                        },
                        "items_total": {
                          "type": "number"
                        }
                      }
                    },
                    "items": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "wellnessplanbenefititem": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "number"
                              },
                              "created_at": {
                                "type": "number"
                              },
                              "modified_at": {
                                "type": "number"
                              },
                              "active": {
                                "type": "boolean"
                              },
                              "wellness_plan_benefit": {
                                "type": "number"
                              },
                              "associated_type": {
                                "type": "string",
                                "enum": [
                                  "Product",
                                  "TagName"
                                ]
                              },
                              "associated_id": {
                                "type": "number"
                              },
                              "earn_method": {
                                "type": "string",
                                "enum": [
                                  "Percent",
                                  "Value"
                                ]
                              },
                              "earn_amount": {
                                "type": "number"
                              },
                              "consumption_rate": {
                                "type": "number"
                              },
                              "consumption_rate_fixed": {
                                "type": "boolean"
                              }
                            }
                          }
                        }
                      }
                    },
                    "messages": {
                      "type": "array",
                      "items": {
                        "type": "object"
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "422": {
            "$ref": "#/components/responses/UnprocessableEntity"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        },
        "security": [
          {
            "bearerAuth": [
              "read-wellnessplanbenefititem"
            ]
          }
        ]
      }
    },
    "/v2/wellnessplanmembership": {
      "patch": {
        "summary": "Update Wellness Plan Membership",
        "operationId": "update-wellnessplanmembership",
        "tags": [
          "Wellness Plan Membership"
        ],
        "description": "Updates Wellness Plan Membership related to an animal",
        "security": [
          {
            "bearerAuth": [
              "write-wellnessplanmembership"
            ]
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "number"
                  },
                  "status": {
                    "type": "string",
                    "enum": [
                      "Active",
                      "Paused",
                      "Cancelled"
                    ]
                  },
                  "cancellation_option": {
                    "type": "string",
                    "enum": [
                      "savings_only",
                      "remaining",
                      "custom"
                    ]
                  },
                  "cancellation_fee": {
                    "type": "number"
                  },
                  "pause_length": {
                    "type": "number"
                  },
                  "next_wellness_plan": {
                    "type": "number"
                  },
                  "renew_when_expired": {
                    "type": "boolean"
                  },
                  "reference": {
                    "type": "string",
                    "nullable": true,
                    "maxLength": 50
                  }
                },
                "required": [
                  "id",
                  "status"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful update",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "meta": {
                      "type": "object",
                      "properties": {
                        "items_processed": {
                          "type": "number"
                        },
                        "transaction_id": {
                          "type": "string"
                        },
                        "timestamp": {
                          "type": "number"
                        }
                      }
                    },
                    "items": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "wellnessplanmembership": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "number"
                              },
                              "created_at": {
                                "type": "number"
                              },
                              "modified_at": {
                                "type": "number"
                              },
                              "active": {
                                "type": "boolean"
                              },
                              "wellness_plan": {
                                "type": "number"
                              },
                              "animal_id": {
                                "type": "number"
                              },
                              "renew_when_expired": {
                                "type": "boolean"
                              },
                              "start_date": {
                                "type": "number"
                              },
                              "end_date": {
                                "type": "number"
                              },
                              "status": {
                                "type": "string",
                                "nullable": true
                              },
                              "billing_interval": {
                                "type": "number"
                              },
                              "resource_id": {
                                "type": "number"
                              },
                              "previous_wellness_plan_membership": {
                                "type": "number",
                                "nullable": true
                              },
                              "next_wellness_plan": {
                                "type": "number",
                                "nullable": true
                              },
                              "reference": {
                                "type": "string",
                                "nullable": true,
                                "maxLength": 50
                              },
                              "ownership_id": {
                                "type": "number"
                              }
                            }
                          }
                        }
                      }
                    },
                    "messages": {
                      "type": "array",
                      "items": {}
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "422": {
            "$ref": "#/components/responses/UnprocessableEntity"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      },
      "get": {
        "summary": "Fetches a list containing Wellness Plan Memberships",
        "operationId": "get-wellnessplanmembership",
        "security": [
          {
            "bearerAuth": [
              "read-wellnessplanmembership"
            ]
          }
        ],
        "tags": [
          "Wellness Plan Membership"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "query",
            "description": "The ID number used by the system to uniquely identify a Wellness Plan Membership.",
            "schema": {
              "type": "number"
            }
          },
          {
            "name": "created_at",
            "in": "query",
            "description": "The epoch time when the Wellness Plan Membership was created.",
            "schema": {
              "type": "number"
            }
          },
          {
            "name": "modified_at",
            "in": "query",
            "description": "The epoch time when the Wellness Plan Membership was last modified.",
            "schema": {
              "type": "number"
            }
          },
          {
            "name": "active",
            "in": "query",
            "description": "If true, the Wellness Plan Membership is active and usable in ezyVet.",
            "schema": {
              "type": "boolean"
            }
          },
          {
            "name": "wellness_plan",
            "in": "query",
            "description": "The ID of the Wellness Plan this Wellness Plan Membership is associated with.",
            "schema": {
              "type": "number"
            }
          },
          {
            "name": "animal_id",
            "in": "query",
            "description": "The ID of the Animal that is enrolled to this Wellness Plan Membership.",
            "schema": {
              "type": "number"
            }
          },
          {
            "name": "resource_id",
            "in": "query",
            "description": "The ID of the Resource that enrolled the Animal into this Wellness Plan Membership.",
            "schema": {
              "type": "number"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "A list of Wellness Plan Memberships",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "meta": {
                      "type": "object",
                      "properties": {
                        "items_page": {
                          "type": "number"
                        },
                        "items_page_total": {
                          "type": "number"
                        },
                        "items_page_size": {
                          "type": "number"
                        },
                        "items_total": {
                          "type": "number"
                        },
                        "transaction_id": {
                          "type": "string"
                        },
                        "timestamp": {
                          "type": "number"
                        }
                      }
                    },
                    "items": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "wellnessplanmembership": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "number"
                              },
                              "created_at": {
                                "type": "number"
                              },
                              "modified_at": {
                                "type": "number"
                              },
                              "active": {
                                "type": "boolean"
                              },
                              "wellness_plan": {
                                "type": "number"
                              },
                              "animal_id": {
                                "type": "number"
                              },
                              "renew_when_expired": {
                                "type": "boolean"
                              },
                              "start_date": {
                                "type": "number"
                              },
                              "end_date": {
                                "type": "number"
                              },
                              "status": {
                                "type": "string",
                                "nullable": true
                              },
                              "billing_interval": {
                                "type": "number"
                              },
                              "resource_id": {
                                "type": "number"
                              },
                              "previous_wellness_plan_membership": {
                                "type": "number",
                                "nullable": true
                              },
                              "next_wellness_plan": {
                                "type": "number",
                                "nullable": true
                              },
                              "reference": {
                                "type": "string",
                                "maxLength": 50,
                                "nullable": true
                              },
                              "ownership_id": {
                                "type": "number"
                              }
                            }
                          }
                        }
                      }
                    },
                    "messages": {
                      "type": "array",
                      "items": {
                        "type": "object"
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "422": {
            "$ref": "#/components/responses/UnprocessableEntity"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      },
      "post": {
        "summary": "Create New Wellness Plan Membership",
        "operationId": "create-wellnessplanmembership",
        "tags": [
          "Wellness Plan Membership"
        ],
        "description": "Adds a new Wellness Plan Membership to an animal",
        "security": [
          {
            "bearerAuth": [
              "write-wellnessplanmembership"
            ]
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "start_date": {
                    "type": "number",
                    "description": "The date that the new Wellness Plan Membership will take effect"
                  },
                  "animal_id": {
                    "type": "number",
                    "description": "The animal that this Wellness Membership is for. Needs to be a valid, active animal"
                  },
                  "renew_when_expired": {
                    "type": "string",
                    "description": "Should the plan automatically renew when it expires? 1 - true, 0 - false"
                  },
                  "billing_interval": {
                    "type": "number",
                    "description": "Needs to be a valid billing cycle as set up on the Wellness Plan configuration."
                  },
                  "wellness_plan": {
                    "type": "number",
                    "description": "The id of the Wellness Plan for this membership. Needs to be a valid, active Wellness Plan."
                  },
                  "resource_id": {
                    "type": "number",
                    "description": "The ID of the sales Resource that is enrolling the Animal into this Wellness Plan Membership."
                  },
                  "next_wellness_plan": {
                    "type": "number",
                    "nullable": true,
                    "description": "Set the default plan to be assigned when this plan expires. If present, needs to be active and valid."
                  },
                  "reference": {
                    "type": "string",
                    "nullable": true,
                    "maxLength": 50,
                    "description": "Free Text Max: 50 characters"
                  },
                  "ownership_id": {
                    "type": "number",
                    "description": "The ID of the ownership Separation to which this Wellness Plan Membership belongs."
                  }
                },
                "required": [
                  "start_date",
                  "animal_id",
                  "renew_when_expired",
                  "billing_interval",
                  "wellness_plan",
                  "resource_id",
                  "ownership_id"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "meta": {
                      "type": "object",
                      "properties": {
                        "transaction_id": {
                          "type": "string"
                        },
                        "timestamp": {
                          "type": "number"
                        }
                      }
                    },
                    "items": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "wellnessplanmembership": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "number"
                              },
                              "created_at": {
                                "type": "number"
                              },
                              "modified_at": {
                                "type": "number"
                              },
                              "active": {
                                "type": "boolean"
                              },
                              "wellness_plan": {
                                "type": "number"
                              },
                              "animal_id": {
                                "type": "number"
                              },
                              "renew_when_expired": {
                                "type": "boolean"
                              },
                              "start_date": {
                                "type": "number"
                              },
                              "end_date": {
                                "type": "number"
                              },
                              "status": {
                                "type": "string",
                                "nullable": true
                              },
                              "billing_interval": {
                                "type": "number"
                              },
                              "resource_id": {
                                "type": "number"
                              },
                              "previous_wellness_plan_membership": {
                                "type": "number",
                                "nullable": true
                              },
                              "next_wellness_plan": {
                                "type": "number"
                              },
                              "reference": {
                                "type": "string",
                                "nullable": true,
                                "maxLength": 50
                              },
                              "ownership_id": {
                                "type": "number"
                              }
                            }
                          }
                        }
                      }
                    },
                    "messages": {
                      "type": "array",
                      "items": {}
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "422": {
            "$ref": "#/components/responses/UnprocessableEntity"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    }
  }
}
