diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 86b0e83d..cb9d2541 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "0.21.0" + ".": "0.22.0" } \ No newline at end of file diff --git a/.stats.yml b/.stats.yml index 147f6727..eeba5cf5 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,2 +1,2 @@ configured_endpoints: 101 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/orb%2Forb-ac2f736602bc631b92de358a7edb395cf53ed506b2cb3d0494fffa31be9e2d9f.yml +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/orb%2Forb-11f40c15fa889d9752019e8a35b82d2e7a3d42f2b42c850b469f120a5b2c47ba.yml diff --git a/CHANGELOG.md b/CHANGELOG.md index 44d2269c..bb276426 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +## 0.22.0 (2025-01-16) + +Full Changelog: [v0.21.0...v0.22.0](https://github.com/orbcorp/orb-java/compare/v0.21.0...v0.22.0) + +### Features + +* **api:** api update ([#200](https://github.com/orbcorp/orb-java/issues/200)) ([ff9385c](https://github.com/orbcorp/orb-java/commit/ff9385c4d792990f4f482911b6f86e70b62b1bed)) + ## 0.21.0 (2025-01-15) Full Changelog: [v0.20.0...v0.21.0](https://github.com/orbcorp/orb-java/compare/v0.20.0...v0.21.0) diff --git a/README.md b/README.md index 5246bf68..25496d02 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ -[![Maven Central](https://img.shields.io/maven-central/v/com.withorb.api/orb-java)](https://central.sonatype.com/artifact/com.withorb.api/orb-java/0.21.0) +[![Maven Central](https://img.shields.io/maven-central/v/com.withorb.api/orb-java)](https://central.sonatype.com/artifact/com.withorb.api/orb-java/0.22.0) @@ -25,7 +25,7 @@ The REST API documentation can be foundĀ on [docs.withorb.com](https://docs.with ```kotlin -implementation("com.withorb.api:orb-java:0.21.0") +implementation("com.withorb.api:orb-java:0.22.0") ``` #### Maven @@ -34,7 +34,7 @@ implementation("com.withorb.api:orb-java:0.21.0") com.withorb.api orb-java - 0.21.0 + 0.22.0 ``` diff --git a/build.gradle.kts b/build.gradle.kts index d2b6a3e8..86f53d40 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,4 +1,4 @@ allprojects { group = "com.withorb.api" - version = "0.21.0" // x-release-please-version + version = "0.22.0" // x-release-please-version } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCostListByExternalIdResponse.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCostListByExternalIdResponse.kt index f2860b65..8602aeef 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCostListByExternalIdResponse.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCostListByExternalIdResponse.kt @@ -6930,6 +6930,241 @@ private constructor( fun price(groupedTieredPackagePrice: Price.GroupedTieredPackagePrice) = price(Price.ofGroupedTieredPackagePrice(groupedTieredPackagePrice)) + /** + * The Price resource represents a price that can be billed on a subscription, + * resulting in a charge on an invoice in the form of an invoice line item. Prices + * take a quantity and determine an amount to bill. + * + * Orb supports a few different pricing models out of the box. Each of these models + * is serialized differently in a given Price object. The model_type field + * determines the key for the configuration object that is present. + * + * ## Unit pricing + * + * With unit pricing, each unit costs a fixed amount. + * + * ```json + * { + * ... + * "model_type": "unit", + * "unit_config": { + * "unit_amount": "0.50" + * } + * ... + * } + * ``` + * + * ## Tiered pricing + * + * In tiered pricing, the cost of a given unit depends on the tier range that it + * falls into, where each tier range is defined by an upper and lower bound. For + * example, the first ten units may cost $0.50 each and all units thereafter may + * cost $0.10 each. + * + * ```json + * { + * ... + * "model_type": "tiered", + * "tiered_config": { + * "tiers": [ + * { + * "first_unit": 1, + * "last_unit": 10, + * "unit_amount": "0.50" + * }, + * { + * "first_unit": 11, + * "last_unit": null, + * "unit_amount": "0.10" + * } + * ] + * } + * ... + * ``` + * + * ## Bulk pricing + * + * Bulk pricing applies when the number of units determine the cost of all units. + * For example, if you've bought less than 10 units, they may each be $0.50 for a + * total of $5.00. Once you've bought more than 10 units, all units may now be + * priced at $0.40 (i.e. 101 units total would be $40.40). + * + * ```json + * { + * ... + * "model_type": "bulk", + * "bulk_config": { + * "tiers": [ + * { + * "maximum_units": 10, + * "unit_amount": "0.50" + * }, + * { + * "maximum_units": 1000, + * "unit_amount": "0.40" + * } + * ] + * } + * ... + * } + * ``` + * + * ## Package pricing + * + * Package pricing defines the size or granularity of a unit for billing purposes. + * For example, if the package size is set to 5, then 4 units will be billed as 5 + * and 6 units will be billed at 10. + * + * ```json + * { + * ... + * "model_type": "package", + * "package_config": { + * "package_amount": "0.80", + * "package_size": 10 + * } + * ... + * } + * ``` + * + * ## BPS pricing + * + * BPS pricing specifies a per-event (e.g. per-payment) rate in one hundredth of a + * percent (the number of basis points to charge), as well as a cap per event to + * assess. For example, this would allow you to assess a fee of 0.25% on every + * payment you process, with a maximum charge of $25 per payment. + * + * ```json + * { + * ... + * "model_type": "bps", + * "bps_config": { + * "bps": 125, + * "per_unit_maximum": "11.00" + * } + * ... + * } + * ``` + * + * ## Bulk BPS pricing + * + * Bulk BPS pricing specifies BPS parameters in a tiered manner, dependent on the + * total quantity across all events. Similar to bulk pricing, the BPS parameters of + * a given event depends on the tier range that the billing period falls into. Each + * tier range is defined by an upper bound. For example, after $1.5M of payment + * volume is reached, each individual payment may have a lower cap or a smaller + * take-rate. + * + * ```json + * ... + * "model_type": "bulk_bps", + * "bulk_bps_config": { + * "tiers": [ + * { + * "maximum_amount": "1000000.00", + * "bps": 125, + * "per_unit_maximum": "19.00" + * }, + * { + * "maximum_amount": null, + * "bps": 115, + * "per_unit_maximum": "4.00" + * } + * ] + * } + * ... + * } + * ``` + * + * ## Tiered BPS pricing + * + * Tiered BPS pricing specifies BPS parameters in a graduated manner, where an + * event's applicable parameter is a function of its marginal addition to the period + * total. Similar to tiered pricing, the BPS parameters of a given event depends on + * the tier range that it falls into, where each tier range is defined by an upper + * and lower bound. For example, the first few payments may have a 0.8 BPS take-rate + * and all payments after a specific volume may incur a take-rate of 0.5 BPS each. + * + * ```json + * ... + * "model_type": "tiered_bps", + * "tiered_bps_config": { + * "tiers": [ + * { + * "minimum_amount": "0", + * "maximum_amount": "1000000.00", + * "bps": 125, + * "per_unit_maximum": "19.00" + * }, + * { + * "minimum_amount": "1000000.00", + * "maximum_amount": null, + * "bps": 115, + * "per_unit_maximum": "4.00" + * } + * ] + * } + * ... + * } + * ``` + * + * ## Matrix pricing + * + * Matrix pricing defines a set of unit prices in a one or two-dimensional matrix. + * `dimensions` defines the two event property values evaluated in this pricing + * model. In a one-dimensional matrix, the second value is `null`. Every + * configuration has a list of `matrix_values` which give the unit prices for + * specified property values. In a one-dimensional matrix, the matrix values will + * have `dimension_values` where the second value of the pair is null. If an event + * does not match any of the dimension values in the matrix, it will resort to the + * `default_unit_amount`. + * + * ```json + * { + * "model_type": "matrix" + * "matrix_config": { + * "default_unit_amount": "3.00", + * "dimensions": [ + * "cluster_name", + * "region" + * ], + * "matrix_values": [ + * { + * "dimension_values": [ + * "alpha", + * "west" + * ], + * "unit_amount": "2.00" + * }, + * ... + * ] + * } + * } + * ``` + * + * ## Fixed fees + * + * Fixed fees are prices that are applied independent of usage quantities, and + * follow unit pricing. They also have an additional parameter + * `fixed_price_quantity`. If the Price represents a fixed cost, this represents the + * quantity of units applied. + * + * ```json + * { + * ... + * "id": "price_id", + * "model_type": "unit", + * "unit_config": { + * "unit_amount": "2.00" + * }, + * "fixed_price_quantity": 3.0 + * ... + * } + * ``` + */ + fun price(maxGroupTieredPrice: Price.MaxGroupTieredPrice) = + price(Price.ofMaxGroupTieredPrice(maxGroupTieredPrice)) + /** * Price's contributions for the timeframe, excluding any minimums and discounts. */ diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCostListResponse.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCostListResponse.kt index bfd7f8bb..fc6d96f9 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCostListResponse.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCostListResponse.kt @@ -6927,6 +6927,241 @@ private constructor( fun price(groupedTieredPackagePrice: Price.GroupedTieredPackagePrice) = price(Price.ofGroupedTieredPackagePrice(groupedTieredPackagePrice)) + /** + * The Price resource represents a price that can be billed on a subscription, + * resulting in a charge on an invoice in the form of an invoice line item. Prices + * take a quantity and determine an amount to bill. + * + * Orb supports a few different pricing models out of the box. Each of these models + * is serialized differently in a given Price object. The model_type field + * determines the key for the configuration object that is present. + * + * ## Unit pricing + * + * With unit pricing, each unit costs a fixed amount. + * + * ```json + * { + * ... + * "model_type": "unit", + * "unit_config": { + * "unit_amount": "0.50" + * } + * ... + * } + * ``` + * + * ## Tiered pricing + * + * In tiered pricing, the cost of a given unit depends on the tier range that it + * falls into, where each tier range is defined by an upper and lower bound. For + * example, the first ten units may cost $0.50 each and all units thereafter may + * cost $0.10 each. + * + * ```json + * { + * ... + * "model_type": "tiered", + * "tiered_config": { + * "tiers": [ + * { + * "first_unit": 1, + * "last_unit": 10, + * "unit_amount": "0.50" + * }, + * { + * "first_unit": 11, + * "last_unit": null, + * "unit_amount": "0.10" + * } + * ] + * } + * ... + * ``` + * + * ## Bulk pricing + * + * Bulk pricing applies when the number of units determine the cost of all units. + * For example, if you've bought less than 10 units, they may each be $0.50 for a + * total of $5.00. Once you've bought more than 10 units, all units may now be + * priced at $0.40 (i.e. 101 units total would be $40.40). + * + * ```json + * { + * ... + * "model_type": "bulk", + * "bulk_config": { + * "tiers": [ + * { + * "maximum_units": 10, + * "unit_amount": "0.50" + * }, + * { + * "maximum_units": 1000, + * "unit_amount": "0.40" + * } + * ] + * } + * ... + * } + * ``` + * + * ## Package pricing + * + * Package pricing defines the size or granularity of a unit for billing purposes. + * For example, if the package size is set to 5, then 4 units will be billed as 5 + * and 6 units will be billed at 10. + * + * ```json + * { + * ... + * "model_type": "package", + * "package_config": { + * "package_amount": "0.80", + * "package_size": 10 + * } + * ... + * } + * ``` + * + * ## BPS pricing + * + * BPS pricing specifies a per-event (e.g. per-payment) rate in one hundredth of a + * percent (the number of basis points to charge), as well as a cap per event to + * assess. For example, this would allow you to assess a fee of 0.25% on every + * payment you process, with a maximum charge of $25 per payment. + * + * ```json + * { + * ... + * "model_type": "bps", + * "bps_config": { + * "bps": 125, + * "per_unit_maximum": "11.00" + * } + * ... + * } + * ``` + * + * ## Bulk BPS pricing + * + * Bulk BPS pricing specifies BPS parameters in a tiered manner, dependent on the + * total quantity across all events. Similar to bulk pricing, the BPS parameters of + * a given event depends on the tier range that the billing period falls into. Each + * tier range is defined by an upper bound. For example, after $1.5M of payment + * volume is reached, each individual payment may have a lower cap or a smaller + * take-rate. + * + * ```json + * ... + * "model_type": "bulk_bps", + * "bulk_bps_config": { + * "tiers": [ + * { + * "maximum_amount": "1000000.00", + * "bps": 125, + * "per_unit_maximum": "19.00" + * }, + * { + * "maximum_amount": null, + * "bps": 115, + * "per_unit_maximum": "4.00" + * } + * ] + * } + * ... + * } + * ``` + * + * ## Tiered BPS pricing + * + * Tiered BPS pricing specifies BPS parameters in a graduated manner, where an + * event's applicable parameter is a function of its marginal addition to the period + * total. Similar to tiered pricing, the BPS parameters of a given event depends on + * the tier range that it falls into, where each tier range is defined by an upper + * and lower bound. For example, the first few payments may have a 0.8 BPS take-rate + * and all payments after a specific volume may incur a take-rate of 0.5 BPS each. + * + * ```json + * ... + * "model_type": "tiered_bps", + * "tiered_bps_config": { + * "tiers": [ + * { + * "minimum_amount": "0", + * "maximum_amount": "1000000.00", + * "bps": 125, + * "per_unit_maximum": "19.00" + * }, + * { + * "minimum_amount": "1000000.00", + * "maximum_amount": null, + * "bps": 115, + * "per_unit_maximum": "4.00" + * } + * ] + * } + * ... + * } + * ``` + * + * ## Matrix pricing + * + * Matrix pricing defines a set of unit prices in a one or two-dimensional matrix. + * `dimensions` defines the two event property values evaluated in this pricing + * model. In a one-dimensional matrix, the second value is `null`. Every + * configuration has a list of `matrix_values` which give the unit prices for + * specified property values. In a one-dimensional matrix, the matrix values will + * have `dimension_values` where the second value of the pair is null. If an event + * does not match any of the dimension values in the matrix, it will resort to the + * `default_unit_amount`. + * + * ```json + * { + * "model_type": "matrix" + * "matrix_config": { + * "default_unit_amount": "3.00", + * "dimensions": [ + * "cluster_name", + * "region" + * ], + * "matrix_values": [ + * { + * "dimension_values": [ + * "alpha", + * "west" + * ], + * "unit_amount": "2.00" + * }, + * ... + * ] + * } + * } + * ``` + * + * ## Fixed fees + * + * Fixed fees are prices that are applied independent of usage quantities, and + * follow unit pricing. They also have an additional parameter + * `fixed_price_quantity`. If the Price represents a fixed cost, this represents the + * quantity of units applied. + * + * ```json + * { + * ... + * "id": "price_id", + * "model_type": "unit", + * "unit_config": { + * "unit_amount": "2.00" + * }, + * "fixed_price_quantity": 3.0 + * ... + * } + * ``` + */ + fun price(maxGroupTieredPrice: Price.MaxGroupTieredPrice) = + price(Price.ofMaxGroupTieredPrice(maxGroupTieredPrice)) + /** * Price's contributions for the timeframe, excluding any minimums and discounts. */ diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/Invoice.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/Invoice.kt index 4a014bd2..612b12d5 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/Invoice.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/Invoice.kt @@ -11553,6 +11553,237 @@ private constructor( fun price(groupedTieredPackagePrice: Price.GroupedTieredPackagePrice) = price(Price.ofGroupedTieredPackagePrice(groupedTieredPackagePrice)) + /** + * The Price resource represents a price that can be billed on a subscription, resulting + * in a charge on an invoice in the form of an invoice line item. Prices take a quantity + * and determine an amount to bill. + * + * Orb supports a few different pricing models out of the box. Each of these models is + * serialized differently in a given Price object. The model_type field determines the + * key for the configuration object that is present. + * + * ## Unit pricing + * + * With unit pricing, each unit costs a fixed amount. + * + * ```json + * { + * ... + * "model_type": "unit", + * "unit_config": { + * "unit_amount": "0.50" + * } + * ... + * } + * ``` + * + * ## Tiered pricing + * + * In tiered pricing, the cost of a given unit depends on the tier range that it falls + * into, where each tier range is defined by an upper and lower bound. For example, the + * first ten units may cost $0.50 each and all units thereafter may cost $0.10 each. + * + * ```json + * { + * ... + * "model_type": "tiered", + * "tiered_config": { + * "tiers": [ + * { + * "first_unit": 1, + * "last_unit": 10, + * "unit_amount": "0.50" + * }, + * { + * "first_unit": 11, + * "last_unit": null, + * "unit_amount": "0.10" + * } + * ] + * } + * ... + * ``` + * + * ## Bulk pricing + * + * Bulk pricing applies when the number of units determine the cost of all units. For + * example, if you've bought less than 10 units, they may each be $0.50 for a total of + * $5.00. Once you've bought more than 10 units, all units may now be priced at $0.40 + * (i.e. 101 units total would be $40.40). + * + * ```json + * { + * ... + * "model_type": "bulk", + * "bulk_config": { + * "tiers": [ + * { + * "maximum_units": 10, + * "unit_amount": "0.50" + * }, + * { + * "maximum_units": 1000, + * "unit_amount": "0.40" + * } + * ] + * } + * ... + * } + * ``` + * + * ## Package pricing + * + * Package pricing defines the size or granularity of a unit for billing purposes. For + * example, if the package size is set to 5, then 4 units will be billed as 5 and 6 + * units will be billed at 10. + * + * ```json + * { + * ... + * "model_type": "package", + * "package_config": { + * "package_amount": "0.80", + * "package_size": 10 + * } + * ... + * } + * ``` + * + * ## BPS pricing + * + * BPS pricing specifies a per-event (e.g. per-payment) rate in one hundredth of a + * percent (the number of basis points to charge), as well as a cap per event to assess. + * For example, this would allow you to assess a fee of 0.25% on every payment you + * process, with a maximum charge of $25 per payment. + * + * ```json + * { + * ... + * "model_type": "bps", + * "bps_config": { + * "bps": 125, + * "per_unit_maximum": "11.00" + * } + * ... + * } + * ``` + * + * ## Bulk BPS pricing + * + * Bulk BPS pricing specifies BPS parameters in a tiered manner, dependent on the total + * quantity across all events. Similar to bulk pricing, the BPS parameters of a given + * event depends on the tier range that the billing period falls into. Each tier range + * is defined by an upper bound. For example, after $1.5M of payment volume is reached, + * each individual payment may have a lower cap or a smaller take-rate. + * + * ```json + * ... + * "model_type": "bulk_bps", + * "bulk_bps_config": { + * "tiers": [ + * { + * "maximum_amount": "1000000.00", + * "bps": 125, + * "per_unit_maximum": "19.00" + * }, + * { + * "maximum_amount": null, + * "bps": 115, + * "per_unit_maximum": "4.00" + * } + * ] + * } + * ... + * } + * ``` + * + * ## Tiered BPS pricing + * + * Tiered BPS pricing specifies BPS parameters in a graduated manner, where an event's + * applicable parameter is a function of its marginal addition to the period total. + * Similar to tiered pricing, the BPS parameters of a given event depends on the tier + * range that it falls into, where each tier range is defined by an upper and lower + * bound. For example, the first few payments may have a 0.8 BPS take-rate and all + * payments after a specific volume may incur a take-rate of 0.5 BPS each. + * + * ```json + * ... + * "model_type": "tiered_bps", + * "tiered_bps_config": { + * "tiers": [ + * { + * "minimum_amount": "0", + * "maximum_amount": "1000000.00", + * "bps": 125, + * "per_unit_maximum": "19.00" + * }, + * { + * "minimum_amount": "1000000.00", + * "maximum_amount": null, + * "bps": 115, + * "per_unit_maximum": "4.00" + * } + * ] + * } + * ... + * } + * ``` + * + * ## Matrix pricing + * + * Matrix pricing defines a set of unit prices in a one or two-dimensional matrix. + * `dimensions` defines the two event property values evaluated in this pricing model. + * In a one-dimensional matrix, the second value is `null`. Every configuration has a + * list of `matrix_values` which give the unit prices for specified property values. In + * a one-dimensional matrix, the matrix values will have `dimension_values` where the + * second value of the pair is null. If an event does not match any of the dimension + * values in the matrix, it will resort to the `default_unit_amount`. + * + * ```json + * { + * "model_type": "matrix" + * "matrix_config": { + * "default_unit_amount": "3.00", + * "dimensions": [ + * "cluster_name", + * "region" + * ], + * "matrix_values": [ + * { + * "dimension_values": [ + * "alpha", + * "west" + * ], + * "unit_amount": "2.00" + * }, + * ... + * ] + * } + * } + * ``` + * + * ## Fixed fees + * + * Fixed fees are prices that are applied independent of usage quantities, and follow + * unit pricing. They also have an additional parameter `fixed_price_quantity`. If the + * Price represents a fixed cost, this represents the quantity of units applied. + * + * ```json + * { + * ... + * "id": "price_id", + * "model_type": "unit", + * "unit_config": { + * "unit_amount": "2.00" + * }, + * "fixed_price_quantity": 3.0 + * ... + * } + * ``` + */ + fun price(maxGroupTieredPrice: Price.MaxGroupTieredPrice) = + price(Price.ofMaxGroupTieredPrice(maxGroupTieredPrice)) + fun quantity(quantity: Double) = quantity(JsonField.of(quantity)) fun quantity(quantity: JsonField) = apply { this.quantity = quantity } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/InvoiceFetchUpcomingResponse.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/InvoiceFetchUpcomingResponse.kt index b83b2412..1d727cf7 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/InvoiceFetchUpcomingResponse.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/InvoiceFetchUpcomingResponse.kt @@ -11547,6 +11547,237 @@ private constructor( fun price(groupedTieredPackagePrice: Price.GroupedTieredPackagePrice) = price(Price.ofGroupedTieredPackagePrice(groupedTieredPackagePrice)) + /** + * The Price resource represents a price that can be billed on a subscription, resulting + * in a charge on an invoice in the form of an invoice line item. Prices take a quantity + * and determine an amount to bill. + * + * Orb supports a few different pricing models out of the box. Each of these models is + * serialized differently in a given Price object. The model_type field determines the + * key for the configuration object that is present. + * + * ## Unit pricing + * + * With unit pricing, each unit costs a fixed amount. + * + * ```json + * { + * ... + * "model_type": "unit", + * "unit_config": { + * "unit_amount": "0.50" + * } + * ... + * } + * ``` + * + * ## Tiered pricing + * + * In tiered pricing, the cost of a given unit depends on the tier range that it falls + * into, where each tier range is defined by an upper and lower bound. For example, the + * first ten units may cost $0.50 each and all units thereafter may cost $0.10 each. + * + * ```json + * { + * ... + * "model_type": "tiered", + * "tiered_config": { + * "tiers": [ + * { + * "first_unit": 1, + * "last_unit": 10, + * "unit_amount": "0.50" + * }, + * { + * "first_unit": 11, + * "last_unit": null, + * "unit_amount": "0.10" + * } + * ] + * } + * ... + * ``` + * + * ## Bulk pricing + * + * Bulk pricing applies when the number of units determine the cost of all units. For + * example, if you've bought less than 10 units, they may each be $0.50 for a total of + * $5.00. Once you've bought more than 10 units, all units may now be priced at $0.40 + * (i.e. 101 units total would be $40.40). + * + * ```json + * { + * ... + * "model_type": "bulk", + * "bulk_config": { + * "tiers": [ + * { + * "maximum_units": 10, + * "unit_amount": "0.50" + * }, + * { + * "maximum_units": 1000, + * "unit_amount": "0.40" + * } + * ] + * } + * ... + * } + * ``` + * + * ## Package pricing + * + * Package pricing defines the size or granularity of a unit for billing purposes. For + * example, if the package size is set to 5, then 4 units will be billed as 5 and 6 + * units will be billed at 10. + * + * ```json + * { + * ... + * "model_type": "package", + * "package_config": { + * "package_amount": "0.80", + * "package_size": 10 + * } + * ... + * } + * ``` + * + * ## BPS pricing + * + * BPS pricing specifies a per-event (e.g. per-payment) rate in one hundredth of a + * percent (the number of basis points to charge), as well as a cap per event to assess. + * For example, this would allow you to assess a fee of 0.25% on every payment you + * process, with a maximum charge of $25 per payment. + * + * ```json + * { + * ... + * "model_type": "bps", + * "bps_config": { + * "bps": 125, + * "per_unit_maximum": "11.00" + * } + * ... + * } + * ``` + * + * ## Bulk BPS pricing + * + * Bulk BPS pricing specifies BPS parameters in a tiered manner, dependent on the total + * quantity across all events. Similar to bulk pricing, the BPS parameters of a given + * event depends on the tier range that the billing period falls into. Each tier range + * is defined by an upper bound. For example, after $1.5M of payment volume is reached, + * each individual payment may have a lower cap or a smaller take-rate. + * + * ```json + * ... + * "model_type": "bulk_bps", + * "bulk_bps_config": { + * "tiers": [ + * { + * "maximum_amount": "1000000.00", + * "bps": 125, + * "per_unit_maximum": "19.00" + * }, + * { + * "maximum_amount": null, + * "bps": 115, + * "per_unit_maximum": "4.00" + * } + * ] + * } + * ... + * } + * ``` + * + * ## Tiered BPS pricing + * + * Tiered BPS pricing specifies BPS parameters in a graduated manner, where an event's + * applicable parameter is a function of its marginal addition to the period total. + * Similar to tiered pricing, the BPS parameters of a given event depends on the tier + * range that it falls into, where each tier range is defined by an upper and lower + * bound. For example, the first few payments may have a 0.8 BPS take-rate and all + * payments after a specific volume may incur a take-rate of 0.5 BPS each. + * + * ```json + * ... + * "model_type": "tiered_bps", + * "tiered_bps_config": { + * "tiers": [ + * { + * "minimum_amount": "0", + * "maximum_amount": "1000000.00", + * "bps": 125, + * "per_unit_maximum": "19.00" + * }, + * { + * "minimum_amount": "1000000.00", + * "maximum_amount": null, + * "bps": 115, + * "per_unit_maximum": "4.00" + * } + * ] + * } + * ... + * } + * ``` + * + * ## Matrix pricing + * + * Matrix pricing defines a set of unit prices in a one or two-dimensional matrix. + * `dimensions` defines the two event property values evaluated in this pricing model. + * In a one-dimensional matrix, the second value is `null`. Every configuration has a + * list of `matrix_values` which give the unit prices for specified property values. In + * a one-dimensional matrix, the matrix values will have `dimension_values` where the + * second value of the pair is null. If an event does not match any of the dimension + * values in the matrix, it will resort to the `default_unit_amount`. + * + * ```json + * { + * "model_type": "matrix" + * "matrix_config": { + * "default_unit_amount": "3.00", + * "dimensions": [ + * "cluster_name", + * "region" + * ], + * "matrix_values": [ + * { + * "dimension_values": [ + * "alpha", + * "west" + * ], + * "unit_amount": "2.00" + * }, + * ... + * ] + * } + * } + * ``` + * + * ## Fixed fees + * + * Fixed fees are prices that are applied independent of usage quantities, and follow + * unit pricing. They also have an additional parameter `fixed_price_quantity`. If the + * Price represents a fixed cost, this represents the quantity of units applied. + * + * ```json + * { + * ... + * "id": "price_id", + * "model_type": "unit", + * "unit_config": { + * "unit_amount": "2.00" + * }, + * "fixed_price_quantity": 3.0 + * ... + * } + * ``` + */ + fun price(maxGroupTieredPrice: Price.MaxGroupTieredPrice) = + price(Price.ofMaxGroupTieredPrice(maxGroupTieredPrice)) + fun quantity(quantity: Double) = quantity(JsonField.of(quantity)) fun quantity(quantity: JsonField) = apply { this.quantity = quantity } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/InvoiceLineItemCreateResponse.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/InvoiceLineItemCreateResponse.kt index f23e52bb..a22efe71 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/InvoiceLineItemCreateResponse.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/InvoiceLineItemCreateResponse.kt @@ -7048,6 +7048,237 @@ private constructor( fun price(groupedTieredPackagePrice: Price.GroupedTieredPackagePrice) = price(Price.ofGroupedTieredPackagePrice(groupedTieredPackagePrice)) + /** + * The Price resource represents a price that can be billed on a subscription, resulting in + * a charge on an invoice in the form of an invoice line item. Prices take a quantity and + * determine an amount to bill. + * + * Orb supports a few different pricing models out of the box. Each of these models is + * serialized differently in a given Price object. The model_type field determines the key + * for the configuration object that is present. + * + * ## Unit pricing + * + * With unit pricing, each unit costs a fixed amount. + * + * ```json + * { + * ... + * "model_type": "unit", + * "unit_config": { + * "unit_amount": "0.50" + * } + * ... + * } + * ``` + * + * ## Tiered pricing + * + * In tiered pricing, the cost of a given unit depends on the tier range that it falls into, + * where each tier range is defined by an upper and lower bound. For example, the first ten + * units may cost $0.50 each and all units thereafter may cost $0.10 each. + * + * ```json + * { + * ... + * "model_type": "tiered", + * "tiered_config": { + * "tiers": [ + * { + * "first_unit": 1, + * "last_unit": 10, + * "unit_amount": "0.50" + * }, + * { + * "first_unit": 11, + * "last_unit": null, + * "unit_amount": "0.10" + * } + * ] + * } + * ... + * ``` + * + * ## Bulk pricing + * + * Bulk pricing applies when the number of units determine the cost of all units. For + * example, if you've bought less than 10 units, they may each be $0.50 for a total of + * $5.00. Once you've bought more than 10 units, all units may now be priced at $0.40 (i.e. + * 101 units total would be $40.40). + * + * ```json + * { + * ... + * "model_type": "bulk", + * "bulk_config": { + * "tiers": [ + * { + * "maximum_units": 10, + * "unit_amount": "0.50" + * }, + * { + * "maximum_units": 1000, + * "unit_amount": "0.40" + * } + * ] + * } + * ... + * } + * ``` + * + * ## Package pricing + * + * Package pricing defines the size or granularity of a unit for billing purposes. For + * example, if the package size is set to 5, then 4 units will be billed as 5 and 6 units + * will be billed at 10. + * + * ```json + * { + * ... + * "model_type": "package", + * "package_config": { + * "package_amount": "0.80", + * "package_size": 10 + * } + * ... + * } + * ``` + * + * ## BPS pricing + * + * BPS pricing specifies a per-event (e.g. per-payment) rate in one hundredth of a percent + * (the number of basis points to charge), as well as a cap per event to assess. For + * example, this would allow you to assess a fee of 0.25% on every payment you process, with + * a maximum charge of $25 per payment. + * + * ```json + * { + * ... + * "model_type": "bps", + * "bps_config": { + * "bps": 125, + * "per_unit_maximum": "11.00" + * } + * ... + * } + * ``` + * + * ## Bulk BPS pricing + * + * Bulk BPS pricing specifies BPS parameters in a tiered manner, dependent on the total + * quantity across all events. Similar to bulk pricing, the BPS parameters of a given event + * depends on the tier range that the billing period falls into. Each tier range is defined + * by an upper bound. For example, after $1.5M of payment volume is reached, each individual + * payment may have a lower cap or a smaller take-rate. + * + * ```json + * ... + * "model_type": "bulk_bps", + * "bulk_bps_config": { + * "tiers": [ + * { + * "maximum_amount": "1000000.00", + * "bps": 125, + * "per_unit_maximum": "19.00" + * }, + * { + * "maximum_amount": null, + * "bps": 115, + * "per_unit_maximum": "4.00" + * } + * ] + * } + * ... + * } + * ``` + * + * ## Tiered BPS pricing + * + * Tiered BPS pricing specifies BPS parameters in a graduated manner, where an event's + * applicable parameter is a function of its marginal addition to the period total. Similar + * to tiered pricing, the BPS parameters of a given event depends on the tier range that it + * falls into, where each tier range is defined by an upper and lower bound. For example, + * the first few payments may have a 0.8 BPS take-rate and all payments after a specific + * volume may incur a take-rate of 0.5 BPS each. + * + * ```json + * ... + * "model_type": "tiered_bps", + * "tiered_bps_config": { + * "tiers": [ + * { + * "minimum_amount": "0", + * "maximum_amount": "1000000.00", + * "bps": 125, + * "per_unit_maximum": "19.00" + * }, + * { + * "minimum_amount": "1000000.00", + * "maximum_amount": null, + * "bps": 115, + * "per_unit_maximum": "4.00" + * } + * ] + * } + * ... + * } + * ``` + * + * ## Matrix pricing + * + * Matrix pricing defines a set of unit prices in a one or two-dimensional matrix. + * `dimensions` defines the two event property values evaluated in this pricing model. In a + * one-dimensional matrix, the second value is `null`. Every configuration has a list of + * `matrix_values` which give the unit prices for specified property values. In a + * one-dimensional matrix, the matrix values will have `dimension_values` where the second + * value of the pair is null. If an event does not match any of the dimension values in the + * matrix, it will resort to the `default_unit_amount`. + * + * ```json + * { + * "model_type": "matrix" + * "matrix_config": { + * "default_unit_amount": "3.00", + * "dimensions": [ + * "cluster_name", + * "region" + * ], + * "matrix_values": [ + * { + * "dimension_values": [ + * "alpha", + * "west" + * ], + * "unit_amount": "2.00" + * }, + * ... + * ] + * } + * } + * ``` + * + * ## Fixed fees + * + * Fixed fees are prices that are applied independent of usage quantities, and follow unit + * pricing. They also have an additional parameter `fixed_price_quantity`. If the Price + * represents a fixed cost, this represents the quantity of units applied. + * + * ```json + * { + * ... + * "id": "price_id", + * "model_type": "unit", + * "unit_config": { + * "unit_amount": "2.00" + * }, + * "fixed_price_quantity": 3.0 + * ... + * } + * ``` + */ + fun price(maxGroupTieredPrice: Price.MaxGroupTieredPrice) = + price(Price.ofMaxGroupTieredPrice(maxGroupTieredPrice)) + fun quantity(quantity: Double) = quantity(JsonField.of(quantity)) fun quantity(quantity: JsonField) = apply { this.quantity = quantity } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/Plan.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/Plan.kt index 18ac2ed8..cdf2114c 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/Plan.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/Plan.kt @@ -894,6 +894,13 @@ private constructor( fun addPrice(groupedTieredPackagePrice: Price.GroupedTieredPackagePrice) = addPrice(Price.ofGroupedTieredPackagePrice(groupedTieredPackagePrice)) + /** + * Prices for this plan. If the plan has phases, this includes prices across all phases of + * the plan. + */ + fun addPrice(maxGroupTieredPrice: Price.MaxGroupTieredPrice) = + addPrice(Price.ofMaxGroupTieredPrice(maxGroupTieredPrice)) + fun product(product: Product) = product(JsonField.of(product)) fun product(product: JsonField) = apply { this.product = product } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/PlanCreateParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/PlanCreateParams.kt index 281d511c..ea189231 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/PlanCreateParams.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/PlanCreateParams.kt @@ -492,6 +492,13 @@ constructor( fun addPrice(newPlanGroupedTieredPackagePrice: Price.NewPlanGroupedTieredPackagePrice) = addPrice(Price.ofNewPlanGroupedTieredPackagePrice(newPlanGroupedTieredPackagePrice)) + /** + * Prices for this plan. If the plan has phases, this includes prices across all phases + * of the plan. + */ + fun addPrice(newPlanMaxGroupTieredPrice: Price.NewPlanMaxGroupTieredPrice) = + addPrice(Price.ofNewPlanMaxGroupTieredPrice(newPlanMaxGroupTieredPrice)) + /** Free-form text which is available on the invoice PDF and the Orb invoice portal. */ fun defaultInvoiceMemo(defaultInvoiceMemo: String?) = defaultInvoiceMemo(JsonField.ofNullable(defaultInvoiceMemo)) @@ -845,6 +852,14 @@ constructor( body.addPrice(newPlanGroupedTieredPackagePrice) } + /** + * Prices for this plan. If the plan has phases, this includes prices across all phases of + * the plan. + */ + fun addPrice(newPlanMaxGroupTieredPrice: Price.NewPlanMaxGroupTieredPrice) = apply { + body.addPrice(newPlanMaxGroupTieredPrice) + } + /** Free-form text which is available on the invoice PDF and the Orb invoice portal. */ fun defaultInvoiceMemo(defaultInvoiceMemo: String?) = apply { body.defaultInvoiceMemo(defaultInvoiceMemo) @@ -1079,6 +1094,7 @@ constructor( private val newPlanMatrixWithDisplayNamePrice: NewPlanMatrixWithDisplayNamePrice? = null, private val newPlanBulkWithProrationPrice: NewPlanBulkWithProrationPrice? = null, private val newPlanGroupedTieredPackagePrice: NewPlanGroupedTieredPackagePrice? = null, + private val newPlanMaxGroupTieredPrice: NewPlanMaxGroupTieredPrice? = null, private val _json: JsonValue? = null, ) { @@ -1144,6 +1160,9 @@ constructor( fun newPlanGroupedTieredPackagePrice(): Optional = Optional.ofNullable(newPlanGroupedTieredPackagePrice) + fun newPlanMaxGroupTieredPrice(): Optional = + Optional.ofNullable(newPlanMaxGroupTieredPrice) + fun isNewPlanUnitPrice(): Boolean = newPlanUnitPrice != null fun isNewPlanPackagePrice(): Boolean = newPlanPackagePrice != null @@ -1190,6 +1209,8 @@ constructor( fun isNewPlanGroupedTieredPackagePrice(): Boolean = newPlanGroupedTieredPackagePrice != null + fun isNewPlanMaxGroupTieredPrice(): Boolean = newPlanMaxGroupTieredPrice != null + fun asNewPlanUnitPrice(): NewPlanUnitPrice = newPlanUnitPrice.getOrThrow("newPlanUnitPrice") fun asNewPlanPackagePrice(): NewPlanPackagePrice = @@ -1254,6 +1275,9 @@ constructor( fun asNewPlanGroupedTieredPackagePrice(): NewPlanGroupedTieredPackagePrice = newPlanGroupedTieredPackagePrice.getOrThrow("newPlanGroupedTieredPackagePrice") + fun asNewPlanMaxGroupTieredPrice(): NewPlanMaxGroupTieredPrice = + newPlanMaxGroupTieredPrice.getOrThrow("newPlanMaxGroupTieredPrice") + fun _json(): Optional = Optional.ofNullable(_json) fun accept(visitor: Visitor): T { @@ -1301,6 +1325,8 @@ constructor( visitor.visitNewPlanBulkWithProrationPrice(newPlanBulkWithProrationPrice) newPlanGroupedTieredPackagePrice != null -> visitor.visitNewPlanGroupedTieredPackagePrice(newPlanGroupedTieredPackagePrice) + newPlanMaxGroupTieredPrice != null -> + visitor.visitNewPlanMaxGroupTieredPrice(newPlanMaxGroupTieredPrice) else -> visitor.unknown(_json) } } @@ -1430,6 +1456,12 @@ constructor( ) { newPlanGroupedTieredPackagePrice.validate() } + + override fun visitNewPlanMaxGroupTieredPrice( + newPlanMaxGroupTieredPrice: NewPlanMaxGroupTieredPrice + ) { + newPlanMaxGroupTieredPrice.validate() + } } ) validated = true @@ -1440,10 +1472,10 @@ constructor( return true } - return /* spotless:off */ other is Price && newPlanUnitPrice == other.newPlanUnitPrice && newPlanPackagePrice == other.newPlanPackagePrice && newPlanMatrixPrice == other.newPlanMatrixPrice && newPlanTieredPrice == other.newPlanTieredPrice && newPlanTieredBpsPrice == other.newPlanTieredBpsPrice && newPlanBpsPrice == other.newPlanBpsPrice && newPlanBulkBpsPrice == other.newPlanBulkBpsPrice && newPlanBulkPrice == other.newPlanBulkPrice && newPlanThresholdTotalAmountPrice == other.newPlanThresholdTotalAmountPrice && newPlanTieredPackagePrice == other.newPlanTieredPackagePrice && newPlanTieredWithMinimumPrice == other.newPlanTieredWithMinimumPrice && newPlanUnitWithPercentPrice == other.newPlanUnitWithPercentPrice && newPlanPackageWithAllocationPrice == other.newPlanPackageWithAllocationPrice && newPlanTierWithProrationPrice == other.newPlanTierWithProrationPrice && newPlanUnitWithProrationPrice == other.newPlanUnitWithProrationPrice && newPlanGroupedAllocationPrice == other.newPlanGroupedAllocationPrice && newPlanGroupedWithProratedMinimumPrice == other.newPlanGroupedWithProratedMinimumPrice && newPlanGroupedWithMeteredMinimumPrice == other.newPlanGroupedWithMeteredMinimumPrice && newPlanMatrixWithDisplayNamePrice == other.newPlanMatrixWithDisplayNamePrice && newPlanBulkWithProrationPrice == other.newPlanBulkWithProrationPrice && newPlanGroupedTieredPackagePrice == other.newPlanGroupedTieredPackagePrice /* spotless:on */ + return /* spotless:off */ other is Price && newPlanUnitPrice == other.newPlanUnitPrice && newPlanPackagePrice == other.newPlanPackagePrice && newPlanMatrixPrice == other.newPlanMatrixPrice && newPlanTieredPrice == other.newPlanTieredPrice && newPlanTieredBpsPrice == other.newPlanTieredBpsPrice && newPlanBpsPrice == other.newPlanBpsPrice && newPlanBulkBpsPrice == other.newPlanBulkBpsPrice && newPlanBulkPrice == other.newPlanBulkPrice && newPlanThresholdTotalAmountPrice == other.newPlanThresholdTotalAmountPrice && newPlanTieredPackagePrice == other.newPlanTieredPackagePrice && newPlanTieredWithMinimumPrice == other.newPlanTieredWithMinimumPrice && newPlanUnitWithPercentPrice == other.newPlanUnitWithPercentPrice && newPlanPackageWithAllocationPrice == other.newPlanPackageWithAllocationPrice && newPlanTierWithProrationPrice == other.newPlanTierWithProrationPrice && newPlanUnitWithProrationPrice == other.newPlanUnitWithProrationPrice && newPlanGroupedAllocationPrice == other.newPlanGroupedAllocationPrice && newPlanGroupedWithProratedMinimumPrice == other.newPlanGroupedWithProratedMinimumPrice && newPlanGroupedWithMeteredMinimumPrice == other.newPlanGroupedWithMeteredMinimumPrice && newPlanMatrixWithDisplayNamePrice == other.newPlanMatrixWithDisplayNamePrice && newPlanBulkWithProrationPrice == other.newPlanBulkWithProrationPrice && newPlanGroupedTieredPackagePrice == other.newPlanGroupedTieredPackagePrice && newPlanMaxGroupTieredPrice == other.newPlanMaxGroupTieredPrice /* spotless:on */ } - override fun hashCode(): Int = /* spotless:off */ Objects.hash(newPlanUnitPrice, newPlanPackagePrice, newPlanMatrixPrice, newPlanTieredPrice, newPlanTieredBpsPrice, newPlanBpsPrice, newPlanBulkBpsPrice, newPlanBulkPrice, newPlanThresholdTotalAmountPrice, newPlanTieredPackagePrice, newPlanTieredWithMinimumPrice, newPlanUnitWithPercentPrice, newPlanPackageWithAllocationPrice, newPlanTierWithProrationPrice, newPlanUnitWithProrationPrice, newPlanGroupedAllocationPrice, newPlanGroupedWithProratedMinimumPrice, newPlanGroupedWithMeteredMinimumPrice, newPlanMatrixWithDisplayNamePrice, newPlanBulkWithProrationPrice, newPlanGroupedTieredPackagePrice) /* spotless:on */ + override fun hashCode(): Int = /* spotless:off */ Objects.hash(newPlanUnitPrice, newPlanPackagePrice, newPlanMatrixPrice, newPlanTieredPrice, newPlanTieredBpsPrice, newPlanBpsPrice, newPlanBulkBpsPrice, newPlanBulkPrice, newPlanThresholdTotalAmountPrice, newPlanTieredPackagePrice, newPlanTieredWithMinimumPrice, newPlanUnitWithPercentPrice, newPlanPackageWithAllocationPrice, newPlanTierWithProrationPrice, newPlanUnitWithProrationPrice, newPlanGroupedAllocationPrice, newPlanGroupedWithProratedMinimumPrice, newPlanGroupedWithMeteredMinimumPrice, newPlanMatrixWithDisplayNamePrice, newPlanBulkWithProrationPrice, newPlanGroupedTieredPackagePrice, newPlanMaxGroupTieredPrice) /* spotless:on */ override fun toString(): String = when { @@ -1482,6 +1514,8 @@ constructor( "Price{newPlanBulkWithProrationPrice=$newPlanBulkWithProrationPrice}" newPlanGroupedTieredPackagePrice != null -> "Price{newPlanGroupedTieredPackagePrice=$newPlanGroupedTieredPackagePrice}" + newPlanMaxGroupTieredPrice != null -> + "Price{newPlanMaxGroupTieredPrice=$newPlanMaxGroupTieredPrice}" _json != null -> "Price{_unknown=$_json}" else -> throw IllegalStateException("Invalid Price") } @@ -1586,6 +1620,11 @@ constructor( fun ofNewPlanGroupedTieredPackagePrice( newPlanGroupedTieredPackagePrice: NewPlanGroupedTieredPackagePrice ) = Price(newPlanGroupedTieredPackagePrice = newPlanGroupedTieredPackagePrice) + + @JvmStatic + fun ofNewPlanMaxGroupTieredPrice( + newPlanMaxGroupTieredPrice: NewPlanMaxGroupTieredPrice + ) = Price(newPlanMaxGroupTieredPrice = newPlanMaxGroupTieredPrice) } interface Visitor { @@ -1658,6 +1697,10 @@ constructor( newPlanGroupedTieredPackagePrice: NewPlanGroupedTieredPackagePrice ): T + fun visitNewPlanMaxGroupTieredPrice( + newPlanMaxGroupTieredPrice: NewPlanMaxGroupTieredPrice + ): T + fun unknown(json: JsonValue?): T { throw OrbInvalidDataException("Unknown Price: $json") } @@ -1841,6 +1884,14 @@ constructor( return Price(newPlanGroupedTieredPackagePrice = it, _json = json) } } + "max_group_tiered" -> { + tryDeserialize(node, jacksonTypeRef()) { + it.validate() + } + ?.let { + return Price(newPlanMaxGroupTieredPrice = it, _json = json) + } + } } return Price(_json = json) @@ -1894,6 +1945,8 @@ constructor( generator.writeObject(value.newPlanBulkWithProrationPrice) value.newPlanGroupedTieredPackagePrice != null -> generator.writeObject(value.newPlanGroupedTieredPackagePrice) + value.newPlanMaxGroupTieredPrice != null -> + generator.writeObject(value.newPlanMaxGroupTieredPrice) value._json != null -> generator.writeObject(value._json) else -> throw IllegalStateException("Invalid Price") } @@ -30231,6 +30284,1293 @@ constructor( override fun toString() = "NewPlanGroupedTieredPackagePrice{cadence=$cadence, groupedTieredPackageConfig=$groupedTieredPackageConfig, itemId=$itemId, modelType=$modelType, name=$name, billableMetricId=$billableMetricId, billedInAdvance=$billedInAdvance, billingCycleConfiguration=$billingCycleConfiguration, conversionRate=$conversionRate, currency=$currency, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, invoicingCycleConfiguration=$invoicingCycleConfiguration, metadata=$metadata, additionalProperties=$additionalProperties}" } + + @NoAutoDetect + class NewPlanMaxGroupTieredPrice + @JsonCreator + private constructor( + @JsonProperty("cadence") + @ExcludeMissing + private val cadence: JsonField = JsonMissing.of(), + @JsonProperty("item_id") + @ExcludeMissing + private val itemId: JsonField = JsonMissing.of(), + @JsonProperty("max_group_tiered_config") + @ExcludeMissing + private val maxGroupTieredConfig: JsonField = JsonMissing.of(), + @JsonProperty("model_type") + @ExcludeMissing + private val modelType: JsonField = JsonMissing.of(), + @JsonProperty("name") + @ExcludeMissing + private val name: JsonField = JsonMissing.of(), + @JsonProperty("billable_metric_id") + @ExcludeMissing + private val billableMetricId: JsonField = JsonMissing.of(), + @JsonProperty("billed_in_advance") + @ExcludeMissing + private val billedInAdvance: JsonField = JsonMissing.of(), + @JsonProperty("billing_cycle_configuration") + @ExcludeMissing + private val billingCycleConfiguration: JsonField = + JsonMissing.of(), + @JsonProperty("conversion_rate") + @ExcludeMissing + private val conversionRate: JsonField = JsonMissing.of(), + @JsonProperty("currency") + @ExcludeMissing + private val currency: JsonField = JsonMissing.of(), + @JsonProperty("external_price_id") + @ExcludeMissing + private val externalPriceId: JsonField = JsonMissing.of(), + @JsonProperty("fixed_price_quantity") + @ExcludeMissing + private val fixedPriceQuantity: JsonField = JsonMissing.of(), + @JsonProperty("invoice_grouping_key") + @ExcludeMissing + private val invoiceGroupingKey: JsonField = JsonMissing.of(), + @JsonProperty("invoicing_cycle_configuration") + @ExcludeMissing + private val invoicingCycleConfiguration: JsonField = + JsonMissing.of(), + @JsonProperty("metadata") + @ExcludeMissing + private val metadata: JsonField = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), + ) { + + /** The cadence to bill for this price on. */ + fun cadence(): Cadence = cadence.getRequired("cadence") + + /** The id of the item the plan will be associated with. */ + fun itemId(): String = itemId.getRequired("item_id") + + fun maxGroupTieredConfig(): MaxGroupTieredConfig = + maxGroupTieredConfig.getRequired("max_group_tiered_config") + + fun modelType(): ModelType = modelType.getRequired("model_type") + + /** The name of the price. */ + fun name(): String = name.getRequired("name") + + /** + * The id of the billable metric for the price. Only needed if the price is usage-based. + */ + fun billableMetricId(): Optional = + Optional.ofNullable(billableMetricId.getNullable("billable_metric_id")) + + /** + * If the Price represents a fixed cost, the price will be billed in-advance if this is + * true, and in-arrears if this is false. + */ + fun billedInAdvance(): Optional = + Optional.ofNullable(billedInAdvance.getNullable("billed_in_advance")) + + /** + * For custom cadence: specifies the duration of the billing period in days or months. + */ + fun billingCycleConfiguration(): Optional = + Optional.ofNullable( + billingCycleConfiguration.getNullable("billing_cycle_configuration") + ) + + /** The per unit conversion rate of the price currency to the invoicing currency. */ + fun conversionRate(): Optional = + Optional.ofNullable(conversionRate.getNullable("conversion_rate")) + + /** + * An ISO 4217 currency string, or custom pricing unit identifier, in which this price + * is billed. + */ + fun currency(): Optional = Optional.ofNullable(currency.getNullable("currency")) + + /** An alias for the price. */ + fun externalPriceId(): Optional = + Optional.ofNullable(externalPriceId.getNullable("external_price_id")) + + /** + * If the Price represents a fixed cost, this represents the quantity of units applied. + */ + fun fixedPriceQuantity(): Optional = + Optional.ofNullable(fixedPriceQuantity.getNullable("fixed_price_quantity")) + + /** The property used to group this price on an invoice */ + fun invoiceGroupingKey(): Optional = + Optional.ofNullable(invoiceGroupingKey.getNullable("invoice_grouping_key")) + + /** + * Within each billing cycle, specifies the cadence at which invoices are produced. If + * unspecified, a single invoice is produced per billing cycle. + */ + fun invoicingCycleConfiguration(): Optional = + Optional.ofNullable( + invoicingCycleConfiguration.getNullable("invoicing_cycle_configuration") + ) + + /** + * User-specified key/value pairs for the resource. Individual keys can be removed by + * setting the value to `null`, and the entire metadata mapping can be cleared by + * setting `metadata` to `null`. + */ + fun metadata(): Optional = + Optional.ofNullable(metadata.getNullable("metadata")) + + /** The cadence to bill for this price on. */ + @JsonProperty("cadence") @ExcludeMissing fun _cadence(): JsonField = cadence + + /** The id of the item the plan will be associated with. */ + @JsonProperty("item_id") @ExcludeMissing fun _itemId(): JsonField = itemId + + @JsonProperty("max_group_tiered_config") + @ExcludeMissing + fun _maxGroupTieredConfig(): JsonField = maxGroupTieredConfig + + @JsonProperty("model_type") + @ExcludeMissing + fun _modelType(): JsonField = modelType + + /** The name of the price. */ + @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name + + /** + * The id of the billable metric for the price. Only needed if the price is usage-based. + */ + @JsonProperty("billable_metric_id") + @ExcludeMissing + fun _billableMetricId(): JsonField = billableMetricId + + /** + * If the Price represents a fixed cost, the price will be billed in-advance if this is + * true, and in-arrears if this is false. + */ + @JsonProperty("billed_in_advance") + @ExcludeMissing + fun _billedInAdvance(): JsonField = billedInAdvance + + /** + * For custom cadence: specifies the duration of the billing period in days or months. + */ + @JsonProperty("billing_cycle_configuration") + @ExcludeMissing + fun _billingCycleConfiguration(): JsonField = + billingCycleConfiguration + + /** The per unit conversion rate of the price currency to the invoicing currency. */ + @JsonProperty("conversion_rate") + @ExcludeMissing + fun _conversionRate(): JsonField = conversionRate + + /** + * An ISO 4217 currency string, or custom pricing unit identifier, in which this price + * is billed. + */ + @JsonProperty("currency") @ExcludeMissing fun _currency(): JsonField = currency + + /** An alias for the price. */ + @JsonProperty("external_price_id") + @ExcludeMissing + fun _externalPriceId(): JsonField = externalPriceId + + /** + * If the Price represents a fixed cost, this represents the quantity of units applied. + */ + @JsonProperty("fixed_price_quantity") + @ExcludeMissing + fun _fixedPriceQuantity(): JsonField = fixedPriceQuantity + + /** The property used to group this price on an invoice */ + @JsonProperty("invoice_grouping_key") + @ExcludeMissing + fun _invoiceGroupingKey(): JsonField = invoiceGroupingKey + + /** + * Within each billing cycle, specifies the cadence at which invoices are produced. If + * unspecified, a single invoice is produced per billing cycle. + */ + @JsonProperty("invoicing_cycle_configuration") + @ExcludeMissing + fun _invoicingCycleConfiguration(): JsonField = + invoicingCycleConfiguration + + /** + * User-specified key/value pairs for the resource. Individual keys can be removed by + * setting the value to `null`, and the entire metadata mapping can be cleared by + * setting `metadata` to `null`. + */ + @JsonProperty("metadata") + @ExcludeMissing + fun _metadata(): JsonField = metadata + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + private var validated: Boolean = false + + fun validate(): NewPlanMaxGroupTieredPrice = apply { + if (validated) { + return@apply + } + + cadence() + itemId() + maxGroupTieredConfig().validate() + modelType() + name() + billableMetricId() + billedInAdvance() + billingCycleConfiguration().ifPresent { it.validate() } + conversionRate() + currency() + externalPriceId() + fixedPriceQuantity() + invoiceGroupingKey() + invoicingCycleConfiguration().ifPresent { it.validate() } + metadata().ifPresent { it.validate() } + validated = true + } + + fun toBuilder() = Builder().from(this) + + companion object { + + @JvmStatic fun builder() = Builder() + } + + class Builder { + + private var cadence: JsonField? = null + private var itemId: JsonField? = null + private var maxGroupTieredConfig: JsonField? = null + private var modelType: JsonField? = null + private var name: JsonField? = null + private var billableMetricId: JsonField = JsonMissing.of() + private var billedInAdvance: JsonField = JsonMissing.of() + private var billingCycleConfiguration: JsonField = + JsonMissing.of() + private var conversionRate: JsonField = JsonMissing.of() + private var currency: JsonField = JsonMissing.of() + private var externalPriceId: JsonField = JsonMissing.of() + private var fixedPriceQuantity: JsonField = JsonMissing.of() + private var invoiceGroupingKey: JsonField = JsonMissing.of() + private var invoicingCycleConfiguration: JsonField = + JsonMissing.of() + private var metadata: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(newPlanMaxGroupTieredPrice: NewPlanMaxGroupTieredPrice) = apply { + cadence = newPlanMaxGroupTieredPrice.cadence + itemId = newPlanMaxGroupTieredPrice.itemId + maxGroupTieredConfig = newPlanMaxGroupTieredPrice.maxGroupTieredConfig + modelType = newPlanMaxGroupTieredPrice.modelType + name = newPlanMaxGroupTieredPrice.name + billableMetricId = newPlanMaxGroupTieredPrice.billableMetricId + billedInAdvance = newPlanMaxGroupTieredPrice.billedInAdvance + billingCycleConfiguration = newPlanMaxGroupTieredPrice.billingCycleConfiguration + conversionRate = newPlanMaxGroupTieredPrice.conversionRate + currency = newPlanMaxGroupTieredPrice.currency + externalPriceId = newPlanMaxGroupTieredPrice.externalPriceId + fixedPriceQuantity = newPlanMaxGroupTieredPrice.fixedPriceQuantity + invoiceGroupingKey = newPlanMaxGroupTieredPrice.invoiceGroupingKey + invoicingCycleConfiguration = + newPlanMaxGroupTieredPrice.invoicingCycleConfiguration + metadata = newPlanMaxGroupTieredPrice.metadata + additionalProperties = + newPlanMaxGroupTieredPrice.additionalProperties.toMutableMap() + } + + /** The cadence to bill for this price on. */ + fun cadence(cadence: Cadence) = cadence(JsonField.of(cadence)) + + /** The cadence to bill for this price on. */ + fun cadence(cadence: JsonField) = apply { this.cadence = cadence } + + /** The id of the item the plan will be associated with. */ + fun itemId(itemId: String) = itemId(JsonField.of(itemId)) + + /** The id of the item the plan will be associated with. */ + fun itemId(itemId: JsonField) = apply { this.itemId = itemId } + + fun maxGroupTieredConfig(maxGroupTieredConfig: MaxGroupTieredConfig) = + maxGroupTieredConfig(JsonField.of(maxGroupTieredConfig)) + + fun maxGroupTieredConfig(maxGroupTieredConfig: JsonField) = + apply { + this.maxGroupTieredConfig = maxGroupTieredConfig + } + + fun modelType(modelType: ModelType) = modelType(JsonField.of(modelType)) + + fun modelType(modelType: JsonField) = apply { + this.modelType = modelType + } + + /** The name of the price. */ + fun name(name: String) = name(JsonField.of(name)) + + /** The name of the price. */ + fun name(name: JsonField) = apply { this.name = name } + + /** + * The id of the billable metric for the price. Only needed if the price is + * usage-based. + */ + fun billableMetricId(billableMetricId: String?) = + billableMetricId(JsonField.ofNullable(billableMetricId)) + + /** + * The id of the billable metric for the price. Only needed if the price is + * usage-based. + */ + fun billableMetricId(billableMetricId: Optional) = + billableMetricId(billableMetricId.orElse(null)) + + /** + * The id of the billable metric for the price. Only needed if the price is + * usage-based. + */ + fun billableMetricId(billableMetricId: JsonField) = apply { + this.billableMetricId = billableMetricId + } + + /** + * If the Price represents a fixed cost, the price will be billed in-advance if this + * is true, and in-arrears if this is false. + */ + fun billedInAdvance(billedInAdvance: Boolean?) = + billedInAdvance(JsonField.ofNullable(billedInAdvance)) + + /** + * If the Price represents a fixed cost, the price will be billed in-advance if this + * is true, and in-arrears if this is false. + */ + fun billedInAdvance(billedInAdvance: Boolean) = + billedInAdvance(billedInAdvance as Boolean?) + + /** + * If the Price represents a fixed cost, the price will be billed in-advance if this + * is true, and in-arrears if this is false. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun billedInAdvance(billedInAdvance: Optional) = + billedInAdvance(billedInAdvance.orElse(null) as Boolean?) + + /** + * If the Price represents a fixed cost, the price will be billed in-advance if this + * is true, and in-arrears if this is false. + */ + fun billedInAdvance(billedInAdvance: JsonField) = apply { + this.billedInAdvance = billedInAdvance + } + + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + fun billingCycleConfiguration( + billingCycleConfiguration: BillingCycleConfiguration? + ) = billingCycleConfiguration(JsonField.ofNullable(billingCycleConfiguration)) + + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + fun billingCycleConfiguration( + billingCycleConfiguration: Optional + ) = billingCycleConfiguration(billingCycleConfiguration.orElse(null)) + + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + fun billingCycleConfiguration( + billingCycleConfiguration: JsonField + ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } + + /** The per unit conversion rate of the price currency to the invoicing currency. */ + fun conversionRate(conversionRate: Double?) = + conversionRate(JsonField.ofNullable(conversionRate)) + + /** The per unit conversion rate of the price currency to the invoicing currency. */ + fun conversionRate(conversionRate: Double) = + conversionRate(conversionRate as Double?) + + /** The per unit conversion rate of the price currency to the invoicing currency. */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun conversionRate(conversionRate: Optional) = + conversionRate(conversionRate.orElse(null) as Double?) + + /** The per unit conversion rate of the price currency to the invoicing currency. */ + fun conversionRate(conversionRate: JsonField) = apply { + this.conversionRate = conversionRate + } + + /** + * An ISO 4217 currency string, or custom pricing unit identifier, in which this + * price is billed. + */ + fun currency(currency: String?) = currency(JsonField.ofNullable(currency)) + + /** + * An ISO 4217 currency string, or custom pricing unit identifier, in which this + * price is billed. + */ + fun currency(currency: Optional) = currency(currency.orElse(null)) + + /** + * An ISO 4217 currency string, or custom pricing unit identifier, in which this + * price is billed. + */ + fun currency(currency: JsonField) = apply { this.currency = currency } + + /** An alias for the price. */ + fun externalPriceId(externalPriceId: String?) = + externalPriceId(JsonField.ofNullable(externalPriceId)) + + /** An alias for the price. */ + fun externalPriceId(externalPriceId: Optional) = + externalPriceId(externalPriceId.orElse(null)) + + /** An alias for the price. */ + fun externalPriceId(externalPriceId: JsonField) = apply { + this.externalPriceId = externalPriceId + } + + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + fun fixedPriceQuantity(fixedPriceQuantity: Double?) = + fixedPriceQuantity(JsonField.ofNullable(fixedPriceQuantity)) + + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + fun fixedPriceQuantity(fixedPriceQuantity: Double) = + fixedPriceQuantity(fixedPriceQuantity as Double?) + + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun fixedPriceQuantity(fixedPriceQuantity: Optional) = + fixedPriceQuantity(fixedPriceQuantity.orElse(null) as Double?) + + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + fun fixedPriceQuantity(fixedPriceQuantity: JsonField) = apply { + this.fixedPriceQuantity = fixedPriceQuantity + } + + /** The property used to group this price on an invoice */ + fun invoiceGroupingKey(invoiceGroupingKey: String?) = + invoiceGroupingKey(JsonField.ofNullable(invoiceGroupingKey)) + + /** The property used to group this price on an invoice */ + fun invoiceGroupingKey(invoiceGroupingKey: Optional) = + invoiceGroupingKey(invoiceGroupingKey.orElse(null)) + + /** The property used to group this price on an invoice */ + fun invoiceGroupingKey(invoiceGroupingKey: JsonField) = apply { + this.invoiceGroupingKey = invoiceGroupingKey + } + + /** + * Within each billing cycle, specifies the cadence at which invoices are produced. + * If unspecified, a single invoice is produced per billing cycle. + */ + fun invoicingCycleConfiguration( + invoicingCycleConfiguration: InvoicingCycleConfiguration? + ) = invoicingCycleConfiguration(JsonField.ofNullable(invoicingCycleConfiguration)) + + /** + * Within each billing cycle, specifies the cadence at which invoices are produced. + * If unspecified, a single invoice is produced per billing cycle. + */ + fun invoicingCycleConfiguration( + invoicingCycleConfiguration: Optional + ) = invoicingCycleConfiguration(invoicingCycleConfiguration.orElse(null)) + + /** + * Within each billing cycle, specifies the cadence at which invoices are produced. + * If unspecified, a single invoice is produced per billing cycle. + */ + fun invoicingCycleConfiguration( + invoicingCycleConfiguration: JsonField + ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } + + /** + * User-specified key/value pairs for the resource. Individual keys can be removed + * by setting the value to `null`, and the entire metadata mapping can be cleared by + * setting `metadata` to `null`. + */ + fun metadata(metadata: Metadata?) = metadata(JsonField.ofNullable(metadata)) + + /** + * User-specified key/value pairs for the resource. Individual keys can be removed + * by setting the value to `null`, and the entire metadata mapping can be cleared by + * setting `metadata` to `null`. + */ + fun metadata(metadata: Optional) = metadata(metadata.orElse(null)) + + /** + * User-specified key/value pairs for the resource. Individual keys can be removed + * by setting the value to `null`, and the entire metadata mapping can be cleared by + * setting `metadata` to `null`. + */ + fun metadata(metadata: JsonField) = apply { this.metadata = metadata } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + fun build(): NewPlanMaxGroupTieredPrice = + NewPlanMaxGroupTieredPrice( + checkRequired("cadence", cadence), + checkRequired("itemId", itemId), + checkRequired("maxGroupTieredConfig", maxGroupTieredConfig), + checkRequired("modelType", modelType), + checkRequired("name", name), + billableMetricId, + billedInAdvance, + billingCycleConfiguration, + conversionRate, + currency, + externalPriceId, + fixedPriceQuantity, + invoiceGroupingKey, + invoicingCycleConfiguration, + metadata, + additionalProperties.toImmutable(), + ) + } + + class Cadence + @JsonCreator + private constructor( + private val value: JsonField, + ) : Enum { + + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + + companion object { + + @JvmField val ANNUAL = of("annual") + + @JvmField val SEMI_ANNUAL = of("semi_annual") + + @JvmField val MONTHLY = of("monthly") + + @JvmField val QUARTERLY = of("quarterly") + + @JvmField val ONE_TIME = of("one_time") + + @JvmField val CUSTOM = of("custom") + + @JvmStatic fun of(value: String) = Cadence(JsonField.of(value)) + } + + enum class Known { + ANNUAL, + SEMI_ANNUAL, + MONTHLY, + QUARTERLY, + ONE_TIME, + CUSTOM, + } + + enum class Value { + ANNUAL, + SEMI_ANNUAL, + MONTHLY, + QUARTERLY, + ONE_TIME, + CUSTOM, + _UNKNOWN, + } + + fun value(): Value = + when (this) { + ANNUAL -> Value.ANNUAL + SEMI_ANNUAL -> Value.SEMI_ANNUAL + MONTHLY -> Value.MONTHLY + QUARTERLY -> Value.QUARTERLY + ONE_TIME -> Value.ONE_TIME + CUSTOM -> Value.CUSTOM + else -> Value._UNKNOWN + } + + fun known(): Known = + when (this) { + ANNUAL -> Known.ANNUAL + SEMI_ANNUAL -> Known.SEMI_ANNUAL + MONTHLY -> Known.MONTHLY + QUARTERLY -> Known.QUARTERLY + ONE_TIME -> Known.ONE_TIME + CUSTOM -> Known.CUSTOM + else -> throw OrbInvalidDataException("Unknown Cadence: $value") + } + + fun asString(): String = _value().asStringOrThrow() + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is Cadence && value == other.value /* spotless:on */ + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + + @NoAutoDetect + class MaxGroupTieredConfig + @JsonCreator + private constructor( + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), + ) { + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + private var validated: Boolean = false + + fun validate(): MaxGroupTieredConfig = apply { + if (validated) { + return@apply + } + + validated = true + } + + fun toBuilder() = Builder().from(this) + + companion object { + + @JvmStatic fun builder() = Builder() + } + + class Builder { + + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(maxGroupTieredConfig: MaxGroupTieredConfig) = apply { + additionalProperties = + maxGroupTieredConfig.additionalProperties.toMutableMap() + } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + fun build(): MaxGroupTieredConfig = + MaxGroupTieredConfig(additionalProperties.toImmutable()) + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is MaxGroupTieredConfig && additionalProperties == other.additionalProperties /* spotless:on */ + } + + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(additionalProperties) } + /* spotless:on */ + + override fun hashCode(): Int = hashCode + + override fun toString() = + "MaxGroupTieredConfig{additionalProperties=$additionalProperties}" + } + + class ModelType + @JsonCreator + private constructor( + private val value: JsonField, + ) : Enum { + + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + + companion object { + + @JvmField val MAX_GROUP_TIERED = of("max_group_tiered") + + @JvmStatic fun of(value: String) = ModelType(JsonField.of(value)) + } + + enum class Known { + MAX_GROUP_TIERED, + } + + enum class Value { + MAX_GROUP_TIERED, + _UNKNOWN, + } + + fun value(): Value = + when (this) { + MAX_GROUP_TIERED -> Value.MAX_GROUP_TIERED + else -> Value._UNKNOWN + } + + fun known(): Known = + when (this) { + MAX_GROUP_TIERED -> Known.MAX_GROUP_TIERED + else -> throw OrbInvalidDataException("Unknown ModelType: $value") + } + + fun asString(): String = _value().asStringOrThrow() + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is ModelType && value == other.value /* spotless:on */ + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + + /** + * For custom cadence: specifies the duration of the billing period in days or months. + */ + @NoAutoDetect + class BillingCycleConfiguration + @JsonCreator + private constructor( + @JsonProperty("duration") + @ExcludeMissing + private val duration: JsonField = JsonMissing.of(), + @JsonProperty("duration_unit") + @ExcludeMissing + private val durationUnit: JsonField = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), + ) { + + /** The duration of the billing period. */ + fun duration(): Long = duration.getRequired("duration") + + /** The unit of billing period duration. */ + fun durationUnit(): DurationUnit = durationUnit.getRequired("duration_unit") + + /** The duration of the billing period. */ + @JsonProperty("duration") + @ExcludeMissing + fun _duration(): JsonField = duration + + /** The unit of billing period duration. */ + @JsonProperty("duration_unit") + @ExcludeMissing + fun _durationUnit(): JsonField = durationUnit + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + private var validated: Boolean = false + + fun validate(): BillingCycleConfiguration = apply { + if (validated) { + return@apply + } + + duration() + durationUnit() + validated = true + } + + fun toBuilder() = Builder().from(this) + + companion object { + + @JvmStatic fun builder() = Builder() + } + + class Builder { + + private var duration: JsonField? = null + private var durationUnit: JsonField? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(billingCycleConfiguration: BillingCycleConfiguration) = + apply { + duration = billingCycleConfiguration.duration + durationUnit = billingCycleConfiguration.durationUnit + additionalProperties = + billingCycleConfiguration.additionalProperties.toMutableMap() + } + + /** The duration of the billing period. */ + fun duration(duration: Long) = duration(JsonField.of(duration)) + + /** The duration of the billing period. */ + fun duration(duration: JsonField) = apply { this.duration = duration } + + /** The unit of billing period duration. */ + fun durationUnit(durationUnit: DurationUnit) = + durationUnit(JsonField.of(durationUnit)) + + /** The unit of billing period duration. */ + fun durationUnit(durationUnit: JsonField) = apply { + this.durationUnit = durationUnit + } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + fun build(): BillingCycleConfiguration = + BillingCycleConfiguration( + checkRequired("duration", duration), + checkRequired("durationUnit", durationUnit), + additionalProperties.toImmutable(), + ) + } + + class DurationUnit + @JsonCreator + private constructor( + private val value: JsonField, + ) : Enum { + + @com.fasterxml.jackson.annotation.JsonValue + fun _value(): JsonField = value + + companion object { + + @JvmField val DAY = of("day") + + @JvmField val MONTH = of("month") + + @JvmStatic fun of(value: String) = DurationUnit(JsonField.of(value)) + } + + enum class Known { + DAY, + MONTH, + } + + enum class Value { + DAY, + MONTH, + _UNKNOWN, + } + + fun value(): Value = + when (this) { + DAY -> Value.DAY + MONTH -> Value.MONTH + else -> Value._UNKNOWN + } + + fun known(): Known = + when (this) { + DAY -> Known.DAY + MONTH -> Known.MONTH + else -> throw OrbInvalidDataException("Unknown DurationUnit: $value") + } + + fun asString(): String = _value().asStringOrThrow() + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is DurationUnit && value == other.value /* spotless:on */ + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is BillingCycleConfiguration && duration == other.duration && durationUnit == other.durationUnit && additionalProperties == other.additionalProperties /* spotless:on */ + } + + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(duration, durationUnit, additionalProperties) } + /* spotless:on */ + + override fun hashCode(): Int = hashCode + + override fun toString() = + "BillingCycleConfiguration{duration=$duration, durationUnit=$durationUnit, additionalProperties=$additionalProperties}" + } + + /** + * Within each billing cycle, specifies the cadence at which invoices are produced. If + * unspecified, a single invoice is produced per billing cycle. + */ + @NoAutoDetect + class InvoicingCycleConfiguration + @JsonCreator + private constructor( + @JsonProperty("duration") + @ExcludeMissing + private val duration: JsonField = JsonMissing.of(), + @JsonProperty("duration_unit") + @ExcludeMissing + private val durationUnit: JsonField = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), + ) { + + /** The duration of the billing period. */ + fun duration(): Long = duration.getRequired("duration") + + /** The unit of billing period duration. */ + fun durationUnit(): DurationUnit = durationUnit.getRequired("duration_unit") + + /** The duration of the billing period. */ + @JsonProperty("duration") + @ExcludeMissing + fun _duration(): JsonField = duration + + /** The unit of billing period duration. */ + @JsonProperty("duration_unit") + @ExcludeMissing + fun _durationUnit(): JsonField = durationUnit + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + private var validated: Boolean = false + + fun validate(): InvoicingCycleConfiguration = apply { + if (validated) { + return@apply + } + + duration() + durationUnit() + validated = true + } + + fun toBuilder() = Builder().from(this) + + companion object { + + @JvmStatic fun builder() = Builder() + } + + class Builder { + + private var duration: JsonField? = null + private var durationUnit: JsonField? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(invoicingCycleConfiguration: InvoicingCycleConfiguration) = + apply { + duration = invoicingCycleConfiguration.duration + durationUnit = invoicingCycleConfiguration.durationUnit + additionalProperties = + invoicingCycleConfiguration.additionalProperties.toMutableMap() + } + + /** The duration of the billing period. */ + fun duration(duration: Long) = duration(JsonField.of(duration)) + + /** The duration of the billing period. */ + fun duration(duration: JsonField) = apply { this.duration = duration } + + /** The unit of billing period duration. */ + fun durationUnit(durationUnit: DurationUnit) = + durationUnit(JsonField.of(durationUnit)) + + /** The unit of billing period duration. */ + fun durationUnit(durationUnit: JsonField) = apply { + this.durationUnit = durationUnit + } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + fun build(): InvoicingCycleConfiguration = + InvoicingCycleConfiguration( + checkRequired("duration", duration), + checkRequired("durationUnit", durationUnit), + additionalProperties.toImmutable(), + ) + } + + class DurationUnit + @JsonCreator + private constructor( + private val value: JsonField, + ) : Enum { + + @com.fasterxml.jackson.annotation.JsonValue + fun _value(): JsonField = value + + companion object { + + @JvmField val DAY = of("day") + + @JvmField val MONTH = of("month") + + @JvmStatic fun of(value: String) = DurationUnit(JsonField.of(value)) + } + + enum class Known { + DAY, + MONTH, + } + + enum class Value { + DAY, + MONTH, + _UNKNOWN, + } + + fun value(): Value = + when (this) { + DAY -> Value.DAY + MONTH -> Value.MONTH + else -> Value._UNKNOWN + } + + fun known(): Known = + when (this) { + DAY -> Known.DAY + MONTH -> Known.MONTH + else -> throw OrbInvalidDataException("Unknown DurationUnit: $value") + } + + fun asString(): String = _value().asStringOrThrow() + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is DurationUnit && value == other.value /* spotless:on */ + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is InvoicingCycleConfiguration && duration == other.duration && durationUnit == other.durationUnit && additionalProperties == other.additionalProperties /* spotless:on */ + } + + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(duration, durationUnit, additionalProperties) } + /* spotless:on */ + + override fun hashCode(): Int = hashCode + + override fun toString() = + "InvoicingCycleConfiguration{duration=$duration, durationUnit=$durationUnit, additionalProperties=$additionalProperties}" + } + + /** + * User-specified key/value pairs for the resource. Individual keys can be removed by + * setting the value to `null`, and the entire metadata mapping can be cleared by + * setting `metadata` to `null`. + */ + @NoAutoDetect + class Metadata + @JsonCreator + private constructor( + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), + ) { + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + private var validated: Boolean = false + + fun validate(): Metadata = apply { + if (validated) { + return@apply + } + + validated = true + } + + fun toBuilder() = Builder().from(this) + + companion object { + + @JvmStatic fun builder() = Builder() + } + + class Builder { + + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(metadata: Metadata) = apply { + additionalProperties = metadata.additionalProperties.toMutableMap() + } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + fun build(): Metadata = Metadata(additionalProperties.toImmutable()) + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is Metadata && additionalProperties == other.additionalProperties /* spotless:on */ + } + + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(additionalProperties) } + /* spotless:on */ + + override fun hashCode(): Int = hashCode + + override fun toString() = "Metadata{additionalProperties=$additionalProperties}" + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is NewPlanMaxGroupTieredPrice && cadence == other.cadence && itemId == other.itemId && maxGroupTieredConfig == other.maxGroupTieredConfig && modelType == other.modelType && name == other.name && billableMetricId == other.billableMetricId && billedInAdvance == other.billedInAdvance && billingCycleConfiguration == other.billingCycleConfiguration && conversionRate == other.conversionRate && currency == other.currency && externalPriceId == other.externalPriceId && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && invoicingCycleConfiguration == other.invoicingCycleConfiguration && metadata == other.metadata && additionalProperties == other.additionalProperties /* spotless:on */ + } + + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(cadence, itemId, maxGroupTieredConfig, modelType, name, billableMetricId, billedInAdvance, billingCycleConfiguration, conversionRate, currency, externalPriceId, fixedPriceQuantity, invoiceGroupingKey, invoicingCycleConfiguration, metadata, additionalProperties) } + /* spotless:on */ + + override fun hashCode(): Int = hashCode + + override fun toString() = + "NewPlanMaxGroupTieredPrice{cadence=$cadence, itemId=$itemId, maxGroupTieredConfig=$maxGroupTieredConfig, modelType=$modelType, name=$name, billableMetricId=$billableMetricId, billedInAdvance=$billedInAdvance, billingCycleConfiguration=$billingCycleConfiguration, conversionRate=$conversionRate, currency=$currency, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, invoicingCycleConfiguration=$invoicingCycleConfiguration, metadata=$metadata, additionalProperties=$additionalProperties}" + } } /** diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/Price.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/Price.kt index cf9ea3ff..6017afd2 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/Price.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/Price.kt @@ -283,6 +283,7 @@ private constructor( private val matrixWithDisplayNamePrice: MatrixWithDisplayNamePrice? = null, private val bulkWithProrationPrice: BulkWithProrationPrice? = null, private val groupedTieredPackagePrice: GroupedTieredPackagePrice? = null, + private val maxGroupTieredPrice: MaxGroupTieredPrice? = null, private val _json: JsonValue? = null, ) { @@ -348,6 +349,9 @@ private constructor( fun groupedTieredPackagePrice(): Optional = Optional.ofNullable(groupedTieredPackagePrice) + fun maxGroupTieredPrice(): Optional = + Optional.ofNullable(maxGroupTieredPrice) + fun isUnitPrice(): Boolean = unitPrice != null fun isPackagePrice(): Boolean = packagePrice != null @@ -396,6 +400,8 @@ private constructor( fun isGroupedTieredPackagePrice(): Boolean = groupedTieredPackagePrice != null + fun isMaxGroupTieredPrice(): Boolean = maxGroupTieredPrice != null + fun asUnitPrice(): UnitPrice = unitPrice.getOrThrow("unitPrice") fun asPackagePrice(): PackagePrice = packagePrice.getOrThrow("packagePrice") @@ -460,6 +466,9 @@ private constructor( fun asGroupedTieredPackagePrice(): GroupedTieredPackagePrice = groupedTieredPackagePrice.getOrThrow("groupedTieredPackagePrice") + fun asMaxGroupTieredPrice(): MaxGroupTieredPrice = + maxGroupTieredPrice.getOrThrow("maxGroupTieredPrice") + fun _json(): Optional = Optional.ofNullable(_json) fun accept(visitor: Visitor): T { @@ -501,6 +510,7 @@ private constructor( visitor.visitBulkWithProrationPrice(bulkWithProrationPrice) groupedTieredPackagePrice != null -> visitor.visitGroupedTieredPackagePrice(groupedTieredPackagePrice) + maxGroupTieredPrice != null -> visitor.visitMaxGroupTieredPrice(maxGroupTieredPrice) else -> visitor.unknown(_json) } } @@ -635,6 +645,10 @@ private constructor( ) { groupedTieredPackagePrice.validate() } + + override fun visitMaxGroupTieredPrice(maxGroupTieredPrice: MaxGroupTieredPrice) { + maxGroupTieredPrice.validate() + } } ) validated = true @@ -645,10 +659,10 @@ private constructor( return true } - return /* spotless:off */ other is Price && unitPrice == other.unitPrice && packagePrice == other.packagePrice && matrixPrice == other.matrixPrice && tieredPrice == other.tieredPrice && tieredBpsPrice == other.tieredBpsPrice && bpsPrice == other.bpsPrice && bulkBpsPrice == other.bulkBpsPrice && bulkPrice == other.bulkPrice && thresholdTotalAmountPrice == other.thresholdTotalAmountPrice && tieredPackagePrice == other.tieredPackagePrice && groupedTieredPrice == other.groupedTieredPrice && tieredWithMinimumPrice == other.tieredWithMinimumPrice && tieredPackageWithMinimumPrice == other.tieredPackageWithMinimumPrice && packageWithAllocationPrice == other.packageWithAllocationPrice && unitWithPercentPrice == other.unitWithPercentPrice && matrixWithAllocationPrice == other.matrixWithAllocationPrice && tieredWithProrationPrice == other.tieredWithProrationPrice && unitWithProrationPrice == other.unitWithProrationPrice && groupedAllocationPrice == other.groupedAllocationPrice && groupedWithProratedMinimumPrice == other.groupedWithProratedMinimumPrice && groupedWithMeteredMinimumPrice == other.groupedWithMeteredMinimumPrice && matrixWithDisplayNamePrice == other.matrixWithDisplayNamePrice && bulkWithProrationPrice == other.bulkWithProrationPrice && groupedTieredPackagePrice == other.groupedTieredPackagePrice /* spotless:on */ + return /* spotless:off */ other is Price && unitPrice == other.unitPrice && packagePrice == other.packagePrice && matrixPrice == other.matrixPrice && tieredPrice == other.tieredPrice && tieredBpsPrice == other.tieredBpsPrice && bpsPrice == other.bpsPrice && bulkBpsPrice == other.bulkBpsPrice && bulkPrice == other.bulkPrice && thresholdTotalAmountPrice == other.thresholdTotalAmountPrice && tieredPackagePrice == other.tieredPackagePrice && groupedTieredPrice == other.groupedTieredPrice && tieredWithMinimumPrice == other.tieredWithMinimumPrice && tieredPackageWithMinimumPrice == other.tieredPackageWithMinimumPrice && packageWithAllocationPrice == other.packageWithAllocationPrice && unitWithPercentPrice == other.unitWithPercentPrice && matrixWithAllocationPrice == other.matrixWithAllocationPrice && tieredWithProrationPrice == other.tieredWithProrationPrice && unitWithProrationPrice == other.unitWithProrationPrice && groupedAllocationPrice == other.groupedAllocationPrice && groupedWithProratedMinimumPrice == other.groupedWithProratedMinimumPrice && groupedWithMeteredMinimumPrice == other.groupedWithMeteredMinimumPrice && matrixWithDisplayNamePrice == other.matrixWithDisplayNamePrice && bulkWithProrationPrice == other.bulkWithProrationPrice && groupedTieredPackagePrice == other.groupedTieredPackagePrice && maxGroupTieredPrice == other.maxGroupTieredPrice /* spotless:on */ } - override fun hashCode(): Int = /* spotless:off */ Objects.hash(unitPrice, packagePrice, matrixPrice, tieredPrice, tieredBpsPrice, bpsPrice, bulkBpsPrice, bulkPrice, thresholdTotalAmountPrice, tieredPackagePrice, groupedTieredPrice, tieredWithMinimumPrice, tieredPackageWithMinimumPrice, packageWithAllocationPrice, unitWithPercentPrice, matrixWithAllocationPrice, tieredWithProrationPrice, unitWithProrationPrice, groupedAllocationPrice, groupedWithProratedMinimumPrice, groupedWithMeteredMinimumPrice, matrixWithDisplayNamePrice, bulkWithProrationPrice, groupedTieredPackagePrice) /* spotless:on */ + override fun hashCode(): Int = /* spotless:off */ Objects.hash(unitPrice, packagePrice, matrixPrice, tieredPrice, tieredBpsPrice, bpsPrice, bulkBpsPrice, bulkPrice, thresholdTotalAmountPrice, tieredPackagePrice, groupedTieredPrice, tieredWithMinimumPrice, tieredPackageWithMinimumPrice, packageWithAllocationPrice, unitWithPercentPrice, matrixWithAllocationPrice, tieredWithProrationPrice, unitWithProrationPrice, groupedAllocationPrice, groupedWithProratedMinimumPrice, groupedWithMeteredMinimumPrice, matrixWithDisplayNamePrice, bulkWithProrationPrice, groupedTieredPackagePrice, maxGroupTieredPrice) /* spotless:on */ override fun toString(): String = when { @@ -689,6 +703,7 @@ private constructor( "Price{bulkWithProrationPrice=$bulkWithProrationPrice}" groupedTieredPackagePrice != null -> "Price{groupedTieredPackagePrice=$groupedTieredPackagePrice}" + maxGroupTieredPrice != null -> "Price{maxGroupTieredPrice=$maxGroupTieredPrice}" _json != null -> "Price{_unknown=$_json}" else -> throw IllegalStateException("Invalid Price") } @@ -781,6 +796,10 @@ private constructor( @JvmStatic fun ofGroupedTieredPackagePrice(groupedTieredPackagePrice: GroupedTieredPackagePrice) = Price(groupedTieredPackagePrice = groupedTieredPackagePrice) + + @JvmStatic + fun ofMaxGroupTieredPrice(maxGroupTieredPrice: MaxGroupTieredPrice) = + Price(maxGroupTieredPrice = maxGroupTieredPrice) } interface Visitor { @@ -843,6 +862,8 @@ private constructor( fun visitGroupedTieredPackagePrice(groupedTieredPackagePrice: GroupedTieredPackagePrice): T + fun visitMaxGroupTieredPrice(maxGroupTieredPrice: MaxGroupTieredPrice): T + fun unknown(json: JsonValue?): T { throw OrbInvalidDataException("Unknown Price: $json") } @@ -1017,6 +1038,12 @@ private constructor( return Price(groupedTieredPackagePrice = it, _json = json) } } + "max_group_tiered" -> { + tryDeserialize(node, jacksonTypeRef()) { it.validate() } + ?.let { + return Price(maxGroupTieredPrice = it, _json = json) + } + } } return Price(_json = json) @@ -1069,6 +1096,8 @@ private constructor( generator.writeObject(value.bulkWithProrationPrice) value.groupedTieredPackagePrice != null -> generator.writeObject(value.groupedTieredPackagePrice) + value.maxGroupTieredPrice != null -> + generator.writeObject(value.maxGroupTieredPrice) value._json != null -> generator.writeObject(value._json) else -> throw IllegalStateException("Invalid Price") } @@ -33611,14 +33640,2072 @@ private constructor( keys.forEach(::removeAdditionalProperty) } - fun build(): Minimum = - Minimum( - checkRequired("appliesToPriceIds", appliesToPriceIds).map { - it.toImmutable() - }, - checkRequired("minimumAmount", minimumAmount), - additionalProperties.toImmutable(), - ) + fun build(): Minimum = + Minimum( + checkRequired("appliesToPriceIds", appliesToPriceIds).map { + it.toImmutable() + }, + checkRequired("minimumAmount", minimumAmount), + additionalProperties.toImmutable(), + ) + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is Minimum && appliesToPriceIds == other.appliesToPriceIds && minimumAmount == other.minimumAmount && additionalProperties == other.additionalProperties /* spotless:on */ + } + + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(appliesToPriceIds, minimumAmount, additionalProperties) } + /* spotless:on */ + + override fun hashCode(): Int = hashCode + + override fun toString() = + "Minimum{appliesToPriceIds=$appliesToPriceIds, minimumAmount=$minimumAmount, additionalProperties=$additionalProperties}" + } + + class ModelType + @JsonCreator + private constructor( + private val value: JsonField, + ) : Enum { + + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + + companion object { + + @JvmField val MATRIX_WITH_ALLOCATION = of("matrix_with_allocation") + + @JvmStatic fun of(value: String) = ModelType(JsonField.of(value)) + } + + enum class Known { + MATRIX_WITH_ALLOCATION, + } + + enum class Value { + MATRIX_WITH_ALLOCATION, + _UNKNOWN, + } + + fun value(): Value = + when (this) { + MATRIX_WITH_ALLOCATION -> Value.MATRIX_WITH_ALLOCATION + else -> Value._UNKNOWN + } + + fun known(): Known = + when (this) { + MATRIX_WITH_ALLOCATION -> Known.MATRIX_WITH_ALLOCATION + else -> throw OrbInvalidDataException("Unknown ModelType: $value") + } + + fun asString(): String = _value().asStringOrThrow() + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is ModelType && value == other.value /* spotless:on */ + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + + class PriceType + @JsonCreator + private constructor( + private val value: JsonField, + ) : Enum { + + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + + companion object { + + @JvmField val USAGE_PRICE = of("usage_price") + + @JvmField val FIXED_PRICE = of("fixed_price") + + @JvmStatic fun of(value: String) = PriceType(JsonField.of(value)) + } + + enum class Known { + USAGE_PRICE, + FIXED_PRICE, + } + + enum class Value { + USAGE_PRICE, + FIXED_PRICE, + _UNKNOWN, + } + + fun value(): Value = + when (this) { + USAGE_PRICE -> Value.USAGE_PRICE + FIXED_PRICE -> Value.FIXED_PRICE + else -> Value._UNKNOWN + } + + fun known(): Known = + when (this) { + USAGE_PRICE -> Known.USAGE_PRICE + FIXED_PRICE -> Known.FIXED_PRICE + else -> throw OrbInvalidDataException("Unknown PriceType: $value") + } + + fun asString(): String = _value().asStringOrThrow() + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is PriceType && value == other.value /* spotless:on */ + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is MatrixWithAllocationPrice && id == other.id && billableMetric == other.billableMetric && billingCycleConfiguration == other.billingCycleConfiguration && cadence == other.cadence && conversionRate == other.conversionRate && createdAt == other.createdAt && creditAllocation == other.creditAllocation && currency == other.currency && discount == other.discount && externalPriceId == other.externalPriceId && fixedPriceQuantity == other.fixedPriceQuantity && invoicingCycleConfiguration == other.invoicingCycleConfiguration && item == other.item && matrixWithAllocationConfig == other.matrixWithAllocationConfig && maximum == other.maximum && maximumAmount == other.maximumAmount && metadata == other.metadata && minimum == other.minimum && minimumAmount == other.minimumAmount && modelType == other.modelType && name == other.name && planPhaseOrder == other.planPhaseOrder && priceType == other.priceType && additionalProperties == other.additionalProperties /* spotless:on */ + } + + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(id, billableMetric, billingCycleConfiguration, cadence, conversionRate, createdAt, creditAllocation, currency, discount, externalPriceId, fixedPriceQuantity, invoicingCycleConfiguration, item, matrixWithAllocationConfig, maximum, maximumAmount, metadata, minimum, minimumAmount, modelType, name, planPhaseOrder, priceType, additionalProperties) } + /* spotless:on */ + + override fun hashCode(): Int = hashCode + + override fun toString() = + "MatrixWithAllocationPrice{id=$id, billableMetric=$billableMetric, billingCycleConfiguration=$billingCycleConfiguration, cadence=$cadence, conversionRate=$conversionRate, createdAt=$createdAt, creditAllocation=$creditAllocation, currency=$currency, discount=$discount, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoicingCycleConfiguration=$invoicingCycleConfiguration, item=$item, matrixWithAllocationConfig=$matrixWithAllocationConfig, maximum=$maximum, maximumAmount=$maximumAmount, metadata=$metadata, minimum=$minimum, minimumAmount=$minimumAmount, modelType=$modelType, name=$name, planPhaseOrder=$planPhaseOrder, priceType=$priceType, additionalProperties=$additionalProperties}" + } + + @NoAutoDetect + class TieredWithProrationPrice + @JsonCreator + private constructor( + @JsonProperty("id") @ExcludeMissing private val id: JsonField = JsonMissing.of(), + @JsonProperty("billable_metric") + @ExcludeMissing + private val billableMetric: JsonField = JsonMissing.of(), + @JsonProperty("billing_cycle_configuration") + @ExcludeMissing + private val billingCycleConfiguration: JsonField = + JsonMissing.of(), + @JsonProperty("cadence") + @ExcludeMissing + private val cadence: JsonField = JsonMissing.of(), + @JsonProperty("conversion_rate") + @ExcludeMissing + private val conversionRate: JsonField = JsonMissing.of(), + @JsonProperty("created_at") + @ExcludeMissing + private val createdAt: JsonField = JsonMissing.of(), + @JsonProperty("credit_allocation") + @ExcludeMissing + private val creditAllocation: JsonField = JsonMissing.of(), + @JsonProperty("currency") + @ExcludeMissing + private val currency: JsonField = JsonMissing.of(), + @JsonProperty("discount") + @ExcludeMissing + private val discount: JsonField = JsonMissing.of(), + @JsonProperty("external_price_id") + @ExcludeMissing + private val externalPriceId: JsonField = JsonMissing.of(), + @JsonProperty("fixed_price_quantity") + @ExcludeMissing + private val fixedPriceQuantity: JsonField = JsonMissing.of(), + @JsonProperty("invoicing_cycle_configuration") + @ExcludeMissing + private val invoicingCycleConfiguration: JsonField = + JsonMissing.of(), + @JsonProperty("item") @ExcludeMissing private val item: JsonField = JsonMissing.of(), + @JsonProperty("maximum") + @ExcludeMissing + private val maximum: JsonField = JsonMissing.of(), + @JsonProperty("maximum_amount") + @ExcludeMissing + private val maximumAmount: JsonField = JsonMissing.of(), + @JsonProperty("metadata") + @ExcludeMissing + private val metadata: JsonField = JsonMissing.of(), + @JsonProperty("minimum") + @ExcludeMissing + private val minimum: JsonField = JsonMissing.of(), + @JsonProperty("minimum_amount") + @ExcludeMissing + private val minimumAmount: JsonField = JsonMissing.of(), + @JsonProperty("model_type") + @ExcludeMissing + private val modelType: JsonField = JsonMissing.of(), + @JsonProperty("name") + @ExcludeMissing + private val name: JsonField = JsonMissing.of(), + @JsonProperty("plan_phase_order") + @ExcludeMissing + private val planPhaseOrder: JsonField = JsonMissing.of(), + @JsonProperty("price_type") + @ExcludeMissing + private val priceType: JsonField = JsonMissing.of(), + @JsonProperty("tiered_with_proration_config") + @ExcludeMissing + private val tieredWithProrationConfig: JsonField = + JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), + ) { + + fun id(): String = id.getRequired("id") + + fun billableMetric(): Optional = + Optional.ofNullable(billableMetric.getNullable("billable_metric")) + + fun billingCycleConfiguration(): BillingCycleConfiguration = + billingCycleConfiguration.getRequired("billing_cycle_configuration") + + fun cadence(): Cadence = cadence.getRequired("cadence") + + fun conversionRate(): Optional = + Optional.ofNullable(conversionRate.getNullable("conversion_rate")) + + fun createdAt(): OffsetDateTime = createdAt.getRequired("created_at") + + fun creditAllocation(): Optional = + Optional.ofNullable(creditAllocation.getNullable("credit_allocation")) + + fun currency(): String = currency.getRequired("currency") + + fun discount(): Optional = Optional.ofNullable(discount.getNullable("discount")) + + fun externalPriceId(): Optional = + Optional.ofNullable(externalPriceId.getNullable("external_price_id")) + + fun fixedPriceQuantity(): Optional = + Optional.ofNullable(fixedPriceQuantity.getNullable("fixed_price_quantity")) + + fun invoicingCycleConfiguration(): Optional = + Optional.ofNullable( + invoicingCycleConfiguration.getNullable("invoicing_cycle_configuration") + ) + + fun item(): Item = item.getRequired("item") + + fun maximum(): Optional = Optional.ofNullable(maximum.getNullable("maximum")) + + fun maximumAmount(): Optional = + Optional.ofNullable(maximumAmount.getNullable("maximum_amount")) + + /** + * User specified key-value pairs for the resource. If not present, this defaults to an + * empty dictionary. Individual keys can be removed by setting the value to `null`, and the + * entire metadata mapping can be cleared by setting `metadata` to `null`. + */ + fun metadata(): Metadata = metadata.getRequired("metadata") + + fun minimum(): Optional = Optional.ofNullable(minimum.getNullable("minimum")) + + fun minimumAmount(): Optional = + Optional.ofNullable(minimumAmount.getNullable("minimum_amount")) + + fun modelType(): ModelType = modelType.getRequired("model_type") + + fun name(): String = name.getRequired("name") + + fun planPhaseOrder(): Optional = + Optional.ofNullable(planPhaseOrder.getNullable("plan_phase_order")) + + fun priceType(): PriceType = priceType.getRequired("price_type") + + fun tieredWithProrationConfig(): TieredWithProrationConfig = + tieredWithProrationConfig.getRequired("tiered_with_proration_config") + + @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id + + @JsonProperty("billable_metric") + @ExcludeMissing + fun _billableMetric(): JsonField = billableMetric + + @JsonProperty("billing_cycle_configuration") + @ExcludeMissing + fun _billingCycleConfiguration(): JsonField = + billingCycleConfiguration + + @JsonProperty("cadence") @ExcludeMissing fun _cadence(): JsonField = cadence + + @JsonProperty("conversion_rate") + @ExcludeMissing + fun _conversionRate(): JsonField = conversionRate + + @JsonProperty("created_at") + @ExcludeMissing + fun _createdAt(): JsonField = createdAt + + @JsonProperty("credit_allocation") + @ExcludeMissing + fun _creditAllocation(): JsonField = creditAllocation + + @JsonProperty("currency") @ExcludeMissing fun _currency(): JsonField = currency + + @JsonProperty("discount") @ExcludeMissing fun _discount(): JsonField = discount + + @JsonProperty("external_price_id") + @ExcludeMissing + fun _externalPriceId(): JsonField = externalPriceId + + @JsonProperty("fixed_price_quantity") + @ExcludeMissing + fun _fixedPriceQuantity(): JsonField = fixedPriceQuantity + + @JsonProperty("invoicing_cycle_configuration") + @ExcludeMissing + fun _invoicingCycleConfiguration(): JsonField = + invoicingCycleConfiguration + + @JsonProperty("item") @ExcludeMissing fun _item(): JsonField = item + + @JsonProperty("maximum") @ExcludeMissing fun _maximum(): JsonField = maximum + + @JsonProperty("maximum_amount") + @ExcludeMissing + fun _maximumAmount(): JsonField = maximumAmount + + /** + * User specified key-value pairs for the resource. If not present, this defaults to an + * empty dictionary. Individual keys can be removed by setting the value to `null`, and the + * entire metadata mapping can be cleared by setting `metadata` to `null`. + */ + @JsonProperty("metadata") @ExcludeMissing fun _metadata(): JsonField = metadata + + @JsonProperty("minimum") @ExcludeMissing fun _minimum(): JsonField = minimum + + @JsonProperty("minimum_amount") + @ExcludeMissing + fun _minimumAmount(): JsonField = minimumAmount + + @JsonProperty("model_type") + @ExcludeMissing + fun _modelType(): JsonField = modelType + + @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name + + @JsonProperty("plan_phase_order") + @ExcludeMissing + fun _planPhaseOrder(): JsonField = planPhaseOrder + + @JsonProperty("price_type") + @ExcludeMissing + fun _priceType(): JsonField = priceType + + @JsonProperty("tiered_with_proration_config") + @ExcludeMissing + fun _tieredWithProrationConfig(): JsonField = + tieredWithProrationConfig + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + private var validated: Boolean = false + + fun validate(): TieredWithProrationPrice = apply { + if (validated) { + return@apply + } + + id() + billableMetric().ifPresent { it.validate() } + billingCycleConfiguration().validate() + cadence() + conversionRate() + createdAt() + creditAllocation().ifPresent { it.validate() } + currency() + discount().ifPresent { it.validate() } + externalPriceId() + fixedPriceQuantity() + invoicingCycleConfiguration().ifPresent { it.validate() } + item().validate() + maximum().ifPresent { it.validate() } + maximumAmount() + metadata().validate() + minimum().ifPresent { it.validate() } + minimumAmount() + modelType() + name() + planPhaseOrder() + priceType() + tieredWithProrationConfig().validate() + validated = true + } + + fun toBuilder() = Builder().from(this) + + companion object { + + @JvmStatic fun builder() = Builder() + } + + class Builder { + + private var id: JsonField? = null + private var billableMetric: JsonField? = null + private var billingCycleConfiguration: JsonField? = null + private var cadence: JsonField? = null + private var conversionRate: JsonField? = null + private var createdAt: JsonField? = null + private var creditAllocation: JsonField? = null + private var currency: JsonField? = null + private var discount: JsonField? = null + private var externalPriceId: JsonField? = null + private var fixedPriceQuantity: JsonField? = null + private var invoicingCycleConfiguration: JsonField? = null + private var item: JsonField? = null + private var maximum: JsonField? = null + private var maximumAmount: JsonField? = null + private var metadata: JsonField? = null + private var minimum: JsonField? = null + private var minimumAmount: JsonField? = null + private var modelType: JsonField? = null + private var name: JsonField? = null + private var planPhaseOrder: JsonField? = null + private var priceType: JsonField? = null + private var tieredWithProrationConfig: JsonField? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(tieredWithProrationPrice: TieredWithProrationPrice) = apply { + id = tieredWithProrationPrice.id + billableMetric = tieredWithProrationPrice.billableMetric + billingCycleConfiguration = tieredWithProrationPrice.billingCycleConfiguration + cadence = tieredWithProrationPrice.cadence + conversionRate = tieredWithProrationPrice.conversionRate + createdAt = tieredWithProrationPrice.createdAt + creditAllocation = tieredWithProrationPrice.creditAllocation + currency = tieredWithProrationPrice.currency + discount = tieredWithProrationPrice.discount + externalPriceId = tieredWithProrationPrice.externalPriceId + fixedPriceQuantity = tieredWithProrationPrice.fixedPriceQuantity + invoicingCycleConfiguration = tieredWithProrationPrice.invoicingCycleConfiguration + item = tieredWithProrationPrice.item + maximum = tieredWithProrationPrice.maximum + maximumAmount = tieredWithProrationPrice.maximumAmount + metadata = tieredWithProrationPrice.metadata + minimum = tieredWithProrationPrice.minimum + minimumAmount = tieredWithProrationPrice.minimumAmount + modelType = tieredWithProrationPrice.modelType + name = tieredWithProrationPrice.name + planPhaseOrder = tieredWithProrationPrice.planPhaseOrder + priceType = tieredWithProrationPrice.priceType + tieredWithProrationConfig = tieredWithProrationPrice.tieredWithProrationConfig + additionalProperties = tieredWithProrationPrice.additionalProperties.toMutableMap() + } + + fun id(id: String) = id(JsonField.of(id)) + + fun id(id: JsonField) = apply { this.id = id } + + fun billableMetric(billableMetric: BillableMetric?) = + billableMetric(JsonField.ofNullable(billableMetric)) + + fun billableMetric(billableMetric: Optional) = + billableMetric(billableMetric.orElse(null)) + + fun billableMetric(billableMetric: JsonField) = apply { + this.billableMetric = billableMetric + } + + fun billingCycleConfiguration(billingCycleConfiguration: BillingCycleConfiguration) = + billingCycleConfiguration(JsonField.of(billingCycleConfiguration)) + + fun billingCycleConfiguration( + billingCycleConfiguration: JsonField + ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } + + fun cadence(cadence: Cadence) = cadence(JsonField.of(cadence)) + + fun cadence(cadence: JsonField) = apply { this.cadence = cadence } + + fun conversionRate(conversionRate: Double?) = + conversionRate(JsonField.ofNullable(conversionRate)) + + fun conversionRate(conversionRate: Double) = conversionRate(conversionRate as Double?) + + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun conversionRate(conversionRate: Optional) = + conversionRate(conversionRate.orElse(null) as Double?) + + fun conversionRate(conversionRate: JsonField) = apply { + this.conversionRate = conversionRate + } + + fun createdAt(createdAt: OffsetDateTime) = createdAt(JsonField.of(createdAt)) + + fun createdAt(createdAt: JsonField) = apply { + this.createdAt = createdAt + } + + fun creditAllocation(creditAllocation: CreditAllocation?) = + creditAllocation(JsonField.ofNullable(creditAllocation)) + + fun creditAllocation(creditAllocation: Optional) = + creditAllocation(creditAllocation.orElse(null)) + + fun creditAllocation(creditAllocation: JsonField) = apply { + this.creditAllocation = creditAllocation + } + + fun currency(currency: String) = currency(JsonField.of(currency)) + + fun currency(currency: JsonField) = apply { this.currency = currency } + + fun discount(discount: Discount?) = discount(JsonField.ofNullable(discount)) + + fun discount(discount: Optional) = discount(discount.orElse(null)) + + fun discount(discount: JsonField) = apply { this.discount = discount } + + fun discount(percentageDiscount: PercentageDiscount) = + discount(Discount.ofPercentageDiscount(percentageDiscount)) + + fun discount(trialDiscount: TrialDiscount) = + discount(Discount.ofTrialDiscount(trialDiscount)) + + fun discount(usageDiscount: Discount.UsageDiscount) = + discount(Discount.ofUsageDiscount(usageDiscount)) + + fun discount(amountDiscount: AmountDiscount) = + discount(Discount.ofAmountDiscount(amountDiscount)) + + fun externalPriceId(externalPriceId: String?) = + externalPriceId(JsonField.ofNullable(externalPriceId)) + + fun externalPriceId(externalPriceId: Optional) = + externalPriceId(externalPriceId.orElse(null)) + + fun externalPriceId(externalPriceId: JsonField) = apply { + this.externalPriceId = externalPriceId + } + + fun fixedPriceQuantity(fixedPriceQuantity: Double?) = + fixedPriceQuantity(JsonField.ofNullable(fixedPriceQuantity)) + + fun fixedPriceQuantity(fixedPriceQuantity: Double) = + fixedPriceQuantity(fixedPriceQuantity as Double?) + + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun fixedPriceQuantity(fixedPriceQuantity: Optional) = + fixedPriceQuantity(fixedPriceQuantity.orElse(null) as Double?) + + fun fixedPriceQuantity(fixedPriceQuantity: JsonField) = apply { + this.fixedPriceQuantity = fixedPriceQuantity + } + + fun invoicingCycleConfiguration( + invoicingCycleConfiguration: InvoicingCycleConfiguration? + ) = invoicingCycleConfiguration(JsonField.ofNullable(invoicingCycleConfiguration)) + + fun invoicingCycleConfiguration( + invoicingCycleConfiguration: Optional + ) = invoicingCycleConfiguration(invoicingCycleConfiguration.orElse(null)) + + fun invoicingCycleConfiguration( + invoicingCycleConfiguration: JsonField + ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } + + fun item(item: Item) = item(JsonField.of(item)) + + fun item(item: JsonField) = apply { this.item = item } + + fun maximum(maximum: Maximum?) = maximum(JsonField.ofNullable(maximum)) + + fun maximum(maximum: Optional) = maximum(maximum.orElse(null)) + + fun maximum(maximum: JsonField) = apply { this.maximum = maximum } + + fun maximumAmount(maximumAmount: String?) = + maximumAmount(JsonField.ofNullable(maximumAmount)) + + fun maximumAmount(maximumAmount: Optional) = + maximumAmount(maximumAmount.orElse(null)) + + fun maximumAmount(maximumAmount: JsonField) = apply { + this.maximumAmount = maximumAmount + } + + /** + * User specified key-value pairs for the resource. If not present, this defaults to an + * empty dictionary. Individual keys can be removed by setting the value to `null`, and + * the entire metadata mapping can be cleared by setting `metadata` to `null`. + */ + fun metadata(metadata: Metadata) = metadata(JsonField.of(metadata)) + + /** + * User specified key-value pairs for the resource. If not present, this defaults to an + * empty dictionary. Individual keys can be removed by setting the value to `null`, and + * the entire metadata mapping can be cleared by setting `metadata` to `null`. + */ + fun metadata(metadata: JsonField) = apply { this.metadata = metadata } + + fun minimum(minimum: Minimum?) = minimum(JsonField.ofNullable(minimum)) + + fun minimum(minimum: Optional) = minimum(minimum.orElse(null)) + + fun minimum(minimum: JsonField) = apply { this.minimum = minimum } + + fun minimumAmount(minimumAmount: String?) = + minimumAmount(JsonField.ofNullable(minimumAmount)) + + fun minimumAmount(minimumAmount: Optional) = + minimumAmount(minimumAmount.orElse(null)) + + fun minimumAmount(minimumAmount: JsonField) = apply { + this.minimumAmount = minimumAmount + } + + fun modelType(modelType: ModelType) = modelType(JsonField.of(modelType)) + + fun modelType(modelType: JsonField) = apply { this.modelType = modelType } + + fun name(name: String) = name(JsonField.of(name)) + + fun name(name: JsonField) = apply { this.name = name } + + fun planPhaseOrder(planPhaseOrder: Long?) = + planPhaseOrder(JsonField.ofNullable(planPhaseOrder)) + + fun planPhaseOrder(planPhaseOrder: Long) = planPhaseOrder(planPhaseOrder as Long?) + + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun planPhaseOrder(planPhaseOrder: Optional) = + planPhaseOrder(planPhaseOrder.orElse(null) as Long?) + + fun planPhaseOrder(planPhaseOrder: JsonField) = apply { + this.planPhaseOrder = planPhaseOrder + } + + fun priceType(priceType: PriceType) = priceType(JsonField.of(priceType)) + + fun priceType(priceType: JsonField) = apply { this.priceType = priceType } + + fun tieredWithProrationConfig(tieredWithProrationConfig: TieredWithProrationConfig) = + tieredWithProrationConfig(JsonField.of(tieredWithProrationConfig)) + + fun tieredWithProrationConfig( + tieredWithProrationConfig: JsonField + ) = apply { this.tieredWithProrationConfig = tieredWithProrationConfig } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + fun build(): TieredWithProrationPrice = + TieredWithProrationPrice( + checkRequired("id", id), + checkRequired("billableMetric", billableMetric), + checkRequired("billingCycleConfiguration", billingCycleConfiguration), + checkRequired("cadence", cadence), + checkRequired("conversionRate", conversionRate), + checkRequired("createdAt", createdAt), + checkRequired("creditAllocation", creditAllocation), + checkRequired("currency", currency), + checkRequired("discount", discount), + checkRequired("externalPriceId", externalPriceId), + checkRequired("fixedPriceQuantity", fixedPriceQuantity), + checkRequired("invoicingCycleConfiguration", invoicingCycleConfiguration), + checkRequired("item", item), + checkRequired("maximum", maximum), + checkRequired("maximumAmount", maximumAmount), + checkRequired("metadata", metadata), + checkRequired("minimum", minimum), + checkRequired("minimumAmount", minimumAmount), + checkRequired("modelType", modelType), + checkRequired("name", name), + checkRequired("planPhaseOrder", planPhaseOrder), + checkRequired("priceType", priceType), + checkRequired("tieredWithProrationConfig", tieredWithProrationConfig), + additionalProperties.toImmutable(), + ) + } + + @NoAutoDetect + class BillableMetric + @JsonCreator + private constructor( + @JsonProperty("id") + @ExcludeMissing + private val id: JsonField = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), + ) { + + fun id(): String = id.getRequired("id") + + @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + private var validated: Boolean = false + + fun validate(): BillableMetric = apply { + if (validated) { + return@apply + } + + id() + validated = true + } + + fun toBuilder() = Builder().from(this) + + companion object { + + @JvmStatic fun builder() = Builder() + } + + class Builder { + + private var id: JsonField? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(billableMetric: BillableMetric) = apply { + id = billableMetric.id + additionalProperties = billableMetric.additionalProperties.toMutableMap() + } + + fun id(id: String) = id(JsonField.of(id)) + + fun id(id: JsonField) = apply { this.id = id } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + fun build(): BillableMetric = + BillableMetric(checkRequired("id", id), additionalProperties.toImmutable()) + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is BillableMetric && id == other.id && additionalProperties == other.additionalProperties /* spotless:on */ + } + + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(id, additionalProperties) } + /* spotless:on */ + + override fun hashCode(): Int = hashCode + + override fun toString() = + "BillableMetric{id=$id, additionalProperties=$additionalProperties}" + } + + @NoAutoDetect + class BillingCycleConfiguration + @JsonCreator + private constructor( + @JsonProperty("duration") + @ExcludeMissing + private val duration: JsonField = JsonMissing.of(), + @JsonProperty("duration_unit") + @ExcludeMissing + private val durationUnit: JsonField = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), + ) { + + fun duration(): Long = duration.getRequired("duration") + + fun durationUnit(): DurationUnit = durationUnit.getRequired("duration_unit") + + @JsonProperty("duration") @ExcludeMissing fun _duration(): JsonField = duration + + @JsonProperty("duration_unit") + @ExcludeMissing + fun _durationUnit(): JsonField = durationUnit + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + private var validated: Boolean = false + + fun validate(): BillingCycleConfiguration = apply { + if (validated) { + return@apply + } + + duration() + durationUnit() + validated = true + } + + fun toBuilder() = Builder().from(this) + + companion object { + + @JvmStatic fun builder() = Builder() + } + + class Builder { + + private var duration: JsonField? = null + private var durationUnit: JsonField? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(billingCycleConfiguration: BillingCycleConfiguration) = apply { + duration = billingCycleConfiguration.duration + durationUnit = billingCycleConfiguration.durationUnit + additionalProperties = + billingCycleConfiguration.additionalProperties.toMutableMap() + } + + fun duration(duration: Long) = duration(JsonField.of(duration)) + + fun duration(duration: JsonField) = apply { this.duration = duration } + + fun durationUnit(durationUnit: DurationUnit) = + durationUnit(JsonField.of(durationUnit)) + + fun durationUnit(durationUnit: JsonField) = apply { + this.durationUnit = durationUnit + } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + fun build(): BillingCycleConfiguration = + BillingCycleConfiguration( + checkRequired("duration", duration), + checkRequired("durationUnit", durationUnit), + additionalProperties.toImmutable(), + ) + } + + class DurationUnit + @JsonCreator + private constructor( + private val value: JsonField, + ) : Enum { + + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + + companion object { + + @JvmField val DAY = of("day") + + @JvmField val MONTH = of("month") + + @JvmStatic fun of(value: String) = DurationUnit(JsonField.of(value)) + } + + enum class Known { + DAY, + MONTH, + } + + enum class Value { + DAY, + MONTH, + _UNKNOWN, + } + + fun value(): Value = + when (this) { + DAY -> Value.DAY + MONTH -> Value.MONTH + else -> Value._UNKNOWN + } + + fun known(): Known = + when (this) { + DAY -> Known.DAY + MONTH -> Known.MONTH + else -> throw OrbInvalidDataException("Unknown DurationUnit: $value") + } + + fun asString(): String = _value().asStringOrThrow() + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is DurationUnit && value == other.value /* spotless:on */ + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is BillingCycleConfiguration && duration == other.duration && durationUnit == other.durationUnit && additionalProperties == other.additionalProperties /* spotless:on */ + } + + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(duration, durationUnit, additionalProperties) } + /* spotless:on */ + + override fun hashCode(): Int = hashCode + + override fun toString() = + "BillingCycleConfiguration{duration=$duration, durationUnit=$durationUnit, additionalProperties=$additionalProperties}" + } + + class Cadence + @JsonCreator + private constructor( + private val value: JsonField, + ) : Enum { + + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + + companion object { + + @JvmField val ONE_TIME = of("one_time") + + @JvmField val MONTHLY = of("monthly") + + @JvmField val QUARTERLY = of("quarterly") + + @JvmField val SEMI_ANNUAL = of("semi_annual") + + @JvmField val ANNUAL = of("annual") + + @JvmField val CUSTOM = of("custom") + + @JvmStatic fun of(value: String) = Cadence(JsonField.of(value)) + } + + enum class Known { + ONE_TIME, + MONTHLY, + QUARTERLY, + SEMI_ANNUAL, + ANNUAL, + CUSTOM, + } + + enum class Value { + ONE_TIME, + MONTHLY, + QUARTERLY, + SEMI_ANNUAL, + ANNUAL, + CUSTOM, + _UNKNOWN, + } + + fun value(): Value = + when (this) { + ONE_TIME -> Value.ONE_TIME + MONTHLY -> Value.MONTHLY + QUARTERLY -> Value.QUARTERLY + SEMI_ANNUAL -> Value.SEMI_ANNUAL + ANNUAL -> Value.ANNUAL + CUSTOM -> Value.CUSTOM + else -> Value._UNKNOWN + } + + fun known(): Known = + when (this) { + ONE_TIME -> Known.ONE_TIME + MONTHLY -> Known.MONTHLY + QUARTERLY -> Known.QUARTERLY + SEMI_ANNUAL -> Known.SEMI_ANNUAL + ANNUAL -> Known.ANNUAL + CUSTOM -> Known.CUSTOM + else -> throw OrbInvalidDataException("Unknown Cadence: $value") + } + + fun asString(): String = _value().asStringOrThrow() + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is Cadence && value == other.value /* spotless:on */ + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + + @NoAutoDetect + class CreditAllocation + @JsonCreator + private constructor( + @JsonProperty("allows_rollover") + @ExcludeMissing + private val allowsRollover: JsonField = JsonMissing.of(), + @JsonProperty("currency") + @ExcludeMissing + private val currency: JsonField = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), + ) { + + fun allowsRollover(): Boolean = allowsRollover.getRequired("allows_rollover") + + fun currency(): String = currency.getRequired("currency") + + @JsonProperty("allows_rollover") + @ExcludeMissing + fun _allowsRollover(): JsonField = allowsRollover + + @JsonProperty("currency") @ExcludeMissing fun _currency(): JsonField = currency + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + private var validated: Boolean = false + + fun validate(): CreditAllocation = apply { + if (validated) { + return@apply + } + + allowsRollover() + currency() + validated = true + } + + fun toBuilder() = Builder().from(this) + + companion object { + + @JvmStatic fun builder() = Builder() + } + + class Builder { + + private var allowsRollover: JsonField? = null + private var currency: JsonField? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(creditAllocation: CreditAllocation) = apply { + allowsRollover = creditAllocation.allowsRollover + currency = creditAllocation.currency + additionalProperties = creditAllocation.additionalProperties.toMutableMap() + } + + fun allowsRollover(allowsRollover: Boolean) = + allowsRollover(JsonField.of(allowsRollover)) + + fun allowsRollover(allowsRollover: JsonField) = apply { + this.allowsRollover = allowsRollover + } + + fun currency(currency: String) = currency(JsonField.of(currency)) + + fun currency(currency: JsonField) = apply { this.currency = currency } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + fun build(): CreditAllocation = + CreditAllocation( + checkRequired("allowsRollover", allowsRollover), + checkRequired("currency", currency), + additionalProperties.toImmutable(), + ) + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is CreditAllocation && allowsRollover == other.allowsRollover && currency == other.currency && additionalProperties == other.additionalProperties /* spotless:on */ + } + + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(allowsRollover, currency, additionalProperties) } + /* spotless:on */ + + override fun hashCode(): Int = hashCode + + override fun toString() = + "CreditAllocation{allowsRollover=$allowsRollover, currency=$currency, additionalProperties=$additionalProperties}" + } + + @NoAutoDetect + class InvoicingCycleConfiguration + @JsonCreator + private constructor( + @JsonProperty("duration") + @ExcludeMissing + private val duration: JsonField = JsonMissing.of(), + @JsonProperty("duration_unit") + @ExcludeMissing + private val durationUnit: JsonField = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), + ) { + + fun duration(): Long = duration.getRequired("duration") + + fun durationUnit(): DurationUnit = durationUnit.getRequired("duration_unit") + + @JsonProperty("duration") @ExcludeMissing fun _duration(): JsonField = duration + + @JsonProperty("duration_unit") + @ExcludeMissing + fun _durationUnit(): JsonField = durationUnit + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + private var validated: Boolean = false + + fun validate(): InvoicingCycleConfiguration = apply { + if (validated) { + return@apply + } + + duration() + durationUnit() + validated = true + } + + fun toBuilder() = Builder().from(this) + + companion object { + + @JvmStatic fun builder() = Builder() + } + + class Builder { + + private var duration: JsonField? = null + private var durationUnit: JsonField? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(invoicingCycleConfiguration: InvoicingCycleConfiguration) = + apply { + duration = invoicingCycleConfiguration.duration + durationUnit = invoicingCycleConfiguration.durationUnit + additionalProperties = + invoicingCycleConfiguration.additionalProperties.toMutableMap() + } + + fun duration(duration: Long) = duration(JsonField.of(duration)) + + fun duration(duration: JsonField) = apply { this.duration = duration } + + fun durationUnit(durationUnit: DurationUnit) = + durationUnit(JsonField.of(durationUnit)) + + fun durationUnit(durationUnit: JsonField) = apply { + this.durationUnit = durationUnit + } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + fun build(): InvoicingCycleConfiguration = + InvoicingCycleConfiguration( + checkRequired("duration", duration), + checkRequired("durationUnit", durationUnit), + additionalProperties.toImmutable(), + ) + } + + class DurationUnit + @JsonCreator + private constructor( + private val value: JsonField, + ) : Enum { + + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + + companion object { + + @JvmField val DAY = of("day") + + @JvmField val MONTH = of("month") + + @JvmStatic fun of(value: String) = DurationUnit(JsonField.of(value)) + } + + enum class Known { + DAY, + MONTH, + } + + enum class Value { + DAY, + MONTH, + _UNKNOWN, + } + + fun value(): Value = + when (this) { + DAY -> Value.DAY + MONTH -> Value.MONTH + else -> Value._UNKNOWN + } + + fun known(): Known = + when (this) { + DAY -> Known.DAY + MONTH -> Known.MONTH + else -> throw OrbInvalidDataException("Unknown DurationUnit: $value") + } + + fun asString(): String = _value().asStringOrThrow() + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is DurationUnit && value == other.value /* spotless:on */ + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is InvoicingCycleConfiguration && duration == other.duration && durationUnit == other.durationUnit && additionalProperties == other.additionalProperties /* spotless:on */ + } + + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(duration, durationUnit, additionalProperties) } + /* spotless:on */ + + override fun hashCode(): Int = hashCode + + override fun toString() = + "InvoicingCycleConfiguration{duration=$duration, durationUnit=$durationUnit, additionalProperties=$additionalProperties}" + } + + @NoAutoDetect + class Item + @JsonCreator + private constructor( + @JsonProperty("id") + @ExcludeMissing + private val id: JsonField = JsonMissing.of(), + @JsonProperty("name") + @ExcludeMissing + private val name: JsonField = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), + ) { + + fun id(): String = id.getRequired("id") + + fun name(): String = name.getRequired("name") + + @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id + + @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + private var validated: Boolean = false + + fun validate(): Item = apply { + if (validated) { + return@apply + } + + id() + name() + validated = true + } + + fun toBuilder() = Builder().from(this) + + companion object { + + @JvmStatic fun builder() = Builder() + } + + class Builder { + + private var id: JsonField? = null + private var name: JsonField? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(item: Item) = apply { + id = item.id + name = item.name + additionalProperties = item.additionalProperties.toMutableMap() + } + + fun id(id: String) = id(JsonField.of(id)) + + fun id(id: JsonField) = apply { this.id = id } + + fun name(name: String) = name(JsonField.of(name)) + + fun name(name: JsonField) = apply { this.name = name } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + fun build(): Item = + Item( + checkRequired("id", id), + checkRequired("name", name), + additionalProperties.toImmutable(), + ) + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is Item && id == other.id && name == other.name && additionalProperties == other.additionalProperties /* spotless:on */ + } + + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(id, name, additionalProperties) } + /* spotless:on */ + + override fun hashCode(): Int = hashCode + + override fun toString() = + "Item{id=$id, name=$name, additionalProperties=$additionalProperties}" + } + + @NoAutoDetect + class Maximum + @JsonCreator + private constructor( + @JsonProperty("applies_to_price_ids") + @ExcludeMissing + private val appliesToPriceIds: JsonField> = JsonMissing.of(), + @JsonProperty("maximum_amount") + @ExcludeMissing + private val maximumAmount: JsonField = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), + ) { + + /** + * List of price_ids that this maximum amount applies to. For plan/plan phase maximums, + * this can be a subset of prices. + */ + fun appliesToPriceIds(): List = + appliesToPriceIds.getRequired("applies_to_price_ids") + + /** Maximum amount applied */ + fun maximumAmount(): String = maximumAmount.getRequired("maximum_amount") + + /** + * List of price_ids that this maximum amount applies to. For plan/plan phase maximums, + * this can be a subset of prices. + */ + @JsonProperty("applies_to_price_ids") + @ExcludeMissing + fun _appliesToPriceIds(): JsonField> = appliesToPriceIds + + /** Maximum amount applied */ + @JsonProperty("maximum_amount") + @ExcludeMissing + fun _maximumAmount(): JsonField = maximumAmount + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + private var validated: Boolean = false + + fun validate(): Maximum = apply { + if (validated) { + return@apply + } + + appliesToPriceIds() + maximumAmount() + validated = true + } + + fun toBuilder() = Builder().from(this) + + companion object { + + @JvmStatic fun builder() = Builder() + } + + class Builder { + + private var appliesToPriceIds: JsonField>? = null + private var maximumAmount: JsonField? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(maximum: Maximum) = apply { + appliesToPriceIds = maximum.appliesToPriceIds.map { it.toMutableList() } + maximumAmount = maximum.maximumAmount + additionalProperties = maximum.additionalProperties.toMutableMap() + } + + /** + * List of price_ids that this maximum amount applies to. For plan/plan phase + * maximums, this can be a subset of prices. + */ + fun appliesToPriceIds(appliesToPriceIds: List) = + appliesToPriceIds(JsonField.of(appliesToPriceIds)) + + /** + * List of price_ids that this maximum amount applies to. For plan/plan phase + * maximums, this can be a subset of prices. + */ + fun appliesToPriceIds(appliesToPriceIds: JsonField>) = apply { + this.appliesToPriceIds = appliesToPriceIds.map { it.toMutableList() } + } + + /** + * List of price_ids that this maximum amount applies to. For plan/plan phase + * maximums, this can be a subset of prices. + */ + fun addAppliesToPriceId(appliesToPriceId: String) = apply { + appliesToPriceIds = + (appliesToPriceIds ?: JsonField.of(mutableListOf())).apply { + asKnown() + .orElseThrow { + IllegalStateException( + "Field was set to non-list type: ${javaClass.simpleName}" + ) + } + .add(appliesToPriceId) + } + } + + /** Maximum amount applied */ + fun maximumAmount(maximumAmount: String) = + maximumAmount(JsonField.of(maximumAmount)) + + /** Maximum amount applied */ + fun maximumAmount(maximumAmount: JsonField) = apply { + this.maximumAmount = maximumAmount + } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + fun build(): Maximum = + Maximum( + checkRequired("appliesToPriceIds", appliesToPriceIds).map { + it.toImmutable() + }, + checkRequired("maximumAmount", maximumAmount), + additionalProperties.toImmutable(), + ) + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is Maximum && appliesToPriceIds == other.appliesToPriceIds && maximumAmount == other.maximumAmount && additionalProperties == other.additionalProperties /* spotless:on */ + } + + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(appliesToPriceIds, maximumAmount, additionalProperties) } + /* spotless:on */ + + override fun hashCode(): Int = hashCode + + override fun toString() = + "Maximum{appliesToPriceIds=$appliesToPriceIds, maximumAmount=$maximumAmount, additionalProperties=$additionalProperties}" + } + + /** + * User specified key-value pairs for the resource. If not present, this defaults to an + * empty dictionary. Individual keys can be removed by setting the value to `null`, and the + * entire metadata mapping can be cleared by setting `metadata` to `null`. + */ + @NoAutoDetect + class Metadata + @JsonCreator + private constructor( + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), + ) { + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + private var validated: Boolean = false + + fun validate(): Metadata = apply { + if (validated) { + return@apply + } + + validated = true + } + + fun toBuilder() = Builder().from(this) + + companion object { + + @JvmStatic fun builder() = Builder() + } + + class Builder { + + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(metadata: Metadata) = apply { + additionalProperties = metadata.additionalProperties.toMutableMap() + } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + fun build(): Metadata = Metadata(additionalProperties.toImmutable()) + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is Metadata && additionalProperties == other.additionalProperties /* spotless:on */ + } + + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(additionalProperties) } + /* spotless:on */ + + override fun hashCode(): Int = hashCode + + override fun toString() = "Metadata{additionalProperties=$additionalProperties}" + } + + @NoAutoDetect + class Minimum + @JsonCreator + private constructor( + @JsonProperty("applies_to_price_ids") + @ExcludeMissing + private val appliesToPriceIds: JsonField> = JsonMissing.of(), + @JsonProperty("minimum_amount") + @ExcludeMissing + private val minimumAmount: JsonField = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), + ) { + + /** + * List of price_ids that this minimum amount applies to. For plan/plan phase minimums, + * this can be a subset of prices. + */ + fun appliesToPriceIds(): List = + appliesToPriceIds.getRequired("applies_to_price_ids") + + /** Minimum amount applied */ + fun minimumAmount(): String = minimumAmount.getRequired("minimum_amount") + + /** + * List of price_ids that this minimum amount applies to. For plan/plan phase minimums, + * this can be a subset of prices. + */ + @JsonProperty("applies_to_price_ids") + @ExcludeMissing + fun _appliesToPriceIds(): JsonField> = appliesToPriceIds + + /** Minimum amount applied */ + @JsonProperty("minimum_amount") + @ExcludeMissing + fun _minimumAmount(): JsonField = minimumAmount + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + private var validated: Boolean = false + + fun validate(): Minimum = apply { + if (validated) { + return@apply + } + + appliesToPriceIds() + minimumAmount() + validated = true + } + + fun toBuilder() = Builder().from(this) + + companion object { + + @JvmStatic fun builder() = Builder() + } + + class Builder { + + private var appliesToPriceIds: JsonField>? = null + private var minimumAmount: JsonField? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(minimum: Minimum) = apply { + appliesToPriceIds = minimum.appliesToPriceIds.map { it.toMutableList() } + minimumAmount = minimum.minimumAmount + additionalProperties = minimum.additionalProperties.toMutableMap() + } + + /** + * List of price_ids that this minimum amount applies to. For plan/plan phase + * minimums, this can be a subset of prices. + */ + fun appliesToPriceIds(appliesToPriceIds: List) = + appliesToPriceIds(JsonField.of(appliesToPriceIds)) + + /** + * List of price_ids that this minimum amount applies to. For plan/plan phase + * minimums, this can be a subset of prices. + */ + fun appliesToPriceIds(appliesToPriceIds: JsonField>) = apply { + this.appliesToPriceIds = appliesToPriceIds.map { it.toMutableList() } + } + + /** + * List of price_ids that this minimum amount applies to. For plan/plan phase + * minimums, this can be a subset of prices. + */ + fun addAppliesToPriceId(appliesToPriceId: String) = apply { + appliesToPriceIds = + (appliesToPriceIds ?: JsonField.of(mutableListOf())).apply { + asKnown() + .orElseThrow { + IllegalStateException( + "Field was set to non-list type: ${javaClass.simpleName}" + ) + } + .add(appliesToPriceId) + } + } + + /** Minimum amount applied */ + fun minimumAmount(minimumAmount: String) = + minimumAmount(JsonField.of(minimumAmount)) + + /** Minimum amount applied */ + fun minimumAmount(minimumAmount: JsonField) = apply { + this.minimumAmount = minimumAmount + } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + fun build(): Minimum = + Minimum( + checkRequired("appliesToPriceIds", appliesToPriceIds).map { + it.toImmutable() + }, + checkRequired("minimumAmount", minimumAmount), + additionalProperties.toImmutable(), + ) + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is Minimum && appliesToPriceIds == other.appliesToPriceIds && minimumAmount == other.minimumAmount && additionalProperties == other.additionalProperties /* spotless:on */ + } + + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(appliesToPriceIds, minimumAmount, additionalProperties) } + /* spotless:on */ + + override fun hashCode(): Int = hashCode + + override fun toString() = + "Minimum{appliesToPriceIds=$appliesToPriceIds, minimumAmount=$minimumAmount, additionalProperties=$additionalProperties}" + } + + class ModelType + @JsonCreator + private constructor( + private val value: JsonField, + ) : Enum { + + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + + companion object { + + @JvmField val TIERED_WITH_PRORATION = of("tiered_with_proration") + + @JvmStatic fun of(value: String) = ModelType(JsonField.of(value)) + } + + enum class Known { + TIERED_WITH_PRORATION, + } + + enum class Value { + TIERED_WITH_PRORATION, + _UNKNOWN, + } + + fun value(): Value = + when (this) { + TIERED_WITH_PRORATION -> Value.TIERED_WITH_PRORATION + else -> Value._UNKNOWN + } + + fun known(): Known = + when (this) { + TIERED_WITH_PRORATION -> Known.TIERED_WITH_PRORATION + else -> throw OrbInvalidDataException("Unknown ModelType: $value") + } + + fun asString(): String = _value().asStringOrThrow() + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is ModelType && value == other.value /* spotless:on */ + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + + class PriceType + @JsonCreator + private constructor( + private val value: JsonField, + ) : Enum { + + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + + companion object { + + @JvmField val USAGE_PRICE = of("usage_price") + + @JvmField val FIXED_PRICE = of("fixed_price") + + @JvmStatic fun of(value: String) = PriceType(JsonField.of(value)) + } + + enum class Known { + USAGE_PRICE, + FIXED_PRICE, + } + + enum class Value { + USAGE_PRICE, + FIXED_PRICE, + _UNKNOWN, + } + + fun value(): Value = + when (this) { + USAGE_PRICE -> Value.USAGE_PRICE + FIXED_PRICE -> Value.FIXED_PRICE + else -> Value._UNKNOWN + } + + fun known(): Known = + when (this) { + USAGE_PRICE -> Known.USAGE_PRICE + FIXED_PRICE -> Known.FIXED_PRICE + else -> throw OrbInvalidDataException("Unknown PriceType: $value") + } + + fun asString(): String = _value().asStringOrThrow() + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is PriceType && value == other.value /* spotless:on */ + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + + @NoAutoDetect + class TieredWithProrationConfig + @JsonCreator + private constructor( + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), + ) { + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + private var validated: Boolean = false + + fun validate(): TieredWithProrationConfig = apply { + if (validated) { + return@apply + } + + validated = true + } + + fun toBuilder() = Builder().from(this) + + companion object { + + @JvmStatic fun builder() = Builder() + } + + class Builder { + + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(tieredWithProrationConfig: TieredWithProrationConfig) = apply { + additionalProperties = + tieredWithProrationConfig.additionalProperties.toMutableMap() + } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + fun build(): TieredWithProrationConfig = + TieredWithProrationConfig(additionalProperties.toImmutable()) } override fun equals(other: Any?): Boolean { @@ -33626,125 +35713,17 @@ private constructor( return true } - return /* spotless:off */ other is Minimum && appliesToPriceIds == other.appliesToPriceIds && minimumAmount == other.minimumAmount && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is TieredWithProrationConfig && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(appliesToPriceIds, minimumAmount, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "Minimum{appliesToPriceIds=$appliesToPriceIds, minimumAmount=$minimumAmount, additionalProperties=$additionalProperties}" - } - - class ModelType - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { - - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - companion object { - - @JvmField val MATRIX_WITH_ALLOCATION = of("matrix_with_allocation") - - @JvmStatic fun of(value: String) = ModelType(JsonField.of(value)) - } - - enum class Known { - MATRIX_WITH_ALLOCATION, - } - - enum class Value { - MATRIX_WITH_ALLOCATION, - _UNKNOWN, - } - - fun value(): Value = - when (this) { - MATRIX_WITH_ALLOCATION -> Value.MATRIX_WITH_ALLOCATION - else -> Value._UNKNOWN - } - - fun known(): Known = - when (this) { - MATRIX_WITH_ALLOCATION -> Known.MATRIX_WITH_ALLOCATION - else -> throw OrbInvalidDataException("Unknown ModelType: $value") - } - - fun asString(): String = _value().asStringOrThrow() - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is ModelType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - - class PriceType - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { - - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - companion object { - - @JvmField val USAGE_PRICE = of("usage_price") - - @JvmField val FIXED_PRICE = of("fixed_price") - - @JvmStatic fun of(value: String) = PriceType(JsonField.of(value)) - } - - enum class Known { - USAGE_PRICE, - FIXED_PRICE, - } - - enum class Value { - USAGE_PRICE, - FIXED_PRICE, - _UNKNOWN, - } - - fun value(): Value = - when (this) { - USAGE_PRICE -> Value.USAGE_PRICE - FIXED_PRICE -> Value.FIXED_PRICE - else -> Value._UNKNOWN - } - - fun known(): Known = - when (this) { - USAGE_PRICE -> Known.USAGE_PRICE - FIXED_PRICE -> Known.FIXED_PRICE - else -> throw OrbInvalidDataException("Unknown PriceType: $value") - } - - fun asString(): String = _value().asStringOrThrow() - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is PriceType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() + "TieredWithProrationConfig{additionalProperties=$additionalProperties}" } override fun equals(other: Any?): Boolean { @@ -33752,21 +35731,21 @@ private constructor( return true } - return /* spotless:off */ other is MatrixWithAllocationPrice && id == other.id && billableMetric == other.billableMetric && billingCycleConfiguration == other.billingCycleConfiguration && cadence == other.cadence && conversionRate == other.conversionRate && createdAt == other.createdAt && creditAllocation == other.creditAllocation && currency == other.currency && discount == other.discount && externalPriceId == other.externalPriceId && fixedPriceQuantity == other.fixedPriceQuantity && invoicingCycleConfiguration == other.invoicingCycleConfiguration && item == other.item && matrixWithAllocationConfig == other.matrixWithAllocationConfig && maximum == other.maximum && maximumAmount == other.maximumAmount && metadata == other.metadata && minimum == other.minimum && minimumAmount == other.minimumAmount && modelType == other.modelType && name == other.name && planPhaseOrder == other.planPhaseOrder && priceType == other.priceType && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is TieredWithProrationPrice && id == other.id && billableMetric == other.billableMetric && billingCycleConfiguration == other.billingCycleConfiguration && cadence == other.cadence && conversionRate == other.conversionRate && createdAt == other.createdAt && creditAllocation == other.creditAllocation && currency == other.currency && discount == other.discount && externalPriceId == other.externalPriceId && fixedPriceQuantity == other.fixedPriceQuantity && invoicingCycleConfiguration == other.invoicingCycleConfiguration && item == other.item && maximum == other.maximum && maximumAmount == other.maximumAmount && metadata == other.metadata && minimum == other.minimum && minimumAmount == other.minimumAmount && modelType == other.modelType && name == other.name && planPhaseOrder == other.planPhaseOrder && priceType == other.priceType && tieredWithProrationConfig == other.tieredWithProrationConfig && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(id, billableMetric, billingCycleConfiguration, cadence, conversionRate, createdAt, creditAllocation, currency, discount, externalPriceId, fixedPriceQuantity, invoicingCycleConfiguration, item, matrixWithAllocationConfig, maximum, maximumAmount, metadata, minimum, minimumAmount, modelType, name, planPhaseOrder, priceType, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(id, billableMetric, billingCycleConfiguration, cadence, conversionRate, createdAt, creditAllocation, currency, discount, externalPriceId, fixedPriceQuantity, invoicingCycleConfiguration, item, maximum, maximumAmount, metadata, minimum, minimumAmount, modelType, name, planPhaseOrder, priceType, tieredWithProrationConfig, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "MatrixWithAllocationPrice{id=$id, billableMetric=$billableMetric, billingCycleConfiguration=$billingCycleConfiguration, cadence=$cadence, conversionRate=$conversionRate, createdAt=$createdAt, creditAllocation=$creditAllocation, currency=$currency, discount=$discount, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoicingCycleConfiguration=$invoicingCycleConfiguration, item=$item, matrixWithAllocationConfig=$matrixWithAllocationConfig, maximum=$maximum, maximumAmount=$maximumAmount, metadata=$metadata, minimum=$minimum, minimumAmount=$minimumAmount, modelType=$modelType, name=$name, planPhaseOrder=$planPhaseOrder, priceType=$priceType, additionalProperties=$additionalProperties}" + "TieredWithProrationPrice{id=$id, billableMetric=$billableMetric, billingCycleConfiguration=$billingCycleConfiguration, cadence=$cadence, conversionRate=$conversionRate, createdAt=$createdAt, creditAllocation=$creditAllocation, currency=$currency, discount=$discount, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoicingCycleConfiguration=$invoicingCycleConfiguration, item=$item, maximum=$maximum, maximumAmount=$maximumAmount, metadata=$metadata, minimum=$minimum, minimumAmount=$minimumAmount, modelType=$modelType, name=$name, planPhaseOrder=$planPhaseOrder, priceType=$priceType, tieredWithProrationConfig=$tieredWithProrationConfig, additionalProperties=$additionalProperties}" } @NoAutoDetect - class TieredWithProrationPrice + class UnitWithProrationPrice @JsonCreator private constructor( @JsonProperty("id") @ExcludeMissing private val id: JsonField = JsonMissing.of(), @@ -33833,10 +35812,9 @@ private constructor( @JsonProperty("price_type") @ExcludeMissing private val priceType: JsonField = JsonMissing.of(), - @JsonProperty("tiered_with_proration_config") + @JsonProperty("unit_with_proration_config") @ExcludeMissing - private val tieredWithProrationConfig: JsonField = - JsonMissing.of(), + private val unitWithProrationConfig: JsonField = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { @@ -33902,8 +35880,8 @@ private constructor( fun priceType(): PriceType = priceType.getRequired("price_type") - fun tieredWithProrationConfig(): TieredWithProrationConfig = - tieredWithProrationConfig.getRequired("tiered_with_proration_config") + fun unitWithProrationConfig(): UnitWithProrationConfig = + unitWithProrationConfig.getRequired("unit_with_proration_config") @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id @@ -33982,10 +35960,9 @@ private constructor( @ExcludeMissing fun _priceType(): JsonField = priceType - @JsonProperty("tiered_with_proration_config") + @JsonProperty("unit_with_proration_config") @ExcludeMissing - fun _tieredWithProrationConfig(): JsonField = - tieredWithProrationConfig + fun _unitWithProrationConfig(): JsonField = unitWithProrationConfig @JsonAnyGetter @ExcludeMissing @@ -33993,7 +35970,7 @@ private constructor( private var validated: Boolean = false - fun validate(): TieredWithProrationPrice = apply { + fun validate(): UnitWithProrationPrice = apply { if (validated) { return@apply } @@ -34020,7 +35997,7 @@ private constructor( name() planPhaseOrder() priceType() - tieredWithProrationConfig().validate() + unitWithProrationConfig().validate() validated = true } @@ -34055,35 +36032,35 @@ private constructor( private var name: JsonField? = null private var planPhaseOrder: JsonField? = null private var priceType: JsonField? = null - private var tieredWithProrationConfig: JsonField? = null + private var unitWithProrationConfig: JsonField? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(tieredWithProrationPrice: TieredWithProrationPrice) = apply { - id = tieredWithProrationPrice.id - billableMetric = tieredWithProrationPrice.billableMetric - billingCycleConfiguration = tieredWithProrationPrice.billingCycleConfiguration - cadence = tieredWithProrationPrice.cadence - conversionRate = tieredWithProrationPrice.conversionRate - createdAt = tieredWithProrationPrice.createdAt - creditAllocation = tieredWithProrationPrice.creditAllocation - currency = tieredWithProrationPrice.currency - discount = tieredWithProrationPrice.discount - externalPriceId = tieredWithProrationPrice.externalPriceId - fixedPriceQuantity = tieredWithProrationPrice.fixedPriceQuantity - invoicingCycleConfiguration = tieredWithProrationPrice.invoicingCycleConfiguration - item = tieredWithProrationPrice.item - maximum = tieredWithProrationPrice.maximum - maximumAmount = tieredWithProrationPrice.maximumAmount - metadata = tieredWithProrationPrice.metadata - minimum = tieredWithProrationPrice.minimum - minimumAmount = tieredWithProrationPrice.minimumAmount - modelType = tieredWithProrationPrice.modelType - name = tieredWithProrationPrice.name - planPhaseOrder = tieredWithProrationPrice.planPhaseOrder - priceType = tieredWithProrationPrice.priceType - tieredWithProrationConfig = tieredWithProrationPrice.tieredWithProrationConfig - additionalProperties = tieredWithProrationPrice.additionalProperties.toMutableMap() + internal fun from(unitWithProrationPrice: UnitWithProrationPrice) = apply { + id = unitWithProrationPrice.id + billableMetric = unitWithProrationPrice.billableMetric + billingCycleConfiguration = unitWithProrationPrice.billingCycleConfiguration + cadence = unitWithProrationPrice.cadence + conversionRate = unitWithProrationPrice.conversionRate + createdAt = unitWithProrationPrice.createdAt + creditAllocation = unitWithProrationPrice.creditAllocation + currency = unitWithProrationPrice.currency + discount = unitWithProrationPrice.discount + externalPriceId = unitWithProrationPrice.externalPriceId + fixedPriceQuantity = unitWithProrationPrice.fixedPriceQuantity + invoicingCycleConfiguration = unitWithProrationPrice.invoicingCycleConfiguration + item = unitWithProrationPrice.item + maximum = unitWithProrationPrice.maximum + maximumAmount = unitWithProrationPrice.maximumAmount + metadata = unitWithProrationPrice.metadata + minimum = unitWithProrationPrice.minimum + minimumAmount = unitWithProrationPrice.minimumAmount + modelType = unitWithProrationPrice.modelType + name = unitWithProrationPrice.name + planPhaseOrder = unitWithProrationPrice.planPhaseOrder + priceType = unitWithProrationPrice.priceType + unitWithProrationConfig = unitWithProrationPrice.unitWithProrationConfig + additionalProperties = unitWithProrationPrice.additionalProperties.toMutableMap() } fun id(id: String) = id(JsonField.of(id)) @@ -34273,12 +36250,12 @@ private constructor( fun priceType(priceType: JsonField) = apply { this.priceType = priceType } - fun tieredWithProrationConfig(tieredWithProrationConfig: TieredWithProrationConfig) = - tieredWithProrationConfig(JsonField.of(tieredWithProrationConfig)) + fun unitWithProrationConfig(unitWithProrationConfig: UnitWithProrationConfig) = + unitWithProrationConfig(JsonField.of(unitWithProrationConfig)) - fun tieredWithProrationConfig( - tieredWithProrationConfig: JsonField - ) = apply { this.tieredWithProrationConfig = tieredWithProrationConfig } + fun unitWithProrationConfig( + unitWithProrationConfig: JsonField + ) = apply { this.unitWithProrationConfig = unitWithProrationConfig } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -34299,8 +36276,8 @@ private constructor( keys.forEach(::removeAdditionalProperty) } - fun build(): TieredWithProrationPrice = - TieredWithProrationPrice( + fun build(): UnitWithProrationPrice = + UnitWithProrationPrice( checkRequired("id", id), checkRequired("billableMetric", billableMetric), checkRequired("billingCycleConfiguration", billingCycleConfiguration), @@ -34323,7 +36300,7 @@ private constructor( checkRequired("name", name), checkRequired("planPhaseOrder", planPhaseOrder), checkRequired("priceType", priceType), - checkRequired("tieredWithProrationConfig", tieredWithProrationConfig), + checkRequired("unitWithProrationConfig", unitWithProrationConfig), additionalProperties.toImmutable(), ) } @@ -35516,29 +37493,29 @@ private constructor( companion object { - @JvmField val TIERED_WITH_PRORATION = of("tiered_with_proration") + @JvmField val UNIT_WITH_PRORATION = of("unit_with_proration") @JvmStatic fun of(value: String) = ModelType(JsonField.of(value)) } enum class Known { - TIERED_WITH_PRORATION, + UNIT_WITH_PRORATION, } enum class Value { - TIERED_WITH_PRORATION, + UNIT_WITH_PRORATION, _UNKNOWN, } fun value(): Value = when (this) { - TIERED_WITH_PRORATION -> Value.TIERED_WITH_PRORATION + UNIT_WITH_PRORATION -> Value.UNIT_WITH_PRORATION else -> Value._UNKNOWN } fun known(): Known = when (this) { - TIERED_WITH_PRORATION -> Known.TIERED_WITH_PRORATION + UNIT_WITH_PRORATION -> Known.UNIT_WITH_PRORATION else -> throw OrbInvalidDataException("Unknown ModelType: $value") } @@ -35615,7 +37592,7 @@ private constructor( } @NoAutoDetect - class TieredWithProrationConfig + class UnitWithProrationConfig @JsonCreator private constructor( @JsonAnySetter @@ -35628,7 +37605,7 @@ private constructor( private var validated: Boolean = false - fun validate(): TieredWithProrationConfig = apply { + fun validate(): UnitWithProrationConfig = apply { if (validated) { return@apply } @@ -35648,9 +37625,9 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(tieredWithProrationConfig: TieredWithProrationConfig) = apply { + internal fun from(unitWithProrationConfig: UnitWithProrationConfig) = apply { additionalProperties = - tieredWithProrationConfig.additionalProperties.toMutableMap() + unitWithProrationConfig.additionalProperties.toMutableMap() } fun additionalProperties(additionalProperties: Map) = apply { @@ -35675,8 +37652,8 @@ private constructor( keys.forEach(::removeAdditionalProperty) } - fun build(): TieredWithProrationConfig = - TieredWithProrationConfig(additionalProperties.toImmutable()) + fun build(): UnitWithProrationConfig = + UnitWithProrationConfig(additionalProperties.toImmutable()) } override fun equals(other: Any?): Boolean { @@ -35684,7 +37661,7 @@ private constructor( return true } - return /* spotless:off */ other is TieredWithProrationConfig && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is UnitWithProrationConfig && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ @@ -35694,7 +37671,7 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "TieredWithProrationConfig{additionalProperties=$additionalProperties}" + "UnitWithProrationConfig{additionalProperties=$additionalProperties}" } override fun equals(other: Any?): Boolean { @@ -35702,21 +37679,21 @@ private constructor( return true } - return /* spotless:off */ other is TieredWithProrationPrice && id == other.id && billableMetric == other.billableMetric && billingCycleConfiguration == other.billingCycleConfiguration && cadence == other.cadence && conversionRate == other.conversionRate && createdAt == other.createdAt && creditAllocation == other.creditAllocation && currency == other.currency && discount == other.discount && externalPriceId == other.externalPriceId && fixedPriceQuantity == other.fixedPriceQuantity && invoicingCycleConfiguration == other.invoicingCycleConfiguration && item == other.item && maximum == other.maximum && maximumAmount == other.maximumAmount && metadata == other.metadata && minimum == other.minimum && minimumAmount == other.minimumAmount && modelType == other.modelType && name == other.name && planPhaseOrder == other.planPhaseOrder && priceType == other.priceType && tieredWithProrationConfig == other.tieredWithProrationConfig && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is UnitWithProrationPrice && id == other.id && billableMetric == other.billableMetric && billingCycleConfiguration == other.billingCycleConfiguration && cadence == other.cadence && conversionRate == other.conversionRate && createdAt == other.createdAt && creditAllocation == other.creditAllocation && currency == other.currency && discount == other.discount && externalPriceId == other.externalPriceId && fixedPriceQuantity == other.fixedPriceQuantity && invoicingCycleConfiguration == other.invoicingCycleConfiguration && item == other.item && maximum == other.maximum && maximumAmount == other.maximumAmount && metadata == other.metadata && minimum == other.minimum && minimumAmount == other.minimumAmount && modelType == other.modelType && name == other.name && planPhaseOrder == other.planPhaseOrder && priceType == other.priceType && unitWithProrationConfig == other.unitWithProrationConfig && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(id, billableMetric, billingCycleConfiguration, cadence, conversionRate, createdAt, creditAllocation, currency, discount, externalPriceId, fixedPriceQuantity, invoicingCycleConfiguration, item, maximum, maximumAmount, metadata, minimum, minimumAmount, modelType, name, planPhaseOrder, priceType, tieredWithProrationConfig, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(id, billableMetric, billingCycleConfiguration, cadence, conversionRate, createdAt, creditAllocation, currency, discount, externalPriceId, fixedPriceQuantity, invoicingCycleConfiguration, item, maximum, maximumAmount, metadata, minimum, minimumAmount, modelType, name, planPhaseOrder, priceType, unitWithProrationConfig, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "TieredWithProrationPrice{id=$id, billableMetric=$billableMetric, billingCycleConfiguration=$billingCycleConfiguration, cadence=$cadence, conversionRate=$conversionRate, createdAt=$createdAt, creditAllocation=$creditAllocation, currency=$currency, discount=$discount, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoicingCycleConfiguration=$invoicingCycleConfiguration, item=$item, maximum=$maximum, maximumAmount=$maximumAmount, metadata=$metadata, minimum=$minimum, minimumAmount=$minimumAmount, modelType=$modelType, name=$name, planPhaseOrder=$planPhaseOrder, priceType=$priceType, tieredWithProrationConfig=$tieredWithProrationConfig, additionalProperties=$additionalProperties}" + "UnitWithProrationPrice{id=$id, billableMetric=$billableMetric, billingCycleConfiguration=$billingCycleConfiguration, cadence=$cadence, conversionRate=$conversionRate, createdAt=$createdAt, creditAllocation=$creditAllocation, currency=$currency, discount=$discount, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoicingCycleConfiguration=$invoicingCycleConfiguration, item=$item, maximum=$maximum, maximumAmount=$maximumAmount, metadata=$metadata, minimum=$minimum, minimumAmount=$minimumAmount, modelType=$modelType, name=$name, planPhaseOrder=$planPhaseOrder, priceType=$priceType, unitWithProrationConfig=$unitWithProrationConfig, additionalProperties=$additionalProperties}" } @NoAutoDetect - class UnitWithProrationPrice + class GroupedAllocationPrice @JsonCreator private constructor( @JsonProperty("id") @ExcludeMissing private val id: JsonField = JsonMissing.of(), @@ -35751,6 +37728,9 @@ private constructor( @JsonProperty("fixed_price_quantity") @ExcludeMissing private val fixedPriceQuantity: JsonField = JsonMissing.of(), + @JsonProperty("grouped_allocation_config") + @ExcludeMissing + private val groupedAllocationConfig: JsonField = JsonMissing.of(), @JsonProperty("invoicing_cycle_configuration") @ExcludeMissing private val invoicingCycleConfiguration: JsonField = @@ -35783,9 +37763,6 @@ private constructor( @JsonProperty("price_type") @ExcludeMissing private val priceType: JsonField = JsonMissing.of(), - @JsonProperty("unit_with_proration_config") - @ExcludeMissing - private val unitWithProrationConfig: JsonField = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { @@ -35818,6 +37795,9 @@ private constructor( fun fixedPriceQuantity(): Optional = Optional.ofNullable(fixedPriceQuantity.getNullable("fixed_price_quantity")) + fun groupedAllocationConfig(): GroupedAllocationConfig = + groupedAllocationConfig.getRequired("grouped_allocation_config") + fun invoicingCycleConfiguration(): Optional = Optional.ofNullable( invoicingCycleConfiguration.getNullable("invoicing_cycle_configuration") @@ -35851,9 +37831,6 @@ private constructor( fun priceType(): PriceType = priceType.getRequired("price_type") - fun unitWithProrationConfig(): UnitWithProrationConfig = - unitWithProrationConfig.getRequired("unit_with_proration_config") - @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id @JsonProperty("billable_metric") @@ -35891,6 +37868,10 @@ private constructor( @ExcludeMissing fun _fixedPriceQuantity(): JsonField = fixedPriceQuantity + @JsonProperty("grouped_allocation_config") + @ExcludeMissing + fun _groupedAllocationConfig(): JsonField = groupedAllocationConfig + @JsonProperty("invoicing_cycle_configuration") @ExcludeMissing fun _invoicingCycleConfiguration(): JsonField = @@ -35931,17 +37912,13 @@ private constructor( @ExcludeMissing fun _priceType(): JsonField = priceType - @JsonProperty("unit_with_proration_config") - @ExcludeMissing - fun _unitWithProrationConfig(): JsonField = unitWithProrationConfig - @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties private var validated: Boolean = false - fun validate(): UnitWithProrationPrice = apply { + fun validate(): GroupedAllocationPrice = apply { if (validated) { return@apply } @@ -35957,6 +37934,7 @@ private constructor( discount().ifPresent { it.validate() } externalPriceId() fixedPriceQuantity() + groupedAllocationConfig().validate() invoicingCycleConfiguration().ifPresent { it.validate() } item().validate() maximum().ifPresent { it.validate() } @@ -35968,7 +37946,6 @@ private constructor( name() planPhaseOrder() priceType() - unitWithProrationConfig().validate() validated = true } @@ -35992,6 +37969,7 @@ private constructor( private var discount: JsonField? = null private var externalPriceId: JsonField? = null private var fixedPriceQuantity: JsonField? = null + private var groupedAllocationConfig: JsonField? = null private var invoicingCycleConfiguration: JsonField? = null private var item: JsonField? = null private var maximum: JsonField? = null @@ -36003,35 +37981,34 @@ private constructor( private var name: JsonField? = null private var planPhaseOrder: JsonField? = null private var priceType: JsonField? = null - private var unitWithProrationConfig: JsonField? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(unitWithProrationPrice: UnitWithProrationPrice) = apply { - id = unitWithProrationPrice.id - billableMetric = unitWithProrationPrice.billableMetric - billingCycleConfiguration = unitWithProrationPrice.billingCycleConfiguration - cadence = unitWithProrationPrice.cadence - conversionRate = unitWithProrationPrice.conversionRate - createdAt = unitWithProrationPrice.createdAt - creditAllocation = unitWithProrationPrice.creditAllocation - currency = unitWithProrationPrice.currency - discount = unitWithProrationPrice.discount - externalPriceId = unitWithProrationPrice.externalPriceId - fixedPriceQuantity = unitWithProrationPrice.fixedPriceQuantity - invoicingCycleConfiguration = unitWithProrationPrice.invoicingCycleConfiguration - item = unitWithProrationPrice.item - maximum = unitWithProrationPrice.maximum - maximumAmount = unitWithProrationPrice.maximumAmount - metadata = unitWithProrationPrice.metadata - minimum = unitWithProrationPrice.minimum - minimumAmount = unitWithProrationPrice.minimumAmount - modelType = unitWithProrationPrice.modelType - name = unitWithProrationPrice.name - planPhaseOrder = unitWithProrationPrice.planPhaseOrder - priceType = unitWithProrationPrice.priceType - unitWithProrationConfig = unitWithProrationPrice.unitWithProrationConfig - additionalProperties = unitWithProrationPrice.additionalProperties.toMutableMap() + internal fun from(groupedAllocationPrice: GroupedAllocationPrice) = apply { + id = groupedAllocationPrice.id + billableMetric = groupedAllocationPrice.billableMetric + billingCycleConfiguration = groupedAllocationPrice.billingCycleConfiguration + cadence = groupedAllocationPrice.cadence + conversionRate = groupedAllocationPrice.conversionRate + createdAt = groupedAllocationPrice.createdAt + creditAllocation = groupedAllocationPrice.creditAllocation + currency = groupedAllocationPrice.currency + discount = groupedAllocationPrice.discount + externalPriceId = groupedAllocationPrice.externalPriceId + fixedPriceQuantity = groupedAllocationPrice.fixedPriceQuantity + groupedAllocationConfig = groupedAllocationPrice.groupedAllocationConfig + invoicingCycleConfiguration = groupedAllocationPrice.invoicingCycleConfiguration + item = groupedAllocationPrice.item + maximum = groupedAllocationPrice.maximum + maximumAmount = groupedAllocationPrice.maximumAmount + metadata = groupedAllocationPrice.metadata + minimum = groupedAllocationPrice.minimum + minimumAmount = groupedAllocationPrice.minimumAmount + modelType = groupedAllocationPrice.modelType + name = groupedAllocationPrice.name + planPhaseOrder = groupedAllocationPrice.planPhaseOrder + priceType = groupedAllocationPrice.priceType + additionalProperties = groupedAllocationPrice.additionalProperties.toMutableMap() } fun id(id: String) = id(JsonField.of(id)) @@ -36134,6 +38111,13 @@ private constructor( this.fixedPriceQuantity = fixedPriceQuantity } + fun groupedAllocationConfig(groupedAllocationConfig: GroupedAllocationConfig) = + groupedAllocationConfig(JsonField.of(groupedAllocationConfig)) + + fun groupedAllocationConfig( + groupedAllocationConfig: JsonField + ) = apply { this.groupedAllocationConfig = groupedAllocationConfig } + fun invoicingCycleConfiguration( invoicingCycleConfiguration: InvoicingCycleConfiguration? ) = invoicingCycleConfiguration(JsonField.ofNullable(invoicingCycleConfiguration)) @@ -36221,13 +38205,6 @@ private constructor( fun priceType(priceType: JsonField) = apply { this.priceType = priceType } - fun unitWithProrationConfig(unitWithProrationConfig: UnitWithProrationConfig) = - unitWithProrationConfig(JsonField.of(unitWithProrationConfig)) - - fun unitWithProrationConfig( - unitWithProrationConfig: JsonField - ) = apply { this.unitWithProrationConfig = unitWithProrationConfig } - fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -36247,8 +38224,8 @@ private constructor( keys.forEach(::removeAdditionalProperty) } - fun build(): UnitWithProrationPrice = - UnitWithProrationPrice( + fun build(): GroupedAllocationPrice = + GroupedAllocationPrice( checkRequired("id", id), checkRequired("billableMetric", billableMetric), checkRequired("billingCycleConfiguration", billingCycleConfiguration), @@ -36260,6 +38237,7 @@ private constructor( checkRequired("discount", discount), checkRequired("externalPriceId", externalPriceId), checkRequired("fixedPriceQuantity", fixedPriceQuantity), + checkRequired("groupedAllocationConfig", groupedAllocationConfig), checkRequired("invoicingCycleConfiguration", invoicingCycleConfiguration), checkRequired("item", item), checkRequired("maximum", maximum), @@ -36271,7 +38249,6 @@ private constructor( checkRequired("name", name), checkRequired("planPhaseOrder", planPhaseOrder), checkRequired("priceType", priceType), - checkRequired("unitWithProrationConfig", unitWithProrationConfig), additionalProperties.toImmutable(), ) } @@ -36749,6 +38726,89 @@ private constructor( "CreditAllocation{allowsRollover=$allowsRollover, currency=$currency, additionalProperties=$additionalProperties}" } + @NoAutoDetect + class GroupedAllocationConfig + @JsonCreator + private constructor( + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), + ) { + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + private var validated: Boolean = false + + fun validate(): GroupedAllocationConfig = apply { + if (validated) { + return@apply + } + + validated = true + } + + fun toBuilder() = Builder().from(this) + + companion object { + + @JvmStatic fun builder() = Builder() + } + + class Builder { + + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(groupedAllocationConfig: GroupedAllocationConfig) = apply { + additionalProperties = + groupedAllocationConfig.additionalProperties.toMutableMap() + } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + fun build(): GroupedAllocationConfig = + GroupedAllocationConfig(additionalProperties.toImmutable()) + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is GroupedAllocationConfig && additionalProperties == other.additionalProperties /* spotless:on */ + } + + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(additionalProperties) } + /* spotless:on */ + + override fun hashCode(): Int = hashCode + + override fun toString() = + "GroupedAllocationConfig{additionalProperties=$additionalProperties}" + } + @NoAutoDetect class InvoicingCycleConfiguration @JsonCreator @@ -37464,29 +39524,29 @@ private constructor( companion object { - @JvmField val UNIT_WITH_PRORATION = of("unit_with_proration") + @JvmField val GROUPED_ALLOCATION = of("grouped_allocation") @JvmStatic fun of(value: String) = ModelType(JsonField.of(value)) } enum class Known { - UNIT_WITH_PRORATION, + GROUPED_ALLOCATION, } enum class Value { - UNIT_WITH_PRORATION, + GROUPED_ALLOCATION, _UNKNOWN, } fun value(): Value = when (this) { - UNIT_WITH_PRORATION -> Value.UNIT_WITH_PRORATION + GROUPED_ALLOCATION -> Value.GROUPED_ALLOCATION else -> Value._UNKNOWN } fun known(): Known = when (this) { - UNIT_WITH_PRORATION -> Known.UNIT_WITH_PRORATION + GROUPED_ALLOCATION -> Known.GROUPED_ALLOCATION else -> throw OrbInvalidDataException("Unknown ModelType: $value") } @@ -37562,109 +39622,26 @@ private constructor( override fun toString() = value.toString() } - @NoAutoDetect - class UnitWithProrationConfig - @JsonCreator - private constructor( - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), - ) { - - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): UnitWithProrationConfig = apply { - if (validated) { - return@apply - } - - validated = true - } - - fun toBuilder() = Builder().from(this) - - companion object { - - @JvmStatic fun builder() = Builder() - } - - class Builder { - - private var additionalProperties: MutableMap = mutableMapOf() - - @JvmSynthetic - internal fun from(unitWithProrationConfig: UnitWithProrationConfig) = apply { - additionalProperties = - unitWithProrationConfig.additionalProperties.toMutableMap() - } - - fun additionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } - - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, value) - } - - fun putAllAdditionalProperties(additionalProperties: Map) = - apply { - this.additionalProperties.putAll(additionalProperties) - } - - fun removeAdditionalProperty(key: String) = apply { - additionalProperties.remove(key) - } - - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) - } - - fun build(): UnitWithProrationConfig = - UnitWithProrationConfig(additionalProperties.toImmutable()) - } - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is UnitWithProrationConfig && additionalProperties == other.additionalProperties /* spotless:on */ - } - - /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(additionalProperties) } - /* spotless:on */ - - override fun hashCode(): Int = hashCode - - override fun toString() = - "UnitWithProrationConfig{additionalProperties=$additionalProperties}" - } - override fun equals(other: Any?): Boolean { if (this === other) { return true } - return /* spotless:off */ other is UnitWithProrationPrice && id == other.id && billableMetric == other.billableMetric && billingCycleConfiguration == other.billingCycleConfiguration && cadence == other.cadence && conversionRate == other.conversionRate && createdAt == other.createdAt && creditAllocation == other.creditAllocation && currency == other.currency && discount == other.discount && externalPriceId == other.externalPriceId && fixedPriceQuantity == other.fixedPriceQuantity && invoicingCycleConfiguration == other.invoicingCycleConfiguration && item == other.item && maximum == other.maximum && maximumAmount == other.maximumAmount && metadata == other.metadata && minimum == other.minimum && minimumAmount == other.minimumAmount && modelType == other.modelType && name == other.name && planPhaseOrder == other.planPhaseOrder && priceType == other.priceType && unitWithProrationConfig == other.unitWithProrationConfig && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is GroupedAllocationPrice && id == other.id && billableMetric == other.billableMetric && billingCycleConfiguration == other.billingCycleConfiguration && cadence == other.cadence && conversionRate == other.conversionRate && createdAt == other.createdAt && creditAllocation == other.creditAllocation && currency == other.currency && discount == other.discount && externalPriceId == other.externalPriceId && fixedPriceQuantity == other.fixedPriceQuantity && groupedAllocationConfig == other.groupedAllocationConfig && invoicingCycleConfiguration == other.invoicingCycleConfiguration && item == other.item && maximum == other.maximum && maximumAmount == other.maximumAmount && metadata == other.metadata && minimum == other.minimum && minimumAmount == other.minimumAmount && modelType == other.modelType && name == other.name && planPhaseOrder == other.planPhaseOrder && priceType == other.priceType && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(id, billableMetric, billingCycleConfiguration, cadence, conversionRate, createdAt, creditAllocation, currency, discount, externalPriceId, fixedPriceQuantity, invoicingCycleConfiguration, item, maximum, maximumAmount, metadata, minimum, minimumAmount, modelType, name, planPhaseOrder, priceType, unitWithProrationConfig, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(id, billableMetric, billingCycleConfiguration, cadence, conversionRate, createdAt, creditAllocation, currency, discount, externalPriceId, fixedPriceQuantity, groupedAllocationConfig, invoicingCycleConfiguration, item, maximum, maximumAmount, metadata, minimum, minimumAmount, modelType, name, planPhaseOrder, priceType, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "UnitWithProrationPrice{id=$id, billableMetric=$billableMetric, billingCycleConfiguration=$billingCycleConfiguration, cadence=$cadence, conversionRate=$conversionRate, createdAt=$createdAt, creditAllocation=$creditAllocation, currency=$currency, discount=$discount, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoicingCycleConfiguration=$invoicingCycleConfiguration, item=$item, maximum=$maximum, maximumAmount=$maximumAmount, metadata=$metadata, minimum=$minimum, minimumAmount=$minimumAmount, modelType=$modelType, name=$name, planPhaseOrder=$planPhaseOrder, priceType=$priceType, unitWithProrationConfig=$unitWithProrationConfig, additionalProperties=$additionalProperties}" + "GroupedAllocationPrice{id=$id, billableMetric=$billableMetric, billingCycleConfiguration=$billingCycleConfiguration, cadence=$cadence, conversionRate=$conversionRate, createdAt=$createdAt, creditAllocation=$creditAllocation, currency=$currency, discount=$discount, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, groupedAllocationConfig=$groupedAllocationConfig, invoicingCycleConfiguration=$invoicingCycleConfiguration, item=$item, maximum=$maximum, maximumAmount=$maximumAmount, metadata=$metadata, minimum=$minimum, minimumAmount=$minimumAmount, modelType=$modelType, name=$name, planPhaseOrder=$planPhaseOrder, priceType=$priceType, additionalProperties=$additionalProperties}" } @NoAutoDetect - class GroupedAllocationPrice + class GroupedWithProratedMinimumPrice @JsonCreator private constructor( @JsonProperty("id") @ExcludeMissing private val id: JsonField = JsonMissing.of(), @@ -37699,9 +39676,10 @@ private constructor( @JsonProperty("fixed_price_quantity") @ExcludeMissing private val fixedPriceQuantity: JsonField = JsonMissing.of(), - @JsonProperty("grouped_allocation_config") + @JsonProperty("grouped_with_prorated_minimum_config") @ExcludeMissing - private val groupedAllocationConfig: JsonField = JsonMissing.of(), + private val groupedWithProratedMinimumConfig: JsonField = + JsonMissing.of(), @JsonProperty("invoicing_cycle_configuration") @ExcludeMissing private val invoicingCycleConfiguration: JsonField = @@ -37766,8 +39744,8 @@ private constructor( fun fixedPriceQuantity(): Optional = Optional.ofNullable(fixedPriceQuantity.getNullable("fixed_price_quantity")) - fun groupedAllocationConfig(): GroupedAllocationConfig = - groupedAllocationConfig.getRequired("grouped_allocation_config") + fun groupedWithProratedMinimumConfig(): GroupedWithProratedMinimumConfig = + groupedWithProratedMinimumConfig.getRequired("grouped_with_prorated_minimum_config") fun invoicingCycleConfiguration(): Optional = Optional.ofNullable( @@ -37839,9 +39817,10 @@ private constructor( @ExcludeMissing fun _fixedPriceQuantity(): JsonField = fixedPriceQuantity - @JsonProperty("grouped_allocation_config") + @JsonProperty("grouped_with_prorated_minimum_config") @ExcludeMissing - fun _groupedAllocationConfig(): JsonField = groupedAllocationConfig + fun _groupedWithProratedMinimumConfig(): JsonField = + groupedWithProratedMinimumConfig @JsonProperty("invoicing_cycle_configuration") @ExcludeMissing @@ -37889,7 +39868,7 @@ private constructor( private var validated: Boolean = false - fun validate(): GroupedAllocationPrice = apply { + fun validate(): GroupedWithProratedMinimumPrice = apply { if (validated) { return@apply } @@ -37905,7 +39884,7 @@ private constructor( discount().ifPresent { it.validate() } externalPriceId() fixedPriceQuantity() - groupedAllocationConfig().validate() + groupedWithProratedMinimumConfig().validate() invoicingCycleConfiguration().ifPresent { it.validate() } item().validate() maximum().ifPresent { it.validate() } @@ -37940,7 +39919,9 @@ private constructor( private var discount: JsonField? = null private var externalPriceId: JsonField? = null private var fixedPriceQuantity: JsonField? = null - private var groupedAllocationConfig: JsonField? = null + private var groupedWithProratedMinimumConfig: + JsonField? = + null private var invoicingCycleConfiguration: JsonField? = null private var item: JsonField? = null private var maximum: JsonField? = null @@ -37955,32 +39936,37 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(groupedAllocationPrice: GroupedAllocationPrice) = apply { - id = groupedAllocationPrice.id - billableMetric = groupedAllocationPrice.billableMetric - billingCycleConfiguration = groupedAllocationPrice.billingCycleConfiguration - cadence = groupedAllocationPrice.cadence - conversionRate = groupedAllocationPrice.conversionRate - createdAt = groupedAllocationPrice.createdAt - creditAllocation = groupedAllocationPrice.creditAllocation - currency = groupedAllocationPrice.currency - discount = groupedAllocationPrice.discount - externalPriceId = groupedAllocationPrice.externalPriceId - fixedPriceQuantity = groupedAllocationPrice.fixedPriceQuantity - groupedAllocationConfig = groupedAllocationPrice.groupedAllocationConfig - invoicingCycleConfiguration = groupedAllocationPrice.invoicingCycleConfiguration - item = groupedAllocationPrice.item - maximum = groupedAllocationPrice.maximum - maximumAmount = groupedAllocationPrice.maximumAmount - metadata = groupedAllocationPrice.metadata - minimum = groupedAllocationPrice.minimum - minimumAmount = groupedAllocationPrice.minimumAmount - modelType = groupedAllocationPrice.modelType - name = groupedAllocationPrice.name - planPhaseOrder = groupedAllocationPrice.planPhaseOrder - priceType = groupedAllocationPrice.priceType - additionalProperties = groupedAllocationPrice.additionalProperties.toMutableMap() - } + internal fun from(groupedWithProratedMinimumPrice: GroupedWithProratedMinimumPrice) = + apply { + id = groupedWithProratedMinimumPrice.id + billableMetric = groupedWithProratedMinimumPrice.billableMetric + billingCycleConfiguration = + groupedWithProratedMinimumPrice.billingCycleConfiguration + cadence = groupedWithProratedMinimumPrice.cadence + conversionRate = groupedWithProratedMinimumPrice.conversionRate + createdAt = groupedWithProratedMinimumPrice.createdAt + creditAllocation = groupedWithProratedMinimumPrice.creditAllocation + currency = groupedWithProratedMinimumPrice.currency + discount = groupedWithProratedMinimumPrice.discount + externalPriceId = groupedWithProratedMinimumPrice.externalPriceId + fixedPriceQuantity = groupedWithProratedMinimumPrice.fixedPriceQuantity + groupedWithProratedMinimumConfig = + groupedWithProratedMinimumPrice.groupedWithProratedMinimumConfig + invoicingCycleConfiguration = + groupedWithProratedMinimumPrice.invoicingCycleConfiguration + item = groupedWithProratedMinimumPrice.item + maximum = groupedWithProratedMinimumPrice.maximum + maximumAmount = groupedWithProratedMinimumPrice.maximumAmount + metadata = groupedWithProratedMinimumPrice.metadata + minimum = groupedWithProratedMinimumPrice.minimum + minimumAmount = groupedWithProratedMinimumPrice.minimumAmount + modelType = groupedWithProratedMinimumPrice.modelType + name = groupedWithProratedMinimumPrice.name + planPhaseOrder = groupedWithProratedMinimumPrice.planPhaseOrder + priceType = groupedWithProratedMinimumPrice.priceType + additionalProperties = + groupedWithProratedMinimumPrice.additionalProperties.toMutableMap() + } fun id(id: String) = id(JsonField.of(id)) @@ -38082,12 +40068,13 @@ private constructor( this.fixedPriceQuantity = fixedPriceQuantity } - fun groupedAllocationConfig(groupedAllocationConfig: GroupedAllocationConfig) = - groupedAllocationConfig(JsonField.of(groupedAllocationConfig)) + fun groupedWithProratedMinimumConfig( + groupedWithProratedMinimumConfig: GroupedWithProratedMinimumConfig + ) = groupedWithProratedMinimumConfig(JsonField.of(groupedWithProratedMinimumConfig)) - fun groupedAllocationConfig( - groupedAllocationConfig: JsonField - ) = apply { this.groupedAllocationConfig = groupedAllocationConfig } + fun groupedWithProratedMinimumConfig( + groupedWithProratedMinimumConfig: JsonField + ) = apply { this.groupedWithProratedMinimumConfig = groupedWithProratedMinimumConfig } fun invoicingCycleConfiguration( invoicingCycleConfiguration: InvoicingCycleConfiguration? @@ -38195,8 +40182,8 @@ private constructor( keys.forEach(::removeAdditionalProperty) } - fun build(): GroupedAllocationPrice = - GroupedAllocationPrice( + fun build(): GroupedWithProratedMinimumPrice = + GroupedWithProratedMinimumPrice( checkRequired("id", id), checkRequired("billableMetric", billableMetric), checkRequired("billingCycleConfiguration", billingCycleConfiguration), @@ -38208,7 +40195,10 @@ private constructor( checkRequired("discount", discount), checkRequired("externalPriceId", externalPriceId), checkRequired("fixedPriceQuantity", fixedPriceQuantity), - checkRequired("groupedAllocationConfig", groupedAllocationConfig), + checkRequired( + "groupedWithProratedMinimumConfig", + groupedWithProratedMinimumConfig + ), checkRequired("invoicingCycleConfiguration", invoicingCycleConfiguration), checkRequired("item", item), checkRequired("maximum", maximum), @@ -38698,7 +40688,7 @@ private constructor( } @NoAutoDetect - class GroupedAllocationConfig + class GroupedWithProratedMinimumConfig @JsonCreator private constructor( @JsonAnySetter @@ -38711,7 +40701,7 @@ private constructor( private var validated: Boolean = false - fun validate(): GroupedAllocationConfig = apply { + fun validate(): GroupedWithProratedMinimumConfig = apply { if (validated) { return@apply } @@ -38731,9 +40721,11 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(groupedAllocationConfig: GroupedAllocationConfig) = apply { + internal fun from( + groupedWithProratedMinimumConfig: GroupedWithProratedMinimumConfig + ) = apply { additionalProperties = - groupedAllocationConfig.additionalProperties.toMutableMap() + groupedWithProratedMinimumConfig.additionalProperties.toMutableMap() } fun additionalProperties(additionalProperties: Map) = apply { @@ -38758,8 +40750,8 @@ private constructor( keys.forEach(::removeAdditionalProperty) } - fun build(): GroupedAllocationConfig = - GroupedAllocationConfig(additionalProperties.toImmutable()) + fun build(): GroupedWithProratedMinimumConfig = + GroupedWithProratedMinimumConfig(additionalProperties.toImmutable()) } override fun equals(other: Any?): Boolean { @@ -38767,7 +40759,7 @@ private constructor( return true } - return /* spotless:off */ other is GroupedAllocationConfig && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is GroupedWithProratedMinimumConfig && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ @@ -38777,7 +40769,7 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "GroupedAllocationConfig{additionalProperties=$additionalProperties}" + "GroupedWithProratedMinimumConfig{additionalProperties=$additionalProperties}" } @NoAutoDetect @@ -39495,29 +41487,29 @@ private constructor( companion object { - @JvmField val GROUPED_ALLOCATION = of("grouped_allocation") + @JvmField val GROUPED_WITH_PRORATED_MINIMUM = of("grouped_with_prorated_minimum") @JvmStatic fun of(value: String) = ModelType(JsonField.of(value)) } enum class Known { - GROUPED_ALLOCATION, + GROUPED_WITH_PRORATED_MINIMUM, } enum class Value { - GROUPED_ALLOCATION, + GROUPED_WITH_PRORATED_MINIMUM, _UNKNOWN, } fun value(): Value = when (this) { - GROUPED_ALLOCATION -> Value.GROUPED_ALLOCATION + GROUPED_WITH_PRORATED_MINIMUM -> Value.GROUPED_WITH_PRORATED_MINIMUM else -> Value._UNKNOWN } fun known(): Known = when (this) { - GROUPED_ALLOCATION -> Known.GROUPED_ALLOCATION + GROUPED_WITH_PRORATED_MINIMUM -> Known.GROUPED_WITH_PRORATED_MINIMUM else -> throw OrbInvalidDataException("Unknown ModelType: $value") } @@ -39598,21 +41590,21 @@ private constructor( return true } - return /* spotless:off */ other is GroupedAllocationPrice && id == other.id && billableMetric == other.billableMetric && billingCycleConfiguration == other.billingCycleConfiguration && cadence == other.cadence && conversionRate == other.conversionRate && createdAt == other.createdAt && creditAllocation == other.creditAllocation && currency == other.currency && discount == other.discount && externalPriceId == other.externalPriceId && fixedPriceQuantity == other.fixedPriceQuantity && groupedAllocationConfig == other.groupedAllocationConfig && invoicingCycleConfiguration == other.invoicingCycleConfiguration && item == other.item && maximum == other.maximum && maximumAmount == other.maximumAmount && metadata == other.metadata && minimum == other.minimum && minimumAmount == other.minimumAmount && modelType == other.modelType && name == other.name && planPhaseOrder == other.planPhaseOrder && priceType == other.priceType && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is GroupedWithProratedMinimumPrice && id == other.id && billableMetric == other.billableMetric && billingCycleConfiguration == other.billingCycleConfiguration && cadence == other.cadence && conversionRate == other.conversionRate && createdAt == other.createdAt && creditAllocation == other.creditAllocation && currency == other.currency && discount == other.discount && externalPriceId == other.externalPriceId && fixedPriceQuantity == other.fixedPriceQuantity && groupedWithProratedMinimumConfig == other.groupedWithProratedMinimumConfig && invoicingCycleConfiguration == other.invoicingCycleConfiguration && item == other.item && maximum == other.maximum && maximumAmount == other.maximumAmount && metadata == other.metadata && minimum == other.minimum && minimumAmount == other.minimumAmount && modelType == other.modelType && name == other.name && planPhaseOrder == other.planPhaseOrder && priceType == other.priceType && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(id, billableMetric, billingCycleConfiguration, cadence, conversionRate, createdAt, creditAllocation, currency, discount, externalPriceId, fixedPriceQuantity, groupedAllocationConfig, invoicingCycleConfiguration, item, maximum, maximumAmount, metadata, minimum, minimumAmount, modelType, name, planPhaseOrder, priceType, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(id, billableMetric, billingCycleConfiguration, cadence, conversionRate, createdAt, creditAllocation, currency, discount, externalPriceId, fixedPriceQuantity, groupedWithProratedMinimumConfig, invoicingCycleConfiguration, item, maximum, maximumAmount, metadata, minimum, minimumAmount, modelType, name, planPhaseOrder, priceType, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "GroupedAllocationPrice{id=$id, billableMetric=$billableMetric, billingCycleConfiguration=$billingCycleConfiguration, cadence=$cadence, conversionRate=$conversionRate, createdAt=$createdAt, creditAllocation=$creditAllocation, currency=$currency, discount=$discount, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, groupedAllocationConfig=$groupedAllocationConfig, invoicingCycleConfiguration=$invoicingCycleConfiguration, item=$item, maximum=$maximum, maximumAmount=$maximumAmount, metadata=$metadata, minimum=$minimum, minimumAmount=$minimumAmount, modelType=$modelType, name=$name, planPhaseOrder=$planPhaseOrder, priceType=$priceType, additionalProperties=$additionalProperties}" + "GroupedWithProratedMinimumPrice{id=$id, billableMetric=$billableMetric, billingCycleConfiguration=$billingCycleConfiguration, cadence=$cadence, conversionRate=$conversionRate, createdAt=$createdAt, creditAllocation=$creditAllocation, currency=$currency, discount=$discount, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, groupedWithProratedMinimumConfig=$groupedWithProratedMinimumConfig, invoicingCycleConfiguration=$invoicingCycleConfiguration, item=$item, maximum=$maximum, maximumAmount=$maximumAmount, metadata=$metadata, minimum=$minimum, minimumAmount=$minimumAmount, modelType=$modelType, name=$name, planPhaseOrder=$planPhaseOrder, priceType=$priceType, additionalProperties=$additionalProperties}" } @NoAutoDetect - class GroupedWithProratedMinimumPrice + class GroupedWithMeteredMinimumPrice @JsonCreator private constructor( @JsonProperty("id") @ExcludeMissing private val id: JsonField = JsonMissing.of(), @@ -39647,9 +41639,9 @@ private constructor( @JsonProperty("fixed_price_quantity") @ExcludeMissing private val fixedPriceQuantity: JsonField = JsonMissing.of(), - @JsonProperty("grouped_with_prorated_minimum_config") + @JsonProperty("grouped_with_metered_minimum_config") @ExcludeMissing - private val groupedWithProratedMinimumConfig: JsonField = + private val groupedWithMeteredMinimumConfig: JsonField = JsonMissing.of(), @JsonProperty("invoicing_cycle_configuration") @ExcludeMissing @@ -39715,8 +41707,8 @@ private constructor( fun fixedPriceQuantity(): Optional = Optional.ofNullable(fixedPriceQuantity.getNullable("fixed_price_quantity")) - fun groupedWithProratedMinimumConfig(): GroupedWithProratedMinimumConfig = - groupedWithProratedMinimumConfig.getRequired("grouped_with_prorated_minimum_config") + fun groupedWithMeteredMinimumConfig(): GroupedWithMeteredMinimumConfig = + groupedWithMeteredMinimumConfig.getRequired("grouped_with_metered_minimum_config") fun invoicingCycleConfiguration(): Optional = Optional.ofNullable( @@ -39788,10 +41780,10 @@ private constructor( @ExcludeMissing fun _fixedPriceQuantity(): JsonField = fixedPriceQuantity - @JsonProperty("grouped_with_prorated_minimum_config") + @JsonProperty("grouped_with_metered_minimum_config") @ExcludeMissing - fun _groupedWithProratedMinimumConfig(): JsonField = - groupedWithProratedMinimumConfig + fun _groupedWithMeteredMinimumConfig(): JsonField = + groupedWithMeteredMinimumConfig @JsonProperty("invoicing_cycle_configuration") @ExcludeMissing @@ -39839,7 +41831,7 @@ private constructor( private var validated: Boolean = false - fun validate(): GroupedWithProratedMinimumPrice = apply { + fun validate(): GroupedWithMeteredMinimumPrice = apply { if (validated) { return@apply } @@ -39855,7 +41847,7 @@ private constructor( discount().ifPresent { it.validate() } externalPriceId() fixedPriceQuantity() - groupedWithProratedMinimumConfig().validate() + groupedWithMeteredMinimumConfig().validate() invoicingCycleConfiguration().ifPresent { it.validate() } item().validate() maximum().ifPresent { it.validate() } @@ -39890,8 +41882,8 @@ private constructor( private var discount: JsonField? = null private var externalPriceId: JsonField? = null private var fixedPriceQuantity: JsonField? = null - private var groupedWithProratedMinimumConfig: - JsonField? = + private var groupedWithMeteredMinimumConfig: + JsonField? = null private var invoicingCycleConfiguration: JsonField? = null private var item: JsonField? = null @@ -39907,36 +41899,36 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(groupedWithProratedMinimumPrice: GroupedWithProratedMinimumPrice) = + internal fun from(groupedWithMeteredMinimumPrice: GroupedWithMeteredMinimumPrice) = apply { - id = groupedWithProratedMinimumPrice.id - billableMetric = groupedWithProratedMinimumPrice.billableMetric + id = groupedWithMeteredMinimumPrice.id + billableMetric = groupedWithMeteredMinimumPrice.billableMetric billingCycleConfiguration = - groupedWithProratedMinimumPrice.billingCycleConfiguration - cadence = groupedWithProratedMinimumPrice.cadence - conversionRate = groupedWithProratedMinimumPrice.conversionRate - createdAt = groupedWithProratedMinimumPrice.createdAt - creditAllocation = groupedWithProratedMinimumPrice.creditAllocation - currency = groupedWithProratedMinimumPrice.currency - discount = groupedWithProratedMinimumPrice.discount - externalPriceId = groupedWithProratedMinimumPrice.externalPriceId - fixedPriceQuantity = groupedWithProratedMinimumPrice.fixedPriceQuantity - groupedWithProratedMinimumConfig = - groupedWithProratedMinimumPrice.groupedWithProratedMinimumConfig + groupedWithMeteredMinimumPrice.billingCycleConfiguration + cadence = groupedWithMeteredMinimumPrice.cadence + conversionRate = groupedWithMeteredMinimumPrice.conversionRate + createdAt = groupedWithMeteredMinimumPrice.createdAt + creditAllocation = groupedWithMeteredMinimumPrice.creditAllocation + currency = groupedWithMeteredMinimumPrice.currency + discount = groupedWithMeteredMinimumPrice.discount + externalPriceId = groupedWithMeteredMinimumPrice.externalPriceId + fixedPriceQuantity = groupedWithMeteredMinimumPrice.fixedPriceQuantity + groupedWithMeteredMinimumConfig = + groupedWithMeteredMinimumPrice.groupedWithMeteredMinimumConfig invoicingCycleConfiguration = - groupedWithProratedMinimumPrice.invoicingCycleConfiguration - item = groupedWithProratedMinimumPrice.item - maximum = groupedWithProratedMinimumPrice.maximum - maximumAmount = groupedWithProratedMinimumPrice.maximumAmount - metadata = groupedWithProratedMinimumPrice.metadata - minimum = groupedWithProratedMinimumPrice.minimum - minimumAmount = groupedWithProratedMinimumPrice.minimumAmount - modelType = groupedWithProratedMinimumPrice.modelType - name = groupedWithProratedMinimumPrice.name - planPhaseOrder = groupedWithProratedMinimumPrice.planPhaseOrder - priceType = groupedWithProratedMinimumPrice.priceType + groupedWithMeteredMinimumPrice.invoicingCycleConfiguration + item = groupedWithMeteredMinimumPrice.item + maximum = groupedWithMeteredMinimumPrice.maximum + maximumAmount = groupedWithMeteredMinimumPrice.maximumAmount + metadata = groupedWithMeteredMinimumPrice.metadata + minimum = groupedWithMeteredMinimumPrice.minimum + minimumAmount = groupedWithMeteredMinimumPrice.minimumAmount + modelType = groupedWithMeteredMinimumPrice.modelType + name = groupedWithMeteredMinimumPrice.name + planPhaseOrder = groupedWithMeteredMinimumPrice.planPhaseOrder + priceType = groupedWithMeteredMinimumPrice.priceType additionalProperties = - groupedWithProratedMinimumPrice.additionalProperties.toMutableMap() + groupedWithMeteredMinimumPrice.additionalProperties.toMutableMap() } fun id(id: String) = id(JsonField.of(id)) @@ -40039,13 +42031,13 @@ private constructor( this.fixedPriceQuantity = fixedPriceQuantity } - fun groupedWithProratedMinimumConfig( - groupedWithProratedMinimumConfig: GroupedWithProratedMinimumConfig - ) = groupedWithProratedMinimumConfig(JsonField.of(groupedWithProratedMinimumConfig)) + fun groupedWithMeteredMinimumConfig( + groupedWithMeteredMinimumConfig: GroupedWithMeteredMinimumConfig + ) = groupedWithMeteredMinimumConfig(JsonField.of(groupedWithMeteredMinimumConfig)) - fun groupedWithProratedMinimumConfig( - groupedWithProratedMinimumConfig: JsonField - ) = apply { this.groupedWithProratedMinimumConfig = groupedWithProratedMinimumConfig } + fun groupedWithMeteredMinimumConfig( + groupedWithMeteredMinimumConfig: JsonField + ) = apply { this.groupedWithMeteredMinimumConfig = groupedWithMeteredMinimumConfig } fun invoicingCycleConfiguration( invoicingCycleConfiguration: InvoicingCycleConfiguration? @@ -40153,8 +42145,8 @@ private constructor( keys.forEach(::removeAdditionalProperty) } - fun build(): GroupedWithProratedMinimumPrice = - GroupedWithProratedMinimumPrice( + fun build(): GroupedWithMeteredMinimumPrice = + GroupedWithMeteredMinimumPrice( checkRequired("id", id), checkRequired("billableMetric", billableMetric), checkRequired("billingCycleConfiguration", billingCycleConfiguration), @@ -40167,8 +42159,8 @@ private constructor( checkRequired("externalPriceId", externalPriceId), checkRequired("fixedPriceQuantity", fixedPriceQuantity), checkRequired( - "groupedWithProratedMinimumConfig", - groupedWithProratedMinimumConfig + "groupedWithMeteredMinimumConfig", + groupedWithMeteredMinimumConfig ), checkRequired("invoicingCycleConfiguration", invoicingCycleConfiguration), checkRequired("item", item), @@ -40659,7 +42651,7 @@ private constructor( } @NoAutoDetect - class GroupedWithProratedMinimumConfig + class GroupedWithMeteredMinimumConfig @JsonCreator private constructor( @JsonAnySetter @@ -40672,7 +42664,7 @@ private constructor( private var validated: Boolean = false - fun validate(): GroupedWithProratedMinimumConfig = apply { + fun validate(): GroupedWithMeteredMinimumConfig = apply { if (validated) { return@apply } @@ -40693,10 +42685,10 @@ private constructor( @JvmSynthetic internal fun from( - groupedWithProratedMinimumConfig: GroupedWithProratedMinimumConfig + groupedWithMeteredMinimumConfig: GroupedWithMeteredMinimumConfig ) = apply { additionalProperties = - groupedWithProratedMinimumConfig.additionalProperties.toMutableMap() + groupedWithMeteredMinimumConfig.additionalProperties.toMutableMap() } fun additionalProperties(additionalProperties: Map) = apply { @@ -40721,8 +42713,8 @@ private constructor( keys.forEach(::removeAdditionalProperty) } - fun build(): GroupedWithProratedMinimumConfig = - GroupedWithProratedMinimumConfig(additionalProperties.toImmutable()) + fun build(): GroupedWithMeteredMinimumConfig = + GroupedWithMeteredMinimumConfig(additionalProperties.toImmutable()) } override fun equals(other: Any?): Boolean { @@ -40730,7 +42722,7 @@ private constructor( return true } - return /* spotless:off */ other is GroupedWithProratedMinimumConfig && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is GroupedWithMeteredMinimumConfig && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ @@ -40740,7 +42732,7 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "GroupedWithProratedMinimumConfig{additionalProperties=$additionalProperties}" + "GroupedWithMeteredMinimumConfig{additionalProperties=$additionalProperties}" } @NoAutoDetect @@ -41458,29 +43450,29 @@ private constructor( companion object { - @JvmField val GROUPED_WITH_PRORATED_MINIMUM = of("grouped_with_prorated_minimum") + @JvmField val GROUPED_WITH_METERED_MINIMUM = of("grouped_with_metered_minimum") @JvmStatic fun of(value: String) = ModelType(JsonField.of(value)) } enum class Known { - GROUPED_WITH_PRORATED_MINIMUM, + GROUPED_WITH_METERED_MINIMUM, } enum class Value { - GROUPED_WITH_PRORATED_MINIMUM, + GROUPED_WITH_METERED_MINIMUM, _UNKNOWN, } fun value(): Value = when (this) { - GROUPED_WITH_PRORATED_MINIMUM -> Value.GROUPED_WITH_PRORATED_MINIMUM + GROUPED_WITH_METERED_MINIMUM -> Value.GROUPED_WITH_METERED_MINIMUM else -> Value._UNKNOWN } fun known(): Known = when (this) { - GROUPED_WITH_PRORATED_MINIMUM -> Known.GROUPED_WITH_PRORATED_MINIMUM + GROUPED_WITH_METERED_MINIMUM -> Known.GROUPED_WITH_METERED_MINIMUM else -> throw OrbInvalidDataException("Unknown ModelType: $value") } @@ -41561,21 +43553,21 @@ private constructor( return true } - return /* spotless:off */ other is GroupedWithProratedMinimumPrice && id == other.id && billableMetric == other.billableMetric && billingCycleConfiguration == other.billingCycleConfiguration && cadence == other.cadence && conversionRate == other.conversionRate && createdAt == other.createdAt && creditAllocation == other.creditAllocation && currency == other.currency && discount == other.discount && externalPriceId == other.externalPriceId && fixedPriceQuantity == other.fixedPriceQuantity && groupedWithProratedMinimumConfig == other.groupedWithProratedMinimumConfig && invoicingCycleConfiguration == other.invoicingCycleConfiguration && item == other.item && maximum == other.maximum && maximumAmount == other.maximumAmount && metadata == other.metadata && minimum == other.minimum && minimumAmount == other.minimumAmount && modelType == other.modelType && name == other.name && planPhaseOrder == other.planPhaseOrder && priceType == other.priceType && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is GroupedWithMeteredMinimumPrice && id == other.id && billableMetric == other.billableMetric && billingCycleConfiguration == other.billingCycleConfiguration && cadence == other.cadence && conversionRate == other.conversionRate && createdAt == other.createdAt && creditAllocation == other.creditAllocation && currency == other.currency && discount == other.discount && externalPriceId == other.externalPriceId && fixedPriceQuantity == other.fixedPriceQuantity && groupedWithMeteredMinimumConfig == other.groupedWithMeteredMinimumConfig && invoicingCycleConfiguration == other.invoicingCycleConfiguration && item == other.item && maximum == other.maximum && maximumAmount == other.maximumAmount && metadata == other.metadata && minimum == other.minimum && minimumAmount == other.minimumAmount && modelType == other.modelType && name == other.name && planPhaseOrder == other.planPhaseOrder && priceType == other.priceType && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(id, billableMetric, billingCycleConfiguration, cadence, conversionRate, createdAt, creditAllocation, currency, discount, externalPriceId, fixedPriceQuantity, groupedWithProratedMinimumConfig, invoicingCycleConfiguration, item, maximum, maximumAmount, metadata, minimum, minimumAmount, modelType, name, planPhaseOrder, priceType, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(id, billableMetric, billingCycleConfiguration, cadence, conversionRate, createdAt, creditAllocation, currency, discount, externalPriceId, fixedPriceQuantity, groupedWithMeteredMinimumConfig, invoicingCycleConfiguration, item, maximum, maximumAmount, metadata, minimum, minimumAmount, modelType, name, planPhaseOrder, priceType, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "GroupedWithProratedMinimumPrice{id=$id, billableMetric=$billableMetric, billingCycleConfiguration=$billingCycleConfiguration, cadence=$cadence, conversionRate=$conversionRate, createdAt=$createdAt, creditAllocation=$creditAllocation, currency=$currency, discount=$discount, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, groupedWithProratedMinimumConfig=$groupedWithProratedMinimumConfig, invoicingCycleConfiguration=$invoicingCycleConfiguration, item=$item, maximum=$maximum, maximumAmount=$maximumAmount, metadata=$metadata, minimum=$minimum, minimumAmount=$minimumAmount, modelType=$modelType, name=$name, planPhaseOrder=$planPhaseOrder, priceType=$priceType, additionalProperties=$additionalProperties}" + "GroupedWithMeteredMinimumPrice{id=$id, billableMetric=$billableMetric, billingCycleConfiguration=$billingCycleConfiguration, cadence=$cadence, conversionRate=$conversionRate, createdAt=$createdAt, creditAllocation=$creditAllocation, currency=$currency, discount=$discount, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, groupedWithMeteredMinimumConfig=$groupedWithMeteredMinimumConfig, invoicingCycleConfiguration=$invoicingCycleConfiguration, item=$item, maximum=$maximum, maximumAmount=$maximumAmount, metadata=$metadata, minimum=$minimum, minimumAmount=$minimumAmount, modelType=$modelType, name=$name, planPhaseOrder=$planPhaseOrder, priceType=$priceType, additionalProperties=$additionalProperties}" } @NoAutoDetect - class GroupedWithMeteredMinimumPrice + class MatrixWithDisplayNamePrice @JsonCreator private constructor( @JsonProperty("id") @ExcludeMissing private val id: JsonField = JsonMissing.of(), @@ -41610,15 +43602,15 @@ private constructor( @JsonProperty("fixed_price_quantity") @ExcludeMissing private val fixedPriceQuantity: JsonField = JsonMissing.of(), - @JsonProperty("grouped_with_metered_minimum_config") - @ExcludeMissing - private val groupedWithMeteredMinimumConfig: JsonField = - JsonMissing.of(), @JsonProperty("invoicing_cycle_configuration") @ExcludeMissing private val invoicingCycleConfiguration: JsonField = JsonMissing.of(), @JsonProperty("item") @ExcludeMissing private val item: JsonField = JsonMissing.of(), + @JsonProperty("matrix_with_display_name_config") + @ExcludeMissing + private val matrixWithDisplayNameConfig: JsonField = + JsonMissing.of(), @JsonProperty("maximum") @ExcludeMissing private val maximum: JsonField = JsonMissing.of(), @@ -41678,9 +43670,6 @@ private constructor( fun fixedPriceQuantity(): Optional = Optional.ofNullable(fixedPriceQuantity.getNullable("fixed_price_quantity")) - fun groupedWithMeteredMinimumConfig(): GroupedWithMeteredMinimumConfig = - groupedWithMeteredMinimumConfig.getRequired("grouped_with_metered_minimum_config") - fun invoicingCycleConfiguration(): Optional = Optional.ofNullable( invoicingCycleConfiguration.getNullable("invoicing_cycle_configuration") @@ -41688,6 +43677,9 @@ private constructor( fun item(): Item = item.getRequired("item") + fun matrixWithDisplayNameConfig(): MatrixWithDisplayNameConfig = + matrixWithDisplayNameConfig.getRequired("matrix_with_display_name_config") + fun maximum(): Optional = Optional.ofNullable(maximum.getNullable("maximum")) fun maximumAmount(): Optional = @@ -41751,11 +43743,6 @@ private constructor( @ExcludeMissing fun _fixedPriceQuantity(): JsonField = fixedPriceQuantity - @JsonProperty("grouped_with_metered_minimum_config") - @ExcludeMissing - fun _groupedWithMeteredMinimumConfig(): JsonField = - groupedWithMeteredMinimumConfig - @JsonProperty("invoicing_cycle_configuration") @ExcludeMissing fun _invoicingCycleConfiguration(): JsonField = @@ -41763,6 +43750,11 @@ private constructor( @JsonProperty("item") @ExcludeMissing fun _item(): JsonField = item + @JsonProperty("matrix_with_display_name_config") + @ExcludeMissing + fun _matrixWithDisplayNameConfig(): JsonField = + matrixWithDisplayNameConfig + @JsonProperty("maximum") @ExcludeMissing fun _maximum(): JsonField = maximum @JsonProperty("maximum_amount") @@ -41802,7 +43794,7 @@ private constructor( private var validated: Boolean = false - fun validate(): GroupedWithMeteredMinimumPrice = apply { + fun validate(): MatrixWithDisplayNamePrice = apply { if (validated) { return@apply } @@ -41818,9 +43810,9 @@ private constructor( discount().ifPresent { it.validate() } externalPriceId() fixedPriceQuantity() - groupedWithMeteredMinimumConfig().validate() invoicingCycleConfiguration().ifPresent { it.validate() } item().validate() + matrixWithDisplayNameConfig().validate() maximum().ifPresent { it.validate() } maximumAmount() metadata().validate() @@ -41853,11 +43845,9 @@ private constructor( private var discount: JsonField? = null private var externalPriceId: JsonField? = null private var fixedPriceQuantity: JsonField? = null - private var groupedWithMeteredMinimumConfig: - JsonField? = - null private var invoicingCycleConfiguration: JsonField? = null private var item: JsonField? = null + private var matrixWithDisplayNameConfig: JsonField? = null private var maximum: JsonField? = null private var maximumAmount: JsonField? = null private var metadata: JsonField? = null @@ -41870,37 +43860,33 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(groupedWithMeteredMinimumPrice: GroupedWithMeteredMinimumPrice) = - apply { - id = groupedWithMeteredMinimumPrice.id - billableMetric = groupedWithMeteredMinimumPrice.billableMetric - billingCycleConfiguration = - groupedWithMeteredMinimumPrice.billingCycleConfiguration - cadence = groupedWithMeteredMinimumPrice.cadence - conversionRate = groupedWithMeteredMinimumPrice.conversionRate - createdAt = groupedWithMeteredMinimumPrice.createdAt - creditAllocation = groupedWithMeteredMinimumPrice.creditAllocation - currency = groupedWithMeteredMinimumPrice.currency - discount = groupedWithMeteredMinimumPrice.discount - externalPriceId = groupedWithMeteredMinimumPrice.externalPriceId - fixedPriceQuantity = groupedWithMeteredMinimumPrice.fixedPriceQuantity - groupedWithMeteredMinimumConfig = - groupedWithMeteredMinimumPrice.groupedWithMeteredMinimumConfig - invoicingCycleConfiguration = - groupedWithMeteredMinimumPrice.invoicingCycleConfiguration - item = groupedWithMeteredMinimumPrice.item - maximum = groupedWithMeteredMinimumPrice.maximum - maximumAmount = groupedWithMeteredMinimumPrice.maximumAmount - metadata = groupedWithMeteredMinimumPrice.metadata - minimum = groupedWithMeteredMinimumPrice.minimum - minimumAmount = groupedWithMeteredMinimumPrice.minimumAmount - modelType = groupedWithMeteredMinimumPrice.modelType - name = groupedWithMeteredMinimumPrice.name - planPhaseOrder = groupedWithMeteredMinimumPrice.planPhaseOrder - priceType = groupedWithMeteredMinimumPrice.priceType - additionalProperties = - groupedWithMeteredMinimumPrice.additionalProperties.toMutableMap() - } + internal fun from(matrixWithDisplayNamePrice: MatrixWithDisplayNamePrice) = apply { + id = matrixWithDisplayNamePrice.id + billableMetric = matrixWithDisplayNamePrice.billableMetric + billingCycleConfiguration = matrixWithDisplayNamePrice.billingCycleConfiguration + cadence = matrixWithDisplayNamePrice.cadence + conversionRate = matrixWithDisplayNamePrice.conversionRate + createdAt = matrixWithDisplayNamePrice.createdAt + creditAllocation = matrixWithDisplayNamePrice.creditAllocation + currency = matrixWithDisplayNamePrice.currency + discount = matrixWithDisplayNamePrice.discount + externalPriceId = matrixWithDisplayNamePrice.externalPriceId + fixedPriceQuantity = matrixWithDisplayNamePrice.fixedPriceQuantity + invoicingCycleConfiguration = matrixWithDisplayNamePrice.invoicingCycleConfiguration + item = matrixWithDisplayNamePrice.item + matrixWithDisplayNameConfig = matrixWithDisplayNamePrice.matrixWithDisplayNameConfig + maximum = matrixWithDisplayNamePrice.maximum + maximumAmount = matrixWithDisplayNamePrice.maximumAmount + metadata = matrixWithDisplayNamePrice.metadata + minimum = matrixWithDisplayNamePrice.minimum + minimumAmount = matrixWithDisplayNamePrice.minimumAmount + modelType = matrixWithDisplayNamePrice.modelType + name = matrixWithDisplayNamePrice.name + planPhaseOrder = matrixWithDisplayNamePrice.planPhaseOrder + priceType = matrixWithDisplayNamePrice.priceType + additionalProperties = + matrixWithDisplayNamePrice.additionalProperties.toMutableMap() + } fun id(id: String) = id(JsonField.of(id)) @@ -42002,14 +43988,6 @@ private constructor( this.fixedPriceQuantity = fixedPriceQuantity } - fun groupedWithMeteredMinimumConfig( - groupedWithMeteredMinimumConfig: GroupedWithMeteredMinimumConfig - ) = groupedWithMeteredMinimumConfig(JsonField.of(groupedWithMeteredMinimumConfig)) - - fun groupedWithMeteredMinimumConfig( - groupedWithMeteredMinimumConfig: JsonField - ) = apply { this.groupedWithMeteredMinimumConfig = groupedWithMeteredMinimumConfig } - fun invoicingCycleConfiguration( invoicingCycleConfiguration: InvoicingCycleConfiguration? ) = invoicingCycleConfiguration(JsonField.ofNullable(invoicingCycleConfiguration)) @@ -42026,6 +44004,14 @@ private constructor( fun item(item: JsonField) = apply { this.item = item } + fun matrixWithDisplayNameConfig( + matrixWithDisplayNameConfig: MatrixWithDisplayNameConfig + ) = matrixWithDisplayNameConfig(JsonField.of(matrixWithDisplayNameConfig)) + + fun matrixWithDisplayNameConfig( + matrixWithDisplayNameConfig: JsonField + ) = apply { this.matrixWithDisplayNameConfig = matrixWithDisplayNameConfig } + fun maximum(maximum: Maximum?) = maximum(JsonField.ofNullable(maximum)) fun maximum(maximum: Optional) = maximum(maximum.orElse(null)) @@ -42116,8 +44102,8 @@ private constructor( keys.forEach(::removeAdditionalProperty) } - fun build(): GroupedWithMeteredMinimumPrice = - GroupedWithMeteredMinimumPrice( + fun build(): MatrixWithDisplayNamePrice = + MatrixWithDisplayNamePrice( checkRequired("id", id), checkRequired("billableMetric", billableMetric), checkRequired("billingCycleConfiguration", billingCycleConfiguration), @@ -42129,12 +44115,9 @@ private constructor( checkRequired("discount", discount), checkRequired("externalPriceId", externalPriceId), checkRequired("fixedPriceQuantity", fixedPriceQuantity), - checkRequired( - "groupedWithMeteredMinimumConfig", - groupedWithMeteredMinimumConfig - ), checkRequired("invoicingCycleConfiguration", invoicingCycleConfiguration), checkRequired("item", item), + checkRequired("matrixWithDisplayNameConfig", matrixWithDisplayNameConfig), checkRequired("maximum", maximum), checkRequired("maximumAmount", maximumAmount), checkRequired("metadata", metadata), @@ -42622,24 +44605,42 @@ private constructor( } @NoAutoDetect - class GroupedWithMeteredMinimumConfig + class InvoicingCycleConfiguration @JsonCreator private constructor( + @JsonProperty("duration") + @ExcludeMissing + private val duration: JsonField = JsonMissing.of(), + @JsonProperty("duration_unit") + @ExcludeMissing + private val durationUnit: JsonField = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { + fun duration(): Long = duration.getRequired("duration") + + fun durationUnit(): DurationUnit = durationUnit.getRequired("duration_unit") + + @JsonProperty("duration") @ExcludeMissing fun _duration(): JsonField = duration + + @JsonProperty("duration_unit") + @ExcludeMissing + fun _durationUnit(): JsonField = durationUnit + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties private var validated: Boolean = false - fun validate(): GroupedWithMeteredMinimumConfig = apply { + fun validate(): InvoicingCycleConfiguration = apply { if (validated) { return@apply } + duration() + durationUnit() validated = true } @@ -42652,16 +44653,201 @@ private constructor( class Builder { + private var duration: JsonField? = null + private var durationUnit: JsonField? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from( - groupedWithMeteredMinimumConfig: GroupedWithMeteredMinimumConfig - ) = apply { - additionalProperties = - groupedWithMeteredMinimumConfig.additionalProperties.toMutableMap() + internal fun from(invoicingCycleConfiguration: InvoicingCycleConfiguration) = + apply { + duration = invoicingCycleConfiguration.duration + durationUnit = invoicingCycleConfiguration.durationUnit + additionalProperties = + invoicingCycleConfiguration.additionalProperties.toMutableMap() + } + + fun duration(duration: Long) = duration(JsonField.of(duration)) + + fun duration(duration: JsonField) = apply { this.duration = duration } + + fun durationUnit(durationUnit: DurationUnit) = + durationUnit(JsonField.of(durationUnit)) + + fun durationUnit(durationUnit: JsonField) = apply { + this.durationUnit = durationUnit + } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + fun build(): InvoicingCycleConfiguration = + InvoicingCycleConfiguration( + checkRequired("duration", duration), + checkRequired("durationUnit", durationUnit), + additionalProperties.toImmutable(), + ) + } + + class DurationUnit + @JsonCreator + private constructor( + private val value: JsonField, + ) : Enum { + + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + + companion object { + + @JvmField val DAY = of("day") + + @JvmField val MONTH = of("month") + + @JvmStatic fun of(value: String) = DurationUnit(JsonField.of(value)) + } + + enum class Known { + DAY, + MONTH, + } + + enum class Value { + DAY, + MONTH, + _UNKNOWN, + } + + fun value(): Value = + when (this) { + DAY -> Value.DAY + MONTH -> Value.MONTH + else -> Value._UNKNOWN + } + + fun known(): Known = + when (this) { + DAY -> Known.DAY + MONTH -> Known.MONTH + else -> throw OrbInvalidDataException("Unknown DurationUnit: $value") + } + + fun asString(): String = _value().asStringOrThrow() + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is DurationUnit && value == other.value /* spotless:on */ + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is InvoicingCycleConfiguration && duration == other.duration && durationUnit == other.durationUnit && additionalProperties == other.additionalProperties /* spotless:on */ + } + + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(duration, durationUnit, additionalProperties) } + /* spotless:on */ + + override fun hashCode(): Int = hashCode + + override fun toString() = + "InvoicingCycleConfiguration{duration=$duration, durationUnit=$durationUnit, additionalProperties=$additionalProperties}" + } + + @NoAutoDetect + class Item + @JsonCreator + private constructor( + @JsonProperty("id") + @ExcludeMissing + private val id: JsonField = JsonMissing.of(), + @JsonProperty("name") + @ExcludeMissing + private val name: JsonField = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), + ) { + + fun id(): String = id.getRequired("id") + + fun name(): String = name.getRequired("name") + + @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id + + @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + private var validated: Boolean = false + + fun validate(): Item = apply { + if (validated) { + return@apply + } + + id() + name() + validated = true + } + + fun toBuilder() = Builder().from(this) + + companion object { + + @JvmStatic fun builder() = Builder() + } + + class Builder { + + private var id: JsonField? = null + private var name: JsonField? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(item: Item) = apply { + id = item.id + name = item.name + additionalProperties = item.additionalProperties.toMutableMap() } + fun id(id: String) = id(JsonField.of(id)) + + fun id(id: JsonField) = apply { this.id = id } + + fun name(name: String) = name(JsonField.of(name)) + + fun name(name: JsonField) = apply { this.name = name } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -42684,8 +44870,12 @@ private constructor( keys.forEach(::removeAdditionalProperty) } - fun build(): GroupedWithMeteredMinimumConfig = - GroupedWithMeteredMinimumConfig(additionalProperties.toImmutable()) + fun build(): Item = + Item( + checkRequired("id", id), + checkRequired("name", name), + additionalProperties.toImmutable(), + ) } override fun equals(other: Any?): Boolean { @@ -42693,56 +44883,38 @@ private constructor( return true } - return /* spotless:off */ other is GroupedWithMeteredMinimumConfig && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Item && id == other.id && name == other.name && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(id, name, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "GroupedWithMeteredMinimumConfig{additionalProperties=$additionalProperties}" + "Item{id=$id, name=$name, additionalProperties=$additionalProperties}" } @NoAutoDetect - class InvoicingCycleConfiguration + class MatrixWithDisplayNameConfig @JsonCreator private constructor( - @JsonProperty("duration") - @ExcludeMissing - private val duration: JsonField = JsonMissing.of(), - @JsonProperty("duration_unit") - @ExcludeMissing - private val durationUnit: JsonField = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - fun duration(): Long = duration.getRequired("duration") - - fun durationUnit(): DurationUnit = durationUnit.getRequired("duration_unit") - - @JsonProperty("duration") @ExcludeMissing fun _duration(): JsonField = duration - - @JsonProperty("duration_unit") - @ExcludeMissing - fun _durationUnit(): JsonField = durationUnit - @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties private var validated: Boolean = false - fun validate(): InvoicingCycleConfiguration = apply { + fun validate(): MatrixWithDisplayNameConfig = apply { if (validated) { return@apply } - duration() - durationUnit() validated = true } @@ -42755,30 +44927,15 @@ private constructor( class Builder { - private var duration: JsonField? = null - private var durationUnit: JsonField? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(invoicingCycleConfiguration: InvoicingCycleConfiguration) = + internal fun from(matrixWithDisplayNameConfig: MatrixWithDisplayNameConfig) = apply { - duration = invoicingCycleConfiguration.duration - durationUnit = invoicingCycleConfiguration.durationUnit additionalProperties = - invoicingCycleConfiguration.additionalProperties.toMutableMap() + matrixWithDisplayNameConfig.additionalProperties.toMutableMap() } - fun duration(duration: Long) = duration(JsonField.of(duration)) - - fun duration(duration: JsonField) = apply { this.duration = duration } - - fun durationUnit(durationUnit: DurationUnit) = - durationUnit(JsonField.of(durationUnit)) - - fun durationUnit(durationUnit: JsonField) = apply { - this.durationUnit = durationUnit - } - fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -42801,183 +44958,8 @@ private constructor( keys.forEach(::removeAdditionalProperty) } - fun build(): InvoicingCycleConfiguration = - InvoicingCycleConfiguration( - checkRequired("duration", duration), - checkRequired("durationUnit", durationUnit), - additionalProperties.toImmutable(), - ) - } - - class DurationUnit - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { - - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - companion object { - - @JvmField val DAY = of("day") - - @JvmField val MONTH = of("month") - - @JvmStatic fun of(value: String) = DurationUnit(JsonField.of(value)) - } - - enum class Known { - DAY, - MONTH, - } - - enum class Value { - DAY, - MONTH, - _UNKNOWN, - } - - fun value(): Value = - when (this) { - DAY -> Value.DAY - MONTH -> Value.MONTH - else -> Value._UNKNOWN - } - - fun known(): Known = - when (this) { - DAY -> Known.DAY - MONTH -> Known.MONTH - else -> throw OrbInvalidDataException("Unknown DurationUnit: $value") - } - - fun asString(): String = _value().asStringOrThrow() - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is DurationUnit && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is InvoicingCycleConfiguration && duration == other.duration && durationUnit == other.durationUnit && additionalProperties == other.additionalProperties /* spotless:on */ - } - - /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(duration, durationUnit, additionalProperties) } - /* spotless:on */ - - override fun hashCode(): Int = hashCode - - override fun toString() = - "InvoicingCycleConfiguration{duration=$duration, durationUnit=$durationUnit, additionalProperties=$additionalProperties}" - } - - @NoAutoDetect - class Item - @JsonCreator - private constructor( - @JsonProperty("id") - @ExcludeMissing - private val id: JsonField = JsonMissing.of(), - @JsonProperty("name") - @ExcludeMissing - private val name: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), - ) { - - fun id(): String = id.getRequired("id") - - fun name(): String = name.getRequired("name") - - @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id - - @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name - - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): Item = apply { - if (validated) { - return@apply - } - - id() - name() - validated = true - } - - fun toBuilder() = Builder().from(this) - - companion object { - - @JvmStatic fun builder() = Builder() - } - - class Builder { - - private var id: JsonField? = null - private var name: JsonField? = null - private var additionalProperties: MutableMap = mutableMapOf() - - @JvmSynthetic - internal fun from(item: Item) = apply { - id = item.id - name = item.name - additionalProperties = item.additionalProperties.toMutableMap() - } - - fun id(id: String) = id(JsonField.of(id)) - - fun id(id: JsonField) = apply { this.id = id } - - fun name(name: String) = name(JsonField.of(name)) - - fun name(name: JsonField) = apply { this.name = name } - - fun additionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } - - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, value) - } - - fun putAllAdditionalProperties(additionalProperties: Map) = - apply { - this.additionalProperties.putAll(additionalProperties) - } - - fun removeAdditionalProperty(key: String) = apply { - additionalProperties.remove(key) - } - - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) - } - - fun build(): Item = - Item( - checkRequired("id", id), - checkRequired("name", name), - additionalProperties.toImmutable(), - ) + fun build(): MatrixWithDisplayNameConfig = + MatrixWithDisplayNameConfig(additionalProperties.toImmutable()) } override fun equals(other: Any?): Boolean { @@ -42985,17 +44967,17 @@ private constructor( return true } - return /* spotless:off */ other is Item && id == other.id && name == other.name && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is MatrixWithDisplayNameConfig && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(id, name, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "Item{id=$id, name=$name, additionalProperties=$additionalProperties}" + "MatrixWithDisplayNameConfig{additionalProperties=$additionalProperties}" } @NoAutoDetect @@ -43421,29 +45403,29 @@ private constructor( companion object { - @JvmField val GROUPED_WITH_METERED_MINIMUM = of("grouped_with_metered_minimum") + @JvmField val MATRIX_WITH_DISPLAY_NAME = of("matrix_with_display_name") @JvmStatic fun of(value: String) = ModelType(JsonField.of(value)) } enum class Known { - GROUPED_WITH_METERED_MINIMUM, + MATRIX_WITH_DISPLAY_NAME, } enum class Value { - GROUPED_WITH_METERED_MINIMUM, + MATRIX_WITH_DISPLAY_NAME, _UNKNOWN, } fun value(): Value = when (this) { - GROUPED_WITH_METERED_MINIMUM -> Value.GROUPED_WITH_METERED_MINIMUM + MATRIX_WITH_DISPLAY_NAME -> Value.MATRIX_WITH_DISPLAY_NAME else -> Value._UNKNOWN } fun known(): Known = when (this) { - GROUPED_WITH_METERED_MINIMUM -> Known.GROUPED_WITH_METERED_MINIMUM + MATRIX_WITH_DISPLAY_NAME -> Known.MATRIX_WITH_DISPLAY_NAME else -> throw OrbInvalidDataException("Unknown ModelType: $value") } @@ -43524,21 +45506,21 @@ private constructor( return true } - return /* spotless:off */ other is GroupedWithMeteredMinimumPrice && id == other.id && billableMetric == other.billableMetric && billingCycleConfiguration == other.billingCycleConfiguration && cadence == other.cadence && conversionRate == other.conversionRate && createdAt == other.createdAt && creditAllocation == other.creditAllocation && currency == other.currency && discount == other.discount && externalPriceId == other.externalPriceId && fixedPriceQuantity == other.fixedPriceQuantity && groupedWithMeteredMinimumConfig == other.groupedWithMeteredMinimumConfig && invoicingCycleConfiguration == other.invoicingCycleConfiguration && item == other.item && maximum == other.maximum && maximumAmount == other.maximumAmount && metadata == other.metadata && minimum == other.minimum && minimumAmount == other.minimumAmount && modelType == other.modelType && name == other.name && planPhaseOrder == other.planPhaseOrder && priceType == other.priceType && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is MatrixWithDisplayNamePrice && id == other.id && billableMetric == other.billableMetric && billingCycleConfiguration == other.billingCycleConfiguration && cadence == other.cadence && conversionRate == other.conversionRate && createdAt == other.createdAt && creditAllocation == other.creditAllocation && currency == other.currency && discount == other.discount && externalPriceId == other.externalPriceId && fixedPriceQuantity == other.fixedPriceQuantity && invoicingCycleConfiguration == other.invoicingCycleConfiguration && item == other.item && matrixWithDisplayNameConfig == other.matrixWithDisplayNameConfig && maximum == other.maximum && maximumAmount == other.maximumAmount && metadata == other.metadata && minimum == other.minimum && minimumAmount == other.minimumAmount && modelType == other.modelType && name == other.name && planPhaseOrder == other.planPhaseOrder && priceType == other.priceType && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(id, billableMetric, billingCycleConfiguration, cadence, conversionRate, createdAt, creditAllocation, currency, discount, externalPriceId, fixedPriceQuantity, groupedWithMeteredMinimumConfig, invoicingCycleConfiguration, item, maximum, maximumAmount, metadata, minimum, minimumAmount, modelType, name, planPhaseOrder, priceType, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(id, billableMetric, billingCycleConfiguration, cadence, conversionRate, createdAt, creditAllocation, currency, discount, externalPriceId, fixedPriceQuantity, invoicingCycleConfiguration, item, matrixWithDisplayNameConfig, maximum, maximumAmount, metadata, minimum, minimumAmount, modelType, name, planPhaseOrder, priceType, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "GroupedWithMeteredMinimumPrice{id=$id, billableMetric=$billableMetric, billingCycleConfiguration=$billingCycleConfiguration, cadence=$cadence, conversionRate=$conversionRate, createdAt=$createdAt, creditAllocation=$creditAllocation, currency=$currency, discount=$discount, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, groupedWithMeteredMinimumConfig=$groupedWithMeteredMinimumConfig, invoicingCycleConfiguration=$invoicingCycleConfiguration, item=$item, maximum=$maximum, maximumAmount=$maximumAmount, metadata=$metadata, minimum=$minimum, minimumAmount=$minimumAmount, modelType=$modelType, name=$name, planPhaseOrder=$planPhaseOrder, priceType=$priceType, additionalProperties=$additionalProperties}" + "MatrixWithDisplayNamePrice{id=$id, billableMetric=$billableMetric, billingCycleConfiguration=$billingCycleConfiguration, cadence=$cadence, conversionRate=$conversionRate, createdAt=$createdAt, creditAllocation=$creditAllocation, currency=$currency, discount=$discount, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoicingCycleConfiguration=$invoicingCycleConfiguration, item=$item, matrixWithDisplayNameConfig=$matrixWithDisplayNameConfig, maximum=$maximum, maximumAmount=$maximumAmount, metadata=$metadata, minimum=$minimum, minimumAmount=$minimumAmount, modelType=$modelType, name=$name, planPhaseOrder=$planPhaseOrder, priceType=$priceType, additionalProperties=$additionalProperties}" } @NoAutoDetect - class MatrixWithDisplayNamePrice + class BulkWithProrationPrice @JsonCreator private constructor( @JsonProperty("id") @ExcludeMissing private val id: JsonField = JsonMissing.of(), @@ -43549,6 +45531,9 @@ private constructor( @ExcludeMissing private val billingCycleConfiguration: JsonField = JsonMissing.of(), + @JsonProperty("bulk_with_proration_config") + @ExcludeMissing + private val bulkWithProrationConfig: JsonField = JsonMissing.of(), @JsonProperty("cadence") @ExcludeMissing private val cadence: JsonField = JsonMissing.of(), @@ -43578,10 +45563,6 @@ private constructor( private val invoicingCycleConfiguration: JsonField = JsonMissing.of(), @JsonProperty("item") @ExcludeMissing private val item: JsonField = JsonMissing.of(), - @JsonProperty("matrix_with_display_name_config") - @ExcludeMissing - private val matrixWithDisplayNameConfig: JsonField = - JsonMissing.of(), @JsonProperty("maximum") @ExcludeMissing private val maximum: JsonField = JsonMissing.of(), @@ -43621,6 +45602,9 @@ private constructor( fun billingCycleConfiguration(): BillingCycleConfiguration = billingCycleConfiguration.getRequired("billing_cycle_configuration") + fun bulkWithProrationConfig(): BulkWithProrationConfig = + bulkWithProrationConfig.getRequired("bulk_with_proration_config") + fun cadence(): Cadence = cadence.getRequired("cadence") fun conversionRate(): Optional = @@ -43648,9 +45632,6 @@ private constructor( fun item(): Item = item.getRequired("item") - fun matrixWithDisplayNameConfig(): MatrixWithDisplayNameConfig = - matrixWithDisplayNameConfig.getRequired("matrix_with_display_name_config") - fun maximum(): Optional = Optional.ofNullable(maximum.getNullable("maximum")) fun maximumAmount(): Optional = @@ -43688,6 +45669,10 @@ private constructor( fun _billingCycleConfiguration(): JsonField = billingCycleConfiguration + @JsonProperty("bulk_with_proration_config") + @ExcludeMissing + fun _bulkWithProrationConfig(): JsonField = bulkWithProrationConfig + @JsonProperty("cadence") @ExcludeMissing fun _cadence(): JsonField = cadence @JsonProperty("conversion_rate") @@ -43721,11 +45706,6 @@ private constructor( @JsonProperty("item") @ExcludeMissing fun _item(): JsonField = item - @JsonProperty("matrix_with_display_name_config") - @ExcludeMissing - fun _matrixWithDisplayNameConfig(): JsonField = - matrixWithDisplayNameConfig - @JsonProperty("maximum") @ExcludeMissing fun _maximum(): JsonField = maximum @JsonProperty("maximum_amount") @@ -43765,7 +45745,7 @@ private constructor( private var validated: Boolean = false - fun validate(): MatrixWithDisplayNamePrice = apply { + fun validate(): BulkWithProrationPrice = apply { if (validated) { return@apply } @@ -43773,6 +45753,7 @@ private constructor( id() billableMetric().ifPresent { it.validate() } billingCycleConfiguration().validate() + bulkWithProrationConfig().validate() cadence() conversionRate() createdAt() @@ -43783,7 +45764,6 @@ private constructor( fixedPriceQuantity() invoicingCycleConfiguration().ifPresent { it.validate() } item().validate() - matrixWithDisplayNameConfig().validate() maximum().ifPresent { it.validate() } maximumAmount() metadata().validate() @@ -43808,6 +45788,7 @@ private constructor( private var id: JsonField? = null private var billableMetric: JsonField? = null private var billingCycleConfiguration: JsonField? = null + private var bulkWithProrationConfig: JsonField? = null private var cadence: JsonField? = null private var conversionRate: JsonField? = null private var createdAt: JsonField? = null @@ -43818,7 +45799,6 @@ private constructor( private var fixedPriceQuantity: JsonField? = null private var invoicingCycleConfiguration: JsonField? = null private var item: JsonField? = null - private var matrixWithDisplayNameConfig: JsonField? = null private var maximum: JsonField? = null private var maximumAmount: JsonField? = null private var metadata: JsonField? = null @@ -43831,32 +45811,31 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(matrixWithDisplayNamePrice: MatrixWithDisplayNamePrice) = apply { - id = matrixWithDisplayNamePrice.id - billableMetric = matrixWithDisplayNamePrice.billableMetric - billingCycleConfiguration = matrixWithDisplayNamePrice.billingCycleConfiguration - cadence = matrixWithDisplayNamePrice.cadence - conversionRate = matrixWithDisplayNamePrice.conversionRate - createdAt = matrixWithDisplayNamePrice.createdAt - creditAllocation = matrixWithDisplayNamePrice.creditAllocation - currency = matrixWithDisplayNamePrice.currency - discount = matrixWithDisplayNamePrice.discount - externalPriceId = matrixWithDisplayNamePrice.externalPriceId - fixedPriceQuantity = matrixWithDisplayNamePrice.fixedPriceQuantity - invoicingCycleConfiguration = matrixWithDisplayNamePrice.invoicingCycleConfiguration - item = matrixWithDisplayNamePrice.item - matrixWithDisplayNameConfig = matrixWithDisplayNamePrice.matrixWithDisplayNameConfig - maximum = matrixWithDisplayNamePrice.maximum - maximumAmount = matrixWithDisplayNamePrice.maximumAmount - metadata = matrixWithDisplayNamePrice.metadata - minimum = matrixWithDisplayNamePrice.minimum - minimumAmount = matrixWithDisplayNamePrice.minimumAmount - modelType = matrixWithDisplayNamePrice.modelType - name = matrixWithDisplayNamePrice.name - planPhaseOrder = matrixWithDisplayNamePrice.planPhaseOrder - priceType = matrixWithDisplayNamePrice.priceType - additionalProperties = - matrixWithDisplayNamePrice.additionalProperties.toMutableMap() + internal fun from(bulkWithProrationPrice: BulkWithProrationPrice) = apply { + id = bulkWithProrationPrice.id + billableMetric = bulkWithProrationPrice.billableMetric + billingCycleConfiguration = bulkWithProrationPrice.billingCycleConfiguration + bulkWithProrationConfig = bulkWithProrationPrice.bulkWithProrationConfig + cadence = bulkWithProrationPrice.cadence + conversionRate = bulkWithProrationPrice.conversionRate + createdAt = bulkWithProrationPrice.createdAt + creditAllocation = bulkWithProrationPrice.creditAllocation + currency = bulkWithProrationPrice.currency + discount = bulkWithProrationPrice.discount + externalPriceId = bulkWithProrationPrice.externalPriceId + fixedPriceQuantity = bulkWithProrationPrice.fixedPriceQuantity + invoicingCycleConfiguration = bulkWithProrationPrice.invoicingCycleConfiguration + item = bulkWithProrationPrice.item + maximum = bulkWithProrationPrice.maximum + maximumAmount = bulkWithProrationPrice.maximumAmount + metadata = bulkWithProrationPrice.metadata + minimum = bulkWithProrationPrice.minimum + minimumAmount = bulkWithProrationPrice.minimumAmount + modelType = bulkWithProrationPrice.modelType + name = bulkWithProrationPrice.name + planPhaseOrder = bulkWithProrationPrice.planPhaseOrder + priceType = bulkWithProrationPrice.priceType + additionalProperties = bulkWithProrationPrice.additionalProperties.toMutableMap() } fun id(id: String) = id(JsonField.of(id)) @@ -43880,6 +45859,13 @@ private constructor( billingCycleConfiguration: JsonField ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } + fun bulkWithProrationConfig(bulkWithProrationConfig: BulkWithProrationConfig) = + bulkWithProrationConfig(JsonField.of(bulkWithProrationConfig)) + + fun bulkWithProrationConfig( + bulkWithProrationConfig: JsonField + ) = apply { this.bulkWithProrationConfig = bulkWithProrationConfig } + fun cadence(cadence: Cadence) = cadence(JsonField.of(cadence)) fun cadence(cadence: JsonField) = apply { this.cadence = cadence } @@ -43975,14 +45961,6 @@ private constructor( fun item(item: JsonField) = apply { this.item = item } - fun matrixWithDisplayNameConfig( - matrixWithDisplayNameConfig: MatrixWithDisplayNameConfig - ) = matrixWithDisplayNameConfig(JsonField.of(matrixWithDisplayNameConfig)) - - fun matrixWithDisplayNameConfig( - matrixWithDisplayNameConfig: JsonField - ) = apply { this.matrixWithDisplayNameConfig = matrixWithDisplayNameConfig } - fun maximum(maximum: Maximum?) = maximum(JsonField.ofNullable(maximum)) fun maximum(maximum: Optional) = maximum(maximum.orElse(null)) @@ -44073,11 +46051,12 @@ private constructor( keys.forEach(::removeAdditionalProperty) } - fun build(): MatrixWithDisplayNamePrice = - MatrixWithDisplayNamePrice( + fun build(): BulkWithProrationPrice = + BulkWithProrationPrice( checkRequired("id", id), checkRequired("billableMetric", billableMetric), checkRequired("billingCycleConfiguration", billingCycleConfiguration), + checkRequired("bulkWithProrationConfig", bulkWithProrationConfig), checkRequired("cadence", cadence), checkRequired("conversionRate", conversionRate), checkRequired("createdAt", createdAt), @@ -44088,7 +46067,6 @@ private constructor( checkRequired("fixedPriceQuantity", fixedPriceQuantity), checkRequired("invoicingCycleConfiguration", invoicingCycleConfiguration), checkRequired("item", item), - checkRequired("matrixWithDisplayNameConfig", matrixWithDisplayNameConfig), checkRequired("maximum", maximum), checkRequired("maximumAmount", maximumAmount), checkRequired("metadata", metadata), @@ -44375,6 +46353,89 @@ private constructor( "BillingCycleConfiguration{duration=$duration, durationUnit=$durationUnit, additionalProperties=$additionalProperties}" } + @NoAutoDetect + class BulkWithProrationConfig + @JsonCreator + private constructor( + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), + ) { + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + private var validated: Boolean = false + + fun validate(): BulkWithProrationConfig = apply { + if (validated) { + return@apply + } + + validated = true + } + + fun toBuilder() = Builder().from(this) + + companion object { + + @JvmStatic fun builder() = Builder() + } + + class Builder { + + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(bulkWithProrationConfig: BulkWithProrationConfig) = apply { + additionalProperties = + bulkWithProrationConfig.additionalProperties.toMutableMap() + } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + fun build(): BulkWithProrationConfig = + BulkWithProrationConfig(additionalProperties.toImmutable()) + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is BulkWithProrationConfig && additionalProperties == other.additionalProperties /* spotless:on */ + } + + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(additionalProperties) } + /* spotless:on */ + + override fun hashCode(): Int = hashCode + + override fun toString() = + "BulkWithProrationConfig{additionalProperties=$additionalProperties}" + } + class Cadence @JsonCreator private constructor( @@ -44549,302 +46610,10 @@ private constructor( keys.forEach(::removeAdditionalProperty) } - fun build(): CreditAllocation = - CreditAllocation( - checkRequired("allowsRollover", allowsRollover), - checkRequired("currency", currency), - additionalProperties.toImmutable(), - ) - } - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is CreditAllocation && allowsRollover == other.allowsRollover && currency == other.currency && additionalProperties == other.additionalProperties /* spotless:on */ - } - - /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(allowsRollover, currency, additionalProperties) } - /* spotless:on */ - - override fun hashCode(): Int = hashCode - - override fun toString() = - "CreditAllocation{allowsRollover=$allowsRollover, currency=$currency, additionalProperties=$additionalProperties}" - } - - @NoAutoDetect - class InvoicingCycleConfiguration - @JsonCreator - private constructor( - @JsonProperty("duration") - @ExcludeMissing - private val duration: JsonField = JsonMissing.of(), - @JsonProperty("duration_unit") - @ExcludeMissing - private val durationUnit: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), - ) { - - fun duration(): Long = duration.getRequired("duration") - - fun durationUnit(): DurationUnit = durationUnit.getRequired("duration_unit") - - @JsonProperty("duration") @ExcludeMissing fun _duration(): JsonField = duration - - @JsonProperty("duration_unit") - @ExcludeMissing - fun _durationUnit(): JsonField = durationUnit - - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): InvoicingCycleConfiguration = apply { - if (validated) { - return@apply - } - - duration() - durationUnit() - validated = true - } - - fun toBuilder() = Builder().from(this) - - companion object { - - @JvmStatic fun builder() = Builder() - } - - class Builder { - - private var duration: JsonField? = null - private var durationUnit: JsonField? = null - private var additionalProperties: MutableMap = mutableMapOf() - - @JvmSynthetic - internal fun from(invoicingCycleConfiguration: InvoicingCycleConfiguration) = - apply { - duration = invoicingCycleConfiguration.duration - durationUnit = invoicingCycleConfiguration.durationUnit - additionalProperties = - invoicingCycleConfiguration.additionalProperties.toMutableMap() - } - - fun duration(duration: Long) = duration(JsonField.of(duration)) - - fun duration(duration: JsonField) = apply { this.duration = duration } - - fun durationUnit(durationUnit: DurationUnit) = - durationUnit(JsonField.of(durationUnit)) - - fun durationUnit(durationUnit: JsonField) = apply { - this.durationUnit = durationUnit - } - - fun additionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } - - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, value) - } - - fun putAllAdditionalProperties(additionalProperties: Map) = - apply { - this.additionalProperties.putAll(additionalProperties) - } - - fun removeAdditionalProperty(key: String) = apply { - additionalProperties.remove(key) - } - - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) - } - - fun build(): InvoicingCycleConfiguration = - InvoicingCycleConfiguration( - checkRequired("duration", duration), - checkRequired("durationUnit", durationUnit), - additionalProperties.toImmutable(), - ) - } - - class DurationUnit - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { - - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - companion object { - - @JvmField val DAY = of("day") - - @JvmField val MONTH = of("month") - - @JvmStatic fun of(value: String) = DurationUnit(JsonField.of(value)) - } - - enum class Known { - DAY, - MONTH, - } - - enum class Value { - DAY, - MONTH, - _UNKNOWN, - } - - fun value(): Value = - when (this) { - DAY -> Value.DAY - MONTH -> Value.MONTH - else -> Value._UNKNOWN - } - - fun known(): Known = - when (this) { - DAY -> Known.DAY - MONTH -> Known.MONTH - else -> throw OrbInvalidDataException("Unknown DurationUnit: $value") - } - - fun asString(): String = _value().asStringOrThrow() - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is DurationUnit && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is InvoicingCycleConfiguration && duration == other.duration && durationUnit == other.durationUnit && additionalProperties == other.additionalProperties /* spotless:on */ - } - - /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(duration, durationUnit, additionalProperties) } - /* spotless:on */ - - override fun hashCode(): Int = hashCode - - override fun toString() = - "InvoicingCycleConfiguration{duration=$duration, durationUnit=$durationUnit, additionalProperties=$additionalProperties}" - } - - @NoAutoDetect - class Item - @JsonCreator - private constructor( - @JsonProperty("id") - @ExcludeMissing - private val id: JsonField = JsonMissing.of(), - @JsonProperty("name") - @ExcludeMissing - private val name: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), - ) { - - fun id(): String = id.getRequired("id") - - fun name(): String = name.getRequired("name") - - @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id - - @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name - - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): Item = apply { - if (validated) { - return@apply - } - - id() - name() - validated = true - } - - fun toBuilder() = Builder().from(this) - - companion object { - - @JvmStatic fun builder() = Builder() - } - - class Builder { - - private var id: JsonField? = null - private var name: JsonField? = null - private var additionalProperties: MutableMap = mutableMapOf() - - @JvmSynthetic - internal fun from(item: Item) = apply { - id = item.id - name = item.name - additionalProperties = item.additionalProperties.toMutableMap() - } - - fun id(id: String) = id(JsonField.of(id)) - - fun id(id: JsonField) = apply { this.id = id } - - fun name(name: String) = name(JsonField.of(name)) - - fun name(name: JsonField) = apply { this.name = name } - - fun additionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } - - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, value) - } - - fun putAllAdditionalProperties(additionalProperties: Map) = - apply { - this.additionalProperties.putAll(additionalProperties) - } - - fun removeAdditionalProperty(key: String) = apply { - additionalProperties.remove(key) - } - - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) - } - - fun build(): Item = - Item( - checkRequired("id", id), - checkRequired("name", name), + fun build(): CreditAllocation = + CreditAllocation( + checkRequired("allowsRollover", allowsRollover), + checkRequired("currency", currency), additionalProperties.toImmutable(), ) } @@ -44854,38 +46623,56 @@ private constructor( return true } - return /* spotless:off */ other is Item && id == other.id && name == other.name && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is CreditAllocation && allowsRollover == other.allowsRollover && currency == other.currency && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(id, name, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(allowsRollover, currency, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "Item{id=$id, name=$name, additionalProperties=$additionalProperties}" + "CreditAllocation{allowsRollover=$allowsRollover, currency=$currency, additionalProperties=$additionalProperties}" } @NoAutoDetect - class MatrixWithDisplayNameConfig + class InvoicingCycleConfiguration @JsonCreator private constructor( + @JsonProperty("duration") + @ExcludeMissing + private val duration: JsonField = JsonMissing.of(), + @JsonProperty("duration_unit") + @ExcludeMissing + private val durationUnit: JsonField = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { + fun duration(): Long = duration.getRequired("duration") + + fun durationUnit(): DurationUnit = durationUnit.getRequired("duration_unit") + + @JsonProperty("duration") @ExcludeMissing fun _duration(): JsonField = duration + + @JsonProperty("duration_unit") + @ExcludeMissing + fun _durationUnit(): JsonField = durationUnit + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties private var validated: Boolean = false - fun validate(): MatrixWithDisplayNameConfig = apply { + fun validate(): InvoicingCycleConfiguration = apply { if (validated) { return@apply } + duration() + durationUnit() validated = true } @@ -44898,15 +46685,30 @@ private constructor( class Builder { + private var duration: JsonField? = null + private var durationUnit: JsonField? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(matrixWithDisplayNameConfig: MatrixWithDisplayNameConfig) = + internal fun from(invoicingCycleConfiguration: InvoicingCycleConfiguration) = apply { + duration = invoicingCycleConfiguration.duration + durationUnit = invoicingCycleConfiguration.durationUnit additionalProperties = - matrixWithDisplayNameConfig.additionalProperties.toMutableMap() + invoicingCycleConfiguration.additionalProperties.toMutableMap() } + fun duration(duration: Long) = duration(JsonField.of(duration)) + + fun duration(duration: JsonField) = apply { this.duration = duration } + + fun durationUnit(durationUnit: DurationUnit) = + durationUnit(JsonField.of(durationUnit)) + + fun durationUnit(durationUnit: JsonField) = apply { + this.durationUnit = durationUnit + } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -44929,8 +46731,69 @@ private constructor( keys.forEach(::removeAdditionalProperty) } - fun build(): MatrixWithDisplayNameConfig = - MatrixWithDisplayNameConfig(additionalProperties.toImmutable()) + fun build(): InvoicingCycleConfiguration = + InvoicingCycleConfiguration( + checkRequired("duration", duration), + checkRequired("durationUnit", durationUnit), + additionalProperties.toImmutable(), + ) + } + + class DurationUnit + @JsonCreator + private constructor( + private val value: JsonField, + ) : Enum { + + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + + companion object { + + @JvmField val DAY = of("day") + + @JvmField val MONTH = of("month") + + @JvmStatic fun of(value: String) = DurationUnit(JsonField.of(value)) + } + + enum class Known { + DAY, + MONTH, + } + + enum class Value { + DAY, + MONTH, + _UNKNOWN, + } + + fun value(): Value = + when (this) { + DAY -> Value.DAY + MONTH -> Value.MONTH + else -> Value._UNKNOWN + } + + fun known(): Known = + when (this) { + DAY -> Known.DAY + MONTH -> Known.MONTH + else -> throw OrbInvalidDataException("Unknown DurationUnit: $value") + } + + fun asString(): String = _value().asStringOrThrow() + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is DurationUnit && value == other.value /* spotless:on */ + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() } override fun equals(other: Any?): Boolean { @@ -44938,17 +46801,131 @@ private constructor( return true } - return /* spotless:off */ other is MatrixWithDisplayNameConfig && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is InvoicingCycleConfiguration && duration == other.duration && durationUnit == other.durationUnit && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(duration, durationUnit, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "MatrixWithDisplayNameConfig{additionalProperties=$additionalProperties}" + "InvoicingCycleConfiguration{duration=$duration, durationUnit=$durationUnit, additionalProperties=$additionalProperties}" + } + + @NoAutoDetect + class Item + @JsonCreator + private constructor( + @JsonProperty("id") + @ExcludeMissing + private val id: JsonField = JsonMissing.of(), + @JsonProperty("name") + @ExcludeMissing + private val name: JsonField = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), + ) { + + fun id(): String = id.getRequired("id") + + fun name(): String = name.getRequired("name") + + @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id + + @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + private var validated: Boolean = false + + fun validate(): Item = apply { + if (validated) { + return@apply + } + + id() + name() + validated = true + } + + fun toBuilder() = Builder().from(this) + + companion object { + + @JvmStatic fun builder() = Builder() + } + + class Builder { + + private var id: JsonField? = null + private var name: JsonField? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(item: Item) = apply { + id = item.id + name = item.name + additionalProperties = item.additionalProperties.toMutableMap() + } + + fun id(id: String) = id(JsonField.of(id)) + + fun id(id: JsonField) = apply { this.id = id } + + fun name(name: String) = name(JsonField.of(name)) + + fun name(name: JsonField) = apply { this.name = name } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + fun build(): Item = + Item( + checkRequired("id", id), + checkRequired("name", name), + additionalProperties.toImmutable(), + ) + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is Item && id == other.id && name == other.name && additionalProperties == other.additionalProperties /* spotless:on */ + } + + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(id, name, additionalProperties) } + /* spotless:on */ + + override fun hashCode(): Int = hashCode + + override fun toString() = + "Item{id=$id, name=$name, additionalProperties=$additionalProperties}" } @NoAutoDetect @@ -45374,29 +47351,29 @@ private constructor( companion object { - @JvmField val MATRIX_WITH_DISPLAY_NAME = of("matrix_with_display_name") + @JvmField val BULK_WITH_PRORATION = of("bulk_with_proration") @JvmStatic fun of(value: String) = ModelType(JsonField.of(value)) } enum class Known { - MATRIX_WITH_DISPLAY_NAME, + BULK_WITH_PRORATION, } enum class Value { - MATRIX_WITH_DISPLAY_NAME, + BULK_WITH_PRORATION, _UNKNOWN, } fun value(): Value = when (this) { - MATRIX_WITH_DISPLAY_NAME -> Value.MATRIX_WITH_DISPLAY_NAME + BULK_WITH_PRORATION -> Value.BULK_WITH_PRORATION else -> Value._UNKNOWN } fun known(): Known = when (this) { - MATRIX_WITH_DISPLAY_NAME -> Known.MATRIX_WITH_DISPLAY_NAME + BULK_WITH_PRORATION -> Known.BULK_WITH_PRORATION else -> throw OrbInvalidDataException("Unknown ModelType: $value") } @@ -45477,21 +47454,21 @@ private constructor( return true } - return /* spotless:off */ other is MatrixWithDisplayNamePrice && id == other.id && billableMetric == other.billableMetric && billingCycleConfiguration == other.billingCycleConfiguration && cadence == other.cadence && conversionRate == other.conversionRate && createdAt == other.createdAt && creditAllocation == other.creditAllocation && currency == other.currency && discount == other.discount && externalPriceId == other.externalPriceId && fixedPriceQuantity == other.fixedPriceQuantity && invoicingCycleConfiguration == other.invoicingCycleConfiguration && item == other.item && matrixWithDisplayNameConfig == other.matrixWithDisplayNameConfig && maximum == other.maximum && maximumAmount == other.maximumAmount && metadata == other.metadata && minimum == other.minimum && minimumAmount == other.minimumAmount && modelType == other.modelType && name == other.name && planPhaseOrder == other.planPhaseOrder && priceType == other.priceType && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is BulkWithProrationPrice && id == other.id && billableMetric == other.billableMetric && billingCycleConfiguration == other.billingCycleConfiguration && bulkWithProrationConfig == other.bulkWithProrationConfig && cadence == other.cadence && conversionRate == other.conversionRate && createdAt == other.createdAt && creditAllocation == other.creditAllocation && currency == other.currency && discount == other.discount && externalPriceId == other.externalPriceId && fixedPriceQuantity == other.fixedPriceQuantity && invoicingCycleConfiguration == other.invoicingCycleConfiguration && item == other.item && maximum == other.maximum && maximumAmount == other.maximumAmount && metadata == other.metadata && minimum == other.minimum && minimumAmount == other.minimumAmount && modelType == other.modelType && name == other.name && planPhaseOrder == other.planPhaseOrder && priceType == other.priceType && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(id, billableMetric, billingCycleConfiguration, cadence, conversionRate, createdAt, creditAllocation, currency, discount, externalPriceId, fixedPriceQuantity, invoicingCycleConfiguration, item, matrixWithDisplayNameConfig, maximum, maximumAmount, metadata, minimum, minimumAmount, modelType, name, planPhaseOrder, priceType, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(id, billableMetric, billingCycleConfiguration, bulkWithProrationConfig, cadence, conversionRate, createdAt, creditAllocation, currency, discount, externalPriceId, fixedPriceQuantity, invoicingCycleConfiguration, item, maximum, maximumAmount, metadata, minimum, minimumAmount, modelType, name, planPhaseOrder, priceType, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "MatrixWithDisplayNamePrice{id=$id, billableMetric=$billableMetric, billingCycleConfiguration=$billingCycleConfiguration, cadence=$cadence, conversionRate=$conversionRate, createdAt=$createdAt, creditAllocation=$creditAllocation, currency=$currency, discount=$discount, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoicingCycleConfiguration=$invoicingCycleConfiguration, item=$item, matrixWithDisplayNameConfig=$matrixWithDisplayNameConfig, maximum=$maximum, maximumAmount=$maximumAmount, metadata=$metadata, minimum=$minimum, minimumAmount=$minimumAmount, modelType=$modelType, name=$name, planPhaseOrder=$planPhaseOrder, priceType=$priceType, additionalProperties=$additionalProperties}" + "BulkWithProrationPrice{id=$id, billableMetric=$billableMetric, billingCycleConfiguration=$billingCycleConfiguration, bulkWithProrationConfig=$bulkWithProrationConfig, cadence=$cadence, conversionRate=$conversionRate, createdAt=$createdAt, creditAllocation=$creditAllocation, currency=$currency, discount=$discount, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoicingCycleConfiguration=$invoicingCycleConfiguration, item=$item, maximum=$maximum, maximumAmount=$maximumAmount, metadata=$metadata, minimum=$minimum, minimumAmount=$minimumAmount, modelType=$modelType, name=$name, planPhaseOrder=$planPhaseOrder, priceType=$priceType, additionalProperties=$additionalProperties}" } @NoAutoDetect - class BulkWithProrationPrice + class GroupedTieredPackagePrice @JsonCreator private constructor( @JsonProperty("id") @ExcludeMissing private val id: JsonField = JsonMissing.of(), @@ -45502,9 +47479,6 @@ private constructor( @ExcludeMissing private val billingCycleConfiguration: JsonField = JsonMissing.of(), - @JsonProperty("bulk_with_proration_config") - @ExcludeMissing - private val bulkWithProrationConfig: JsonField = JsonMissing.of(), @JsonProperty("cadence") @ExcludeMissing private val cadence: JsonField = JsonMissing.of(), @@ -45529,6 +47503,10 @@ private constructor( @JsonProperty("fixed_price_quantity") @ExcludeMissing private val fixedPriceQuantity: JsonField = JsonMissing.of(), + @JsonProperty("grouped_tiered_package_config") + @ExcludeMissing + private val groupedTieredPackageConfig: JsonField = + JsonMissing.of(), @JsonProperty("invoicing_cycle_configuration") @ExcludeMissing private val invoicingCycleConfiguration: JsonField = @@ -45573,9 +47551,6 @@ private constructor( fun billingCycleConfiguration(): BillingCycleConfiguration = billingCycleConfiguration.getRequired("billing_cycle_configuration") - fun bulkWithProrationConfig(): BulkWithProrationConfig = - bulkWithProrationConfig.getRequired("bulk_with_proration_config") - fun cadence(): Cadence = cadence.getRequired("cadence") fun conversionRate(): Optional = @@ -45596,6 +47571,9 @@ private constructor( fun fixedPriceQuantity(): Optional = Optional.ofNullable(fixedPriceQuantity.getNullable("fixed_price_quantity")) + fun groupedTieredPackageConfig(): GroupedTieredPackageConfig = + groupedTieredPackageConfig.getRequired("grouped_tiered_package_config") + fun invoicingCycleConfiguration(): Optional = Optional.ofNullable( invoicingCycleConfiguration.getNullable("invoicing_cycle_configuration") @@ -45640,10 +47618,6 @@ private constructor( fun _billingCycleConfiguration(): JsonField = billingCycleConfiguration - @JsonProperty("bulk_with_proration_config") - @ExcludeMissing - fun _bulkWithProrationConfig(): JsonField = bulkWithProrationConfig - @JsonProperty("cadence") @ExcludeMissing fun _cadence(): JsonField = cadence @JsonProperty("conversion_rate") @@ -45670,6 +47644,11 @@ private constructor( @ExcludeMissing fun _fixedPriceQuantity(): JsonField = fixedPriceQuantity + @JsonProperty("grouped_tiered_package_config") + @ExcludeMissing + fun _groupedTieredPackageConfig(): JsonField = + groupedTieredPackageConfig + @JsonProperty("invoicing_cycle_configuration") @ExcludeMissing fun _invoicingCycleConfiguration(): JsonField = @@ -45716,7 +47695,7 @@ private constructor( private var validated: Boolean = false - fun validate(): BulkWithProrationPrice = apply { + fun validate(): GroupedTieredPackagePrice = apply { if (validated) { return@apply } @@ -45724,7 +47703,6 @@ private constructor( id() billableMetric().ifPresent { it.validate() } billingCycleConfiguration().validate() - bulkWithProrationConfig().validate() cadence() conversionRate() createdAt() @@ -45733,6 +47711,7 @@ private constructor( discount().ifPresent { it.validate() } externalPriceId() fixedPriceQuantity() + groupedTieredPackageConfig().validate() invoicingCycleConfiguration().ifPresent { it.validate() } item().validate() maximum().ifPresent { it.validate() } @@ -45759,7 +47738,6 @@ private constructor( private var id: JsonField? = null private var billableMetric: JsonField? = null private var billingCycleConfiguration: JsonField? = null - private var bulkWithProrationConfig: JsonField? = null private var cadence: JsonField? = null private var conversionRate: JsonField? = null private var createdAt: JsonField? = null @@ -45768,6 +47746,7 @@ private constructor( private var discount: JsonField? = null private var externalPriceId: JsonField? = null private var fixedPriceQuantity: JsonField? = null + private var groupedTieredPackageConfig: JsonField? = null private var invoicingCycleConfiguration: JsonField? = null private var item: JsonField? = null private var maximum: JsonField? = null @@ -45782,31 +47761,31 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(bulkWithProrationPrice: BulkWithProrationPrice) = apply { - id = bulkWithProrationPrice.id - billableMetric = bulkWithProrationPrice.billableMetric - billingCycleConfiguration = bulkWithProrationPrice.billingCycleConfiguration - bulkWithProrationConfig = bulkWithProrationPrice.bulkWithProrationConfig - cadence = bulkWithProrationPrice.cadence - conversionRate = bulkWithProrationPrice.conversionRate - createdAt = bulkWithProrationPrice.createdAt - creditAllocation = bulkWithProrationPrice.creditAllocation - currency = bulkWithProrationPrice.currency - discount = bulkWithProrationPrice.discount - externalPriceId = bulkWithProrationPrice.externalPriceId - fixedPriceQuantity = bulkWithProrationPrice.fixedPriceQuantity - invoicingCycleConfiguration = bulkWithProrationPrice.invoicingCycleConfiguration - item = bulkWithProrationPrice.item - maximum = bulkWithProrationPrice.maximum - maximumAmount = bulkWithProrationPrice.maximumAmount - metadata = bulkWithProrationPrice.metadata - minimum = bulkWithProrationPrice.minimum - minimumAmount = bulkWithProrationPrice.minimumAmount - modelType = bulkWithProrationPrice.modelType - name = bulkWithProrationPrice.name - planPhaseOrder = bulkWithProrationPrice.planPhaseOrder - priceType = bulkWithProrationPrice.priceType - additionalProperties = bulkWithProrationPrice.additionalProperties.toMutableMap() + internal fun from(groupedTieredPackagePrice: GroupedTieredPackagePrice) = apply { + id = groupedTieredPackagePrice.id + billableMetric = groupedTieredPackagePrice.billableMetric + billingCycleConfiguration = groupedTieredPackagePrice.billingCycleConfiguration + cadence = groupedTieredPackagePrice.cadence + conversionRate = groupedTieredPackagePrice.conversionRate + createdAt = groupedTieredPackagePrice.createdAt + creditAllocation = groupedTieredPackagePrice.creditAllocation + currency = groupedTieredPackagePrice.currency + discount = groupedTieredPackagePrice.discount + externalPriceId = groupedTieredPackagePrice.externalPriceId + fixedPriceQuantity = groupedTieredPackagePrice.fixedPriceQuantity + groupedTieredPackageConfig = groupedTieredPackagePrice.groupedTieredPackageConfig + invoicingCycleConfiguration = groupedTieredPackagePrice.invoicingCycleConfiguration + item = groupedTieredPackagePrice.item + maximum = groupedTieredPackagePrice.maximum + maximumAmount = groupedTieredPackagePrice.maximumAmount + metadata = groupedTieredPackagePrice.metadata + minimum = groupedTieredPackagePrice.minimum + minimumAmount = groupedTieredPackagePrice.minimumAmount + modelType = groupedTieredPackagePrice.modelType + name = groupedTieredPackagePrice.name + planPhaseOrder = groupedTieredPackagePrice.planPhaseOrder + priceType = groupedTieredPackagePrice.priceType + additionalProperties = groupedTieredPackagePrice.additionalProperties.toMutableMap() } fun id(id: String) = id(JsonField.of(id)) @@ -45830,13 +47809,6 @@ private constructor( billingCycleConfiguration: JsonField ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } - fun bulkWithProrationConfig(bulkWithProrationConfig: BulkWithProrationConfig) = - bulkWithProrationConfig(JsonField.of(bulkWithProrationConfig)) - - fun bulkWithProrationConfig( - bulkWithProrationConfig: JsonField - ) = apply { this.bulkWithProrationConfig = bulkWithProrationConfig } - fun cadence(cadence: Cadence) = cadence(JsonField.of(cadence)) fun cadence(cadence: JsonField) = apply { this.cadence = cadence } @@ -45916,6 +47888,13 @@ private constructor( this.fixedPriceQuantity = fixedPriceQuantity } + fun groupedTieredPackageConfig(groupedTieredPackageConfig: GroupedTieredPackageConfig) = + groupedTieredPackageConfig(JsonField.of(groupedTieredPackageConfig)) + + fun groupedTieredPackageConfig( + groupedTieredPackageConfig: JsonField + ) = apply { this.groupedTieredPackageConfig = groupedTieredPackageConfig } + fun invoicingCycleConfiguration( invoicingCycleConfiguration: InvoicingCycleConfiguration? ) = invoicingCycleConfiguration(JsonField.ofNullable(invoicingCycleConfiguration)) @@ -46022,12 +48001,11 @@ private constructor( keys.forEach(::removeAdditionalProperty) } - fun build(): BulkWithProrationPrice = - BulkWithProrationPrice( + fun build(): GroupedTieredPackagePrice = + GroupedTieredPackagePrice( checkRequired("id", id), checkRequired("billableMetric", billableMetric), checkRequired("billingCycleConfiguration", billingCycleConfiguration), - checkRequired("bulkWithProrationConfig", bulkWithProrationConfig), checkRequired("cadence", cadence), checkRequired("conversionRate", conversionRate), checkRequired("createdAt", createdAt), @@ -46036,6 +48014,7 @@ private constructor( checkRequired("discount", discount), checkRequired("externalPriceId", externalPriceId), checkRequired("fixedPriceQuantity", fixedPriceQuantity), + checkRequired("groupedTieredPackageConfig", groupedTieredPackageConfig), checkRequired("invoicingCycleConfiguration", invoicingCycleConfiguration), checkRequired("item", item), checkRequired("maximum", maximum), @@ -46324,89 +48303,6 @@ private constructor( "BillingCycleConfiguration{duration=$duration, durationUnit=$durationUnit, additionalProperties=$additionalProperties}" } - @NoAutoDetect - class BulkWithProrationConfig - @JsonCreator - private constructor( - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), - ) { - - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): BulkWithProrationConfig = apply { - if (validated) { - return@apply - } - - validated = true - } - - fun toBuilder() = Builder().from(this) - - companion object { - - @JvmStatic fun builder() = Builder() - } - - class Builder { - - private var additionalProperties: MutableMap = mutableMapOf() - - @JvmSynthetic - internal fun from(bulkWithProrationConfig: BulkWithProrationConfig) = apply { - additionalProperties = - bulkWithProrationConfig.additionalProperties.toMutableMap() - } - - fun additionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } - - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, value) - } - - fun putAllAdditionalProperties(additionalProperties: Map) = - apply { - this.additionalProperties.putAll(additionalProperties) - } - - fun removeAdditionalProperty(key: String) = apply { - additionalProperties.remove(key) - } - - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) - } - - fun build(): BulkWithProrationConfig = - BulkWithProrationConfig(additionalProperties.toImmutable()) - } - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is BulkWithProrationConfig && additionalProperties == other.additionalProperties /* spotless:on */ - } - - /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(additionalProperties) } - /* spotless:on */ - - override fun hashCode(): Int = hashCode - - override fun toString() = - "BulkWithProrationConfig{additionalProperties=$additionalProperties}" - } - class Cadence @JsonCreator private constructor( @@ -46607,6 +48503,89 @@ private constructor( "CreditAllocation{allowsRollover=$allowsRollover, currency=$currency, additionalProperties=$additionalProperties}" } + @NoAutoDetect + class GroupedTieredPackageConfig + @JsonCreator + private constructor( + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), + ) { + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + private var validated: Boolean = false + + fun validate(): GroupedTieredPackageConfig = apply { + if (validated) { + return@apply + } + + validated = true + } + + fun toBuilder() = Builder().from(this) + + companion object { + + @JvmStatic fun builder() = Builder() + } + + class Builder { + + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(groupedTieredPackageConfig: GroupedTieredPackageConfig) = apply { + additionalProperties = + groupedTieredPackageConfig.additionalProperties.toMutableMap() + } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + fun build(): GroupedTieredPackageConfig = + GroupedTieredPackageConfig(additionalProperties.toImmutable()) + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is GroupedTieredPackageConfig && additionalProperties == other.additionalProperties /* spotless:on */ + } + + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(additionalProperties) } + /* spotless:on */ + + override fun hashCode(): Int = hashCode + + override fun toString() = + "GroupedTieredPackageConfig{additionalProperties=$additionalProperties}" + } + @NoAutoDetect class InvoicingCycleConfiguration @JsonCreator @@ -47322,29 +49301,29 @@ private constructor( companion object { - @JvmField val BULK_WITH_PRORATION = of("bulk_with_proration") + @JvmField val GROUPED_TIERED_PACKAGE = of("grouped_tiered_package") @JvmStatic fun of(value: String) = ModelType(JsonField.of(value)) } enum class Known { - BULK_WITH_PRORATION, + GROUPED_TIERED_PACKAGE, } enum class Value { - BULK_WITH_PRORATION, + GROUPED_TIERED_PACKAGE, _UNKNOWN, } fun value(): Value = when (this) { - BULK_WITH_PRORATION -> Value.BULK_WITH_PRORATION + GROUPED_TIERED_PACKAGE -> Value.GROUPED_TIERED_PACKAGE else -> Value._UNKNOWN } fun known(): Known = when (this) { - BULK_WITH_PRORATION -> Known.BULK_WITH_PRORATION + GROUPED_TIERED_PACKAGE -> Known.GROUPED_TIERED_PACKAGE else -> throw OrbInvalidDataException("Unknown ModelType: $value") } @@ -47425,21 +49404,21 @@ private constructor( return true } - return /* spotless:off */ other is BulkWithProrationPrice && id == other.id && billableMetric == other.billableMetric && billingCycleConfiguration == other.billingCycleConfiguration && bulkWithProrationConfig == other.bulkWithProrationConfig && cadence == other.cadence && conversionRate == other.conversionRate && createdAt == other.createdAt && creditAllocation == other.creditAllocation && currency == other.currency && discount == other.discount && externalPriceId == other.externalPriceId && fixedPriceQuantity == other.fixedPriceQuantity && invoicingCycleConfiguration == other.invoicingCycleConfiguration && item == other.item && maximum == other.maximum && maximumAmount == other.maximumAmount && metadata == other.metadata && minimum == other.minimum && minimumAmount == other.minimumAmount && modelType == other.modelType && name == other.name && planPhaseOrder == other.planPhaseOrder && priceType == other.priceType && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is GroupedTieredPackagePrice && id == other.id && billableMetric == other.billableMetric && billingCycleConfiguration == other.billingCycleConfiguration && cadence == other.cadence && conversionRate == other.conversionRate && createdAt == other.createdAt && creditAllocation == other.creditAllocation && currency == other.currency && discount == other.discount && externalPriceId == other.externalPriceId && fixedPriceQuantity == other.fixedPriceQuantity && groupedTieredPackageConfig == other.groupedTieredPackageConfig && invoicingCycleConfiguration == other.invoicingCycleConfiguration && item == other.item && maximum == other.maximum && maximumAmount == other.maximumAmount && metadata == other.metadata && minimum == other.minimum && minimumAmount == other.minimumAmount && modelType == other.modelType && name == other.name && planPhaseOrder == other.planPhaseOrder && priceType == other.priceType && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(id, billableMetric, billingCycleConfiguration, bulkWithProrationConfig, cadence, conversionRate, createdAt, creditAllocation, currency, discount, externalPriceId, fixedPriceQuantity, invoicingCycleConfiguration, item, maximum, maximumAmount, metadata, minimum, minimumAmount, modelType, name, planPhaseOrder, priceType, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(id, billableMetric, billingCycleConfiguration, cadence, conversionRate, createdAt, creditAllocation, currency, discount, externalPriceId, fixedPriceQuantity, groupedTieredPackageConfig, invoicingCycleConfiguration, item, maximum, maximumAmount, metadata, minimum, minimumAmount, modelType, name, planPhaseOrder, priceType, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "BulkWithProrationPrice{id=$id, billableMetric=$billableMetric, billingCycleConfiguration=$billingCycleConfiguration, bulkWithProrationConfig=$bulkWithProrationConfig, cadence=$cadence, conversionRate=$conversionRate, createdAt=$createdAt, creditAllocation=$creditAllocation, currency=$currency, discount=$discount, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoicingCycleConfiguration=$invoicingCycleConfiguration, item=$item, maximum=$maximum, maximumAmount=$maximumAmount, metadata=$metadata, minimum=$minimum, minimumAmount=$minimumAmount, modelType=$modelType, name=$name, planPhaseOrder=$planPhaseOrder, priceType=$priceType, additionalProperties=$additionalProperties}" + "GroupedTieredPackagePrice{id=$id, billableMetric=$billableMetric, billingCycleConfiguration=$billingCycleConfiguration, cadence=$cadence, conversionRate=$conversionRate, createdAt=$createdAt, creditAllocation=$creditAllocation, currency=$currency, discount=$discount, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, groupedTieredPackageConfig=$groupedTieredPackageConfig, invoicingCycleConfiguration=$invoicingCycleConfiguration, item=$item, maximum=$maximum, maximumAmount=$maximumAmount, metadata=$metadata, minimum=$minimum, minimumAmount=$minimumAmount, modelType=$modelType, name=$name, planPhaseOrder=$planPhaseOrder, priceType=$priceType, additionalProperties=$additionalProperties}" } @NoAutoDetect - class GroupedTieredPackagePrice + class MaxGroupTieredPrice @JsonCreator private constructor( @JsonProperty("id") @ExcludeMissing private val id: JsonField = JsonMissing.of(), @@ -47474,15 +49453,14 @@ private constructor( @JsonProperty("fixed_price_quantity") @ExcludeMissing private val fixedPriceQuantity: JsonField = JsonMissing.of(), - @JsonProperty("grouped_tiered_package_config") - @ExcludeMissing - private val groupedTieredPackageConfig: JsonField = - JsonMissing.of(), @JsonProperty("invoicing_cycle_configuration") @ExcludeMissing private val invoicingCycleConfiguration: JsonField = JsonMissing.of(), @JsonProperty("item") @ExcludeMissing private val item: JsonField = JsonMissing.of(), + @JsonProperty("max_group_tiered_config") + @ExcludeMissing + private val maxGroupTieredConfig: JsonField = JsonMissing.of(), @JsonProperty("maximum") @ExcludeMissing private val maximum: JsonField = JsonMissing.of(), @@ -47542,9 +49520,6 @@ private constructor( fun fixedPriceQuantity(): Optional = Optional.ofNullable(fixedPriceQuantity.getNullable("fixed_price_quantity")) - fun groupedTieredPackageConfig(): GroupedTieredPackageConfig = - groupedTieredPackageConfig.getRequired("grouped_tiered_package_config") - fun invoicingCycleConfiguration(): Optional = Optional.ofNullable( invoicingCycleConfiguration.getNullable("invoicing_cycle_configuration") @@ -47552,6 +49527,9 @@ private constructor( fun item(): Item = item.getRequired("item") + fun maxGroupTieredConfig(): MaxGroupTieredConfig = + maxGroupTieredConfig.getRequired("max_group_tiered_config") + fun maximum(): Optional = Optional.ofNullable(maximum.getNullable("maximum")) fun maximumAmount(): Optional = @@ -47615,11 +49593,6 @@ private constructor( @ExcludeMissing fun _fixedPriceQuantity(): JsonField = fixedPriceQuantity - @JsonProperty("grouped_tiered_package_config") - @ExcludeMissing - fun _groupedTieredPackageConfig(): JsonField = - groupedTieredPackageConfig - @JsonProperty("invoicing_cycle_configuration") @ExcludeMissing fun _invoicingCycleConfiguration(): JsonField = @@ -47627,6 +49600,10 @@ private constructor( @JsonProperty("item") @ExcludeMissing fun _item(): JsonField = item + @JsonProperty("max_group_tiered_config") + @ExcludeMissing + fun _maxGroupTieredConfig(): JsonField = maxGroupTieredConfig + @JsonProperty("maximum") @ExcludeMissing fun _maximum(): JsonField = maximum @JsonProperty("maximum_amount") @@ -47666,7 +49643,7 @@ private constructor( private var validated: Boolean = false - fun validate(): GroupedTieredPackagePrice = apply { + fun validate(): MaxGroupTieredPrice = apply { if (validated) { return@apply } @@ -47682,9 +49659,9 @@ private constructor( discount().ifPresent { it.validate() } externalPriceId() fixedPriceQuantity() - groupedTieredPackageConfig().validate() invoicingCycleConfiguration().ifPresent { it.validate() } item().validate() + maxGroupTieredConfig().validate() maximum().ifPresent { it.validate() } maximumAmount() metadata().validate() @@ -47717,9 +49694,9 @@ private constructor( private var discount: JsonField? = null private var externalPriceId: JsonField? = null private var fixedPriceQuantity: JsonField? = null - private var groupedTieredPackageConfig: JsonField? = null private var invoicingCycleConfiguration: JsonField? = null private var item: JsonField? = null + private var maxGroupTieredConfig: JsonField? = null private var maximum: JsonField? = null private var maximumAmount: JsonField? = null private var metadata: JsonField? = null @@ -47732,31 +49709,31 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(groupedTieredPackagePrice: GroupedTieredPackagePrice) = apply { - id = groupedTieredPackagePrice.id - billableMetric = groupedTieredPackagePrice.billableMetric - billingCycleConfiguration = groupedTieredPackagePrice.billingCycleConfiguration - cadence = groupedTieredPackagePrice.cadence - conversionRate = groupedTieredPackagePrice.conversionRate - createdAt = groupedTieredPackagePrice.createdAt - creditAllocation = groupedTieredPackagePrice.creditAllocation - currency = groupedTieredPackagePrice.currency - discount = groupedTieredPackagePrice.discount - externalPriceId = groupedTieredPackagePrice.externalPriceId - fixedPriceQuantity = groupedTieredPackagePrice.fixedPriceQuantity - groupedTieredPackageConfig = groupedTieredPackagePrice.groupedTieredPackageConfig - invoicingCycleConfiguration = groupedTieredPackagePrice.invoicingCycleConfiguration - item = groupedTieredPackagePrice.item - maximum = groupedTieredPackagePrice.maximum - maximumAmount = groupedTieredPackagePrice.maximumAmount - metadata = groupedTieredPackagePrice.metadata - minimum = groupedTieredPackagePrice.minimum - minimumAmount = groupedTieredPackagePrice.minimumAmount - modelType = groupedTieredPackagePrice.modelType - name = groupedTieredPackagePrice.name - planPhaseOrder = groupedTieredPackagePrice.planPhaseOrder - priceType = groupedTieredPackagePrice.priceType - additionalProperties = groupedTieredPackagePrice.additionalProperties.toMutableMap() + internal fun from(maxGroupTieredPrice: MaxGroupTieredPrice) = apply { + id = maxGroupTieredPrice.id + billableMetric = maxGroupTieredPrice.billableMetric + billingCycleConfiguration = maxGroupTieredPrice.billingCycleConfiguration + cadence = maxGroupTieredPrice.cadence + conversionRate = maxGroupTieredPrice.conversionRate + createdAt = maxGroupTieredPrice.createdAt + creditAllocation = maxGroupTieredPrice.creditAllocation + currency = maxGroupTieredPrice.currency + discount = maxGroupTieredPrice.discount + externalPriceId = maxGroupTieredPrice.externalPriceId + fixedPriceQuantity = maxGroupTieredPrice.fixedPriceQuantity + invoicingCycleConfiguration = maxGroupTieredPrice.invoicingCycleConfiguration + item = maxGroupTieredPrice.item + maxGroupTieredConfig = maxGroupTieredPrice.maxGroupTieredConfig + maximum = maxGroupTieredPrice.maximum + maximumAmount = maxGroupTieredPrice.maximumAmount + metadata = maxGroupTieredPrice.metadata + minimum = maxGroupTieredPrice.minimum + minimumAmount = maxGroupTieredPrice.minimumAmount + modelType = maxGroupTieredPrice.modelType + name = maxGroupTieredPrice.name + planPhaseOrder = maxGroupTieredPrice.planPhaseOrder + priceType = maxGroupTieredPrice.priceType + additionalProperties = maxGroupTieredPrice.additionalProperties.toMutableMap() } fun id(id: String) = id(JsonField.of(id)) @@ -47859,13 +49836,6 @@ private constructor( this.fixedPriceQuantity = fixedPriceQuantity } - fun groupedTieredPackageConfig(groupedTieredPackageConfig: GroupedTieredPackageConfig) = - groupedTieredPackageConfig(JsonField.of(groupedTieredPackageConfig)) - - fun groupedTieredPackageConfig( - groupedTieredPackageConfig: JsonField - ) = apply { this.groupedTieredPackageConfig = groupedTieredPackageConfig } - fun invoicingCycleConfiguration( invoicingCycleConfiguration: InvoicingCycleConfiguration? ) = invoicingCycleConfiguration(JsonField.ofNullable(invoicingCycleConfiguration)) @@ -47882,6 +49852,14 @@ private constructor( fun item(item: JsonField) = apply { this.item = item } + fun maxGroupTieredConfig(maxGroupTieredConfig: MaxGroupTieredConfig) = + maxGroupTieredConfig(JsonField.of(maxGroupTieredConfig)) + + fun maxGroupTieredConfig(maxGroupTieredConfig: JsonField) = + apply { + this.maxGroupTieredConfig = maxGroupTieredConfig + } + fun maximum(maximum: Maximum?) = maximum(JsonField.ofNullable(maximum)) fun maximum(maximum: Optional) = maximum(maximum.orElse(null)) @@ -47972,8 +49950,8 @@ private constructor( keys.forEach(::removeAdditionalProperty) } - fun build(): GroupedTieredPackagePrice = - GroupedTieredPackagePrice( + fun build(): MaxGroupTieredPrice = + MaxGroupTieredPrice( checkRequired("id", id), checkRequired("billableMetric", billableMetric), checkRequired("billingCycleConfiguration", billingCycleConfiguration), @@ -47985,9 +49963,9 @@ private constructor( checkRequired("discount", discount), checkRequired("externalPriceId", externalPriceId), checkRequired("fixedPriceQuantity", fixedPriceQuantity), - checkRequired("groupedTieredPackageConfig", groupedTieredPackageConfig), checkRequired("invoicingCycleConfiguration", invoicingCycleConfiguration), checkRequired("item", item), + checkRequired("maxGroupTieredConfig", maxGroupTieredConfig), checkRequired("maximum", maximum), checkRequired("maximumAmount", maximumAmount), checkRequired("metadata", metadata), @@ -48191,308 +50169,207 @@ private constructor( keys.forEach(::removeAdditionalProperty) } - fun build(): BillingCycleConfiguration = - BillingCycleConfiguration( - checkRequired("duration", duration), - checkRequired("durationUnit", durationUnit), - additionalProperties.toImmutable(), - ) - } - - class DurationUnit - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { - - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - companion object { - - @JvmField val DAY = of("day") - - @JvmField val MONTH = of("month") - - @JvmStatic fun of(value: String) = DurationUnit(JsonField.of(value)) - } - - enum class Known { - DAY, - MONTH, - } - - enum class Value { - DAY, - MONTH, - _UNKNOWN, - } - - fun value(): Value = - when (this) { - DAY -> Value.DAY - MONTH -> Value.MONTH - else -> Value._UNKNOWN - } - - fun known(): Known = - when (this) { - DAY -> Known.DAY - MONTH -> Known.MONTH - else -> throw OrbInvalidDataException("Unknown DurationUnit: $value") - } - - fun asString(): String = _value().asStringOrThrow() - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is DurationUnit && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is BillingCycleConfiguration && duration == other.duration && durationUnit == other.durationUnit && additionalProperties == other.additionalProperties /* spotless:on */ - } - - /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(duration, durationUnit, additionalProperties) } - /* spotless:on */ - - override fun hashCode(): Int = hashCode - - override fun toString() = - "BillingCycleConfiguration{duration=$duration, durationUnit=$durationUnit, additionalProperties=$additionalProperties}" - } - - class Cadence - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { - - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - companion object { - - @JvmField val ONE_TIME = of("one_time") - - @JvmField val MONTHLY = of("monthly") - - @JvmField val QUARTERLY = of("quarterly") - - @JvmField val SEMI_ANNUAL = of("semi_annual") - - @JvmField val ANNUAL = of("annual") - - @JvmField val CUSTOM = of("custom") - - @JvmStatic fun of(value: String) = Cadence(JsonField.of(value)) - } - - enum class Known { - ONE_TIME, - MONTHLY, - QUARTERLY, - SEMI_ANNUAL, - ANNUAL, - CUSTOM, - } - - enum class Value { - ONE_TIME, - MONTHLY, - QUARTERLY, - SEMI_ANNUAL, - ANNUAL, - CUSTOM, - _UNKNOWN, - } - - fun value(): Value = - when (this) { - ONE_TIME -> Value.ONE_TIME - MONTHLY -> Value.MONTHLY - QUARTERLY -> Value.QUARTERLY - SEMI_ANNUAL -> Value.SEMI_ANNUAL - ANNUAL -> Value.ANNUAL - CUSTOM -> Value.CUSTOM - else -> Value._UNKNOWN - } - - fun known(): Known = - when (this) { - ONE_TIME -> Known.ONE_TIME - MONTHLY -> Known.MONTHLY - QUARTERLY -> Known.QUARTERLY - SEMI_ANNUAL -> Known.SEMI_ANNUAL - ANNUAL -> Known.ANNUAL - CUSTOM -> Known.CUSTOM - else -> throw OrbInvalidDataException("Unknown Cadence: $value") - } - - fun asString(): String = _value().asStringOrThrow() - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is Cadence && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - - @NoAutoDetect - class CreditAllocation - @JsonCreator - private constructor( - @JsonProperty("allows_rollover") - @ExcludeMissing - private val allowsRollover: JsonField = JsonMissing.of(), - @JsonProperty("currency") - @ExcludeMissing - private val currency: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), - ) { - - fun allowsRollover(): Boolean = allowsRollover.getRequired("allows_rollover") - - fun currency(): String = currency.getRequired("currency") - - @JsonProperty("allows_rollover") - @ExcludeMissing - fun _allowsRollover(): JsonField = allowsRollover - - @JsonProperty("currency") @ExcludeMissing fun _currency(): JsonField = currency - - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): CreditAllocation = apply { - if (validated) { - return@apply - } - - allowsRollover() - currency() - validated = true - } - - fun toBuilder() = Builder().from(this) - - companion object { - - @JvmStatic fun builder() = Builder() - } - - class Builder { - - private var allowsRollover: JsonField? = null - private var currency: JsonField? = null - private var additionalProperties: MutableMap = mutableMapOf() - - @JvmSynthetic - internal fun from(creditAllocation: CreditAllocation) = apply { - allowsRollover = creditAllocation.allowsRollover - currency = creditAllocation.currency - additionalProperties = creditAllocation.additionalProperties.toMutableMap() - } - - fun allowsRollover(allowsRollover: Boolean) = - allowsRollover(JsonField.of(allowsRollover)) - - fun allowsRollover(allowsRollover: JsonField) = apply { - this.allowsRollover = allowsRollover - } - - fun currency(currency: String) = currency(JsonField.of(currency)) - - fun currency(currency: JsonField) = apply { this.currency = currency } - - fun additionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } - - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, value) - } - - fun putAllAdditionalProperties(additionalProperties: Map) = - apply { - this.additionalProperties.putAll(additionalProperties) - } - - fun removeAdditionalProperty(key: String) = apply { - additionalProperties.remove(key) - } - - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) - } - - fun build(): CreditAllocation = - CreditAllocation( - checkRequired("allowsRollover", allowsRollover), - checkRequired("currency", currency), + fun build(): BillingCycleConfiguration = + BillingCycleConfiguration( + checkRequired("duration", duration), + checkRequired("durationUnit", durationUnit), additionalProperties.toImmutable(), ) } + class DurationUnit + @JsonCreator + private constructor( + private val value: JsonField, + ) : Enum { + + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + + companion object { + + @JvmField val DAY = of("day") + + @JvmField val MONTH = of("month") + + @JvmStatic fun of(value: String) = DurationUnit(JsonField.of(value)) + } + + enum class Known { + DAY, + MONTH, + } + + enum class Value { + DAY, + MONTH, + _UNKNOWN, + } + + fun value(): Value = + when (this) { + DAY -> Value.DAY + MONTH -> Value.MONTH + else -> Value._UNKNOWN + } + + fun known(): Known = + when (this) { + DAY -> Known.DAY + MONTH -> Known.MONTH + else -> throw OrbInvalidDataException("Unknown DurationUnit: $value") + } + + fun asString(): String = _value().asStringOrThrow() + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is DurationUnit && value == other.value /* spotless:on */ + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + override fun equals(other: Any?): Boolean { if (this === other) { return true } - return /* spotless:off */ other is CreditAllocation && allowsRollover == other.allowsRollover && currency == other.currency && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is BillingCycleConfiguration && duration == other.duration && durationUnit == other.durationUnit && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(allowsRollover, currency, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(duration, durationUnit, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "CreditAllocation{allowsRollover=$allowsRollover, currency=$currency, additionalProperties=$additionalProperties}" + "BillingCycleConfiguration{duration=$duration, durationUnit=$durationUnit, additionalProperties=$additionalProperties}" + } + + class Cadence + @JsonCreator + private constructor( + private val value: JsonField, + ) : Enum { + + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + + companion object { + + @JvmField val ONE_TIME = of("one_time") + + @JvmField val MONTHLY = of("monthly") + + @JvmField val QUARTERLY = of("quarterly") + + @JvmField val SEMI_ANNUAL = of("semi_annual") + + @JvmField val ANNUAL = of("annual") + + @JvmField val CUSTOM = of("custom") + + @JvmStatic fun of(value: String) = Cadence(JsonField.of(value)) + } + + enum class Known { + ONE_TIME, + MONTHLY, + QUARTERLY, + SEMI_ANNUAL, + ANNUAL, + CUSTOM, + } + + enum class Value { + ONE_TIME, + MONTHLY, + QUARTERLY, + SEMI_ANNUAL, + ANNUAL, + CUSTOM, + _UNKNOWN, + } + + fun value(): Value = + when (this) { + ONE_TIME -> Value.ONE_TIME + MONTHLY -> Value.MONTHLY + QUARTERLY -> Value.QUARTERLY + SEMI_ANNUAL -> Value.SEMI_ANNUAL + ANNUAL -> Value.ANNUAL + CUSTOM -> Value.CUSTOM + else -> Value._UNKNOWN + } + + fun known(): Known = + when (this) { + ONE_TIME -> Known.ONE_TIME + MONTHLY -> Known.MONTHLY + QUARTERLY -> Known.QUARTERLY + SEMI_ANNUAL -> Known.SEMI_ANNUAL + ANNUAL -> Known.ANNUAL + CUSTOM -> Known.CUSTOM + else -> throw OrbInvalidDataException("Unknown Cadence: $value") + } + + fun asString(): String = _value().asStringOrThrow() + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is Cadence && value == other.value /* spotless:on */ + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() } @NoAutoDetect - class GroupedTieredPackageConfig + class CreditAllocation @JsonCreator private constructor( + @JsonProperty("allows_rollover") + @ExcludeMissing + private val allowsRollover: JsonField = JsonMissing.of(), + @JsonProperty("currency") + @ExcludeMissing + private val currency: JsonField = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { + fun allowsRollover(): Boolean = allowsRollover.getRequired("allows_rollover") + + fun currency(): String = currency.getRequired("currency") + + @JsonProperty("allows_rollover") + @ExcludeMissing + fun _allowsRollover(): JsonField = allowsRollover + + @JsonProperty("currency") @ExcludeMissing fun _currency(): JsonField = currency + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties private var validated: Boolean = false - fun validate(): GroupedTieredPackageConfig = apply { + fun validate(): CreditAllocation = apply { if (validated) { return@apply } + allowsRollover() + currency() validated = true } @@ -48505,14 +50382,28 @@ private constructor( class Builder { + private var allowsRollover: JsonField? = null + private var currency: JsonField? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(groupedTieredPackageConfig: GroupedTieredPackageConfig) = apply { - additionalProperties = - groupedTieredPackageConfig.additionalProperties.toMutableMap() + internal fun from(creditAllocation: CreditAllocation) = apply { + allowsRollover = creditAllocation.allowsRollover + currency = creditAllocation.currency + additionalProperties = creditAllocation.additionalProperties.toMutableMap() } + fun allowsRollover(allowsRollover: Boolean) = + allowsRollover(JsonField.of(allowsRollover)) + + fun allowsRollover(allowsRollover: JsonField) = apply { + this.allowsRollover = allowsRollover + } + + fun currency(currency: String) = currency(JsonField.of(currency)) + + fun currency(currency: JsonField) = apply { this.currency = currency } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -48535,8 +50426,12 @@ private constructor( keys.forEach(::removeAdditionalProperty) } - fun build(): GroupedTieredPackageConfig = - GroupedTieredPackageConfig(additionalProperties.toImmutable()) + fun build(): CreditAllocation = + CreditAllocation( + checkRequired("allowsRollover", allowsRollover), + checkRequired("currency", currency), + additionalProperties.toImmutable(), + ) } override fun equals(other: Any?): Boolean { @@ -48544,17 +50439,17 @@ private constructor( return true } - return /* spotless:off */ other is GroupedTieredPackageConfig && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is CreditAllocation && allowsRollover == other.allowsRollover && currency == other.currency && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(allowsRollover, currency, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "GroupedTieredPackageConfig{additionalProperties=$additionalProperties}" + "CreditAllocation{allowsRollover=$allowsRollover, currency=$currency, additionalProperties=$additionalProperties}" } @NoAutoDetect @@ -48849,6 +50744,88 @@ private constructor( "Item{id=$id, name=$name, additionalProperties=$additionalProperties}" } + @NoAutoDetect + class MaxGroupTieredConfig + @JsonCreator + private constructor( + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), + ) { + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + private var validated: Boolean = false + + fun validate(): MaxGroupTieredConfig = apply { + if (validated) { + return@apply + } + + validated = true + } + + fun toBuilder() = Builder().from(this) + + companion object { + + @JvmStatic fun builder() = Builder() + } + + class Builder { + + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(maxGroupTieredConfig: MaxGroupTieredConfig) = apply { + additionalProperties = maxGroupTieredConfig.additionalProperties.toMutableMap() + } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + fun build(): MaxGroupTieredConfig = + MaxGroupTieredConfig(additionalProperties.toImmutable()) + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is MaxGroupTieredConfig && additionalProperties == other.additionalProperties /* spotless:on */ + } + + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(additionalProperties) } + /* spotless:on */ + + override fun hashCode(): Int = hashCode + + override fun toString() = + "MaxGroupTieredConfig{additionalProperties=$additionalProperties}" + } + @NoAutoDetect class Maximum @JsonCreator @@ -49272,29 +51249,29 @@ private constructor( companion object { - @JvmField val GROUPED_TIERED_PACKAGE = of("grouped_tiered_package") + @JvmField val MAX_GROUP_TIERED = of("max_group_tiered") @JvmStatic fun of(value: String) = ModelType(JsonField.of(value)) } enum class Known { - GROUPED_TIERED_PACKAGE, + MAX_GROUP_TIERED, } enum class Value { - GROUPED_TIERED_PACKAGE, + MAX_GROUP_TIERED, _UNKNOWN, } fun value(): Value = when (this) { - GROUPED_TIERED_PACKAGE -> Value.GROUPED_TIERED_PACKAGE + MAX_GROUP_TIERED -> Value.MAX_GROUP_TIERED else -> Value._UNKNOWN } fun known(): Known = when (this) { - GROUPED_TIERED_PACKAGE -> Known.GROUPED_TIERED_PACKAGE + MAX_GROUP_TIERED -> Known.MAX_GROUP_TIERED else -> throw OrbInvalidDataException("Unknown ModelType: $value") } @@ -49375,16 +51352,16 @@ private constructor( return true } - return /* spotless:off */ other is GroupedTieredPackagePrice && id == other.id && billableMetric == other.billableMetric && billingCycleConfiguration == other.billingCycleConfiguration && cadence == other.cadence && conversionRate == other.conversionRate && createdAt == other.createdAt && creditAllocation == other.creditAllocation && currency == other.currency && discount == other.discount && externalPriceId == other.externalPriceId && fixedPriceQuantity == other.fixedPriceQuantity && groupedTieredPackageConfig == other.groupedTieredPackageConfig && invoicingCycleConfiguration == other.invoicingCycleConfiguration && item == other.item && maximum == other.maximum && maximumAmount == other.maximumAmount && metadata == other.metadata && minimum == other.minimum && minimumAmount == other.minimumAmount && modelType == other.modelType && name == other.name && planPhaseOrder == other.planPhaseOrder && priceType == other.priceType && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is MaxGroupTieredPrice && id == other.id && billableMetric == other.billableMetric && billingCycleConfiguration == other.billingCycleConfiguration && cadence == other.cadence && conversionRate == other.conversionRate && createdAt == other.createdAt && creditAllocation == other.creditAllocation && currency == other.currency && discount == other.discount && externalPriceId == other.externalPriceId && fixedPriceQuantity == other.fixedPriceQuantity && invoicingCycleConfiguration == other.invoicingCycleConfiguration && item == other.item && maxGroupTieredConfig == other.maxGroupTieredConfig && maximum == other.maximum && maximumAmount == other.maximumAmount && metadata == other.metadata && minimum == other.minimum && minimumAmount == other.minimumAmount && modelType == other.modelType && name == other.name && planPhaseOrder == other.planPhaseOrder && priceType == other.priceType && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(id, billableMetric, billingCycleConfiguration, cadence, conversionRate, createdAt, creditAllocation, currency, discount, externalPriceId, fixedPriceQuantity, groupedTieredPackageConfig, invoicingCycleConfiguration, item, maximum, maximumAmount, metadata, minimum, minimumAmount, modelType, name, planPhaseOrder, priceType, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(id, billableMetric, billingCycleConfiguration, cadence, conversionRate, createdAt, creditAllocation, currency, discount, externalPriceId, fixedPriceQuantity, invoicingCycleConfiguration, item, maxGroupTieredConfig, maximum, maximumAmount, metadata, minimum, minimumAmount, modelType, name, planPhaseOrder, priceType, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "GroupedTieredPackagePrice{id=$id, billableMetric=$billableMetric, billingCycleConfiguration=$billingCycleConfiguration, cadence=$cadence, conversionRate=$conversionRate, createdAt=$createdAt, creditAllocation=$creditAllocation, currency=$currency, discount=$discount, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, groupedTieredPackageConfig=$groupedTieredPackageConfig, invoicingCycleConfiguration=$invoicingCycleConfiguration, item=$item, maximum=$maximum, maximumAmount=$maximumAmount, metadata=$metadata, minimum=$minimum, minimumAmount=$minimumAmount, modelType=$modelType, name=$name, planPhaseOrder=$planPhaseOrder, priceType=$priceType, additionalProperties=$additionalProperties}" + "MaxGroupTieredPrice{id=$id, billableMetric=$billableMetric, billingCycleConfiguration=$billingCycleConfiguration, cadence=$cadence, conversionRate=$conversionRate, createdAt=$createdAt, creditAllocation=$creditAllocation, currency=$currency, discount=$discount, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoicingCycleConfiguration=$invoicingCycleConfiguration, item=$item, maxGroupTieredConfig=$maxGroupTieredConfig, maximum=$maximum, maximumAmount=$maximumAmount, metadata=$metadata, minimum=$minimum, minimumAmount=$minimumAmount, modelType=$modelType, name=$name, planPhaseOrder=$planPhaseOrder, priceType=$priceType, additionalProperties=$additionalProperties}" } } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/PriceCreateParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/PriceCreateParams.kt index ea9122cf..2f3b9cc1 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/PriceCreateParams.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/PriceCreateParams.kt @@ -81,6 +81,9 @@ constructor( fun newFloatingGroupedTieredPrice(): Optional = body.newFloatingGroupedTieredPrice() + fun newFloatingMaxGroupTieredPrice(): Optional = + body.newFloatingMaxGroupTieredPrice() + fun newFloatingTieredWithMinimumPrice(): Optional = body.newFloatingTieredWithMinimumPrice() @@ -148,6 +151,7 @@ constructor( null, private val newFloatingTieredPackagePrice: NewFloatingTieredPackagePrice? = null, private val newFloatingGroupedTieredPrice: NewFloatingGroupedTieredPrice? = null, + private val newFloatingMaxGroupTieredPrice: NewFloatingMaxGroupTieredPrice? = null, private val newFloatingTieredWithMinimumPrice: NewFloatingTieredWithMinimumPrice? = null, private val newFloatingPackageWithAllocationPrice: NewFloatingPackageWithAllocationPrice? = null, @@ -209,6 +213,9 @@ constructor( fun newFloatingGroupedTieredPrice(): Optional = Optional.ofNullable(newFloatingGroupedTieredPrice) + fun newFloatingMaxGroupTieredPrice(): Optional = + Optional.ofNullable(newFloatingMaxGroupTieredPrice) + fun newFloatingTieredWithMinimumPrice(): Optional = Optional.ofNullable(newFloatingTieredWithMinimumPrice) @@ -276,6 +283,8 @@ constructor( fun isNewFloatingGroupedTieredPrice(): Boolean = newFloatingGroupedTieredPrice != null + fun isNewFloatingMaxGroupTieredPrice(): Boolean = newFloatingMaxGroupTieredPrice != null + fun isNewFloatingTieredWithMinimumPrice(): Boolean = newFloatingTieredWithMinimumPrice != null @@ -347,6 +356,9 @@ constructor( fun asNewFloatingGroupedTieredPrice(): NewFloatingGroupedTieredPrice = newFloatingGroupedTieredPrice.getOrThrow("newFloatingGroupedTieredPrice") + fun asNewFloatingMaxGroupTieredPrice(): NewFloatingMaxGroupTieredPrice = + newFloatingMaxGroupTieredPrice.getOrThrow("newFloatingMaxGroupTieredPrice") + fun asNewFloatingTieredWithMinimumPrice(): NewFloatingTieredWithMinimumPrice = newFloatingTieredWithMinimumPrice.getOrThrow("newFloatingTieredWithMinimumPrice") @@ -426,6 +438,8 @@ constructor( visitor.visitNewFloatingTieredPackagePrice(newFloatingTieredPackagePrice) newFloatingGroupedTieredPrice != null -> visitor.visitNewFloatingGroupedTieredPrice(newFloatingGroupedTieredPrice) + newFloatingMaxGroupTieredPrice != null -> + visitor.visitNewFloatingMaxGroupTieredPrice(newFloatingMaxGroupTieredPrice) newFloatingTieredWithMinimumPrice != null -> visitor.visitNewFloatingTieredWithMinimumPrice( newFloatingTieredWithMinimumPrice @@ -481,10 +495,10 @@ constructor( return true } - return /* spotless:off */ other is PriceCreateBody && newFloatingUnitPrice == other.newFloatingUnitPrice && newFloatingPackagePrice == other.newFloatingPackagePrice && newFloatingMatrixPrice == other.newFloatingMatrixPrice && newFloatingMatrixWithAllocationPrice == other.newFloatingMatrixWithAllocationPrice && newFloatingTieredPrice == other.newFloatingTieredPrice && newFloatingTieredBpsPrice == other.newFloatingTieredBpsPrice && newFloatingBpsPrice == other.newFloatingBpsPrice && newFloatingBulkBpsPrice == other.newFloatingBulkBpsPrice && newFloatingBulkPrice == other.newFloatingBulkPrice && newFloatingThresholdTotalAmountPrice == other.newFloatingThresholdTotalAmountPrice && newFloatingTieredPackagePrice == other.newFloatingTieredPackagePrice && newFloatingGroupedTieredPrice == other.newFloatingGroupedTieredPrice && newFloatingTieredWithMinimumPrice == other.newFloatingTieredWithMinimumPrice && newFloatingPackageWithAllocationPrice == other.newFloatingPackageWithAllocationPrice && newFloatingTieredPackageWithMinimumPrice == other.newFloatingTieredPackageWithMinimumPrice && newFloatingUnitWithPercentPrice == other.newFloatingUnitWithPercentPrice && newFloatingTieredWithProrationPrice == other.newFloatingTieredWithProrationPrice && newFloatingUnitWithProrationPrice == other.newFloatingUnitWithProrationPrice && newFloatingGroupedAllocationPrice == other.newFloatingGroupedAllocationPrice && newFloatingGroupedWithProratedMinimumPrice == other.newFloatingGroupedWithProratedMinimumPrice && newFloatingGroupedWithMeteredMinimumPrice == other.newFloatingGroupedWithMeteredMinimumPrice && newFloatingMatrixWithDisplayNamePrice == other.newFloatingMatrixWithDisplayNamePrice && newFloatingBulkWithProrationPrice == other.newFloatingBulkWithProrationPrice && newFloatingGroupedTieredPackagePrice == other.newFloatingGroupedTieredPackagePrice /* spotless:on */ + return /* spotless:off */ other is PriceCreateBody && newFloatingUnitPrice == other.newFloatingUnitPrice && newFloatingPackagePrice == other.newFloatingPackagePrice && newFloatingMatrixPrice == other.newFloatingMatrixPrice && newFloatingMatrixWithAllocationPrice == other.newFloatingMatrixWithAllocationPrice && newFloatingTieredPrice == other.newFloatingTieredPrice && newFloatingTieredBpsPrice == other.newFloatingTieredBpsPrice && newFloatingBpsPrice == other.newFloatingBpsPrice && newFloatingBulkBpsPrice == other.newFloatingBulkBpsPrice && newFloatingBulkPrice == other.newFloatingBulkPrice && newFloatingThresholdTotalAmountPrice == other.newFloatingThresholdTotalAmountPrice && newFloatingTieredPackagePrice == other.newFloatingTieredPackagePrice && newFloatingGroupedTieredPrice == other.newFloatingGroupedTieredPrice && newFloatingMaxGroupTieredPrice == other.newFloatingMaxGroupTieredPrice && newFloatingTieredWithMinimumPrice == other.newFloatingTieredWithMinimumPrice && newFloatingPackageWithAllocationPrice == other.newFloatingPackageWithAllocationPrice && newFloatingTieredPackageWithMinimumPrice == other.newFloatingTieredPackageWithMinimumPrice && newFloatingUnitWithPercentPrice == other.newFloatingUnitWithPercentPrice && newFloatingTieredWithProrationPrice == other.newFloatingTieredWithProrationPrice && newFloatingUnitWithProrationPrice == other.newFloatingUnitWithProrationPrice && newFloatingGroupedAllocationPrice == other.newFloatingGroupedAllocationPrice && newFloatingGroupedWithProratedMinimumPrice == other.newFloatingGroupedWithProratedMinimumPrice && newFloatingGroupedWithMeteredMinimumPrice == other.newFloatingGroupedWithMeteredMinimumPrice && newFloatingMatrixWithDisplayNamePrice == other.newFloatingMatrixWithDisplayNamePrice && newFloatingBulkWithProrationPrice == other.newFloatingBulkWithProrationPrice && newFloatingGroupedTieredPackagePrice == other.newFloatingGroupedTieredPackagePrice /* spotless:on */ } - override fun hashCode(): Int = /* spotless:off */ Objects.hash(newFloatingUnitPrice, newFloatingPackagePrice, newFloatingMatrixPrice, newFloatingMatrixWithAllocationPrice, newFloatingTieredPrice, newFloatingTieredBpsPrice, newFloatingBpsPrice, newFloatingBulkBpsPrice, newFloatingBulkPrice, newFloatingThresholdTotalAmountPrice, newFloatingTieredPackagePrice, newFloatingGroupedTieredPrice, newFloatingTieredWithMinimumPrice, newFloatingPackageWithAllocationPrice, newFloatingTieredPackageWithMinimumPrice, newFloatingUnitWithPercentPrice, newFloatingTieredWithProrationPrice, newFloatingUnitWithProrationPrice, newFloatingGroupedAllocationPrice, newFloatingGroupedWithProratedMinimumPrice, newFloatingGroupedWithMeteredMinimumPrice, newFloatingMatrixWithDisplayNamePrice, newFloatingBulkWithProrationPrice, newFloatingGroupedTieredPackagePrice) /* spotless:on */ + override fun hashCode(): Int = /* spotless:off */ Objects.hash(newFloatingUnitPrice, newFloatingPackagePrice, newFloatingMatrixPrice, newFloatingMatrixWithAllocationPrice, newFloatingTieredPrice, newFloatingTieredBpsPrice, newFloatingBpsPrice, newFloatingBulkBpsPrice, newFloatingBulkPrice, newFloatingThresholdTotalAmountPrice, newFloatingTieredPackagePrice, newFloatingGroupedTieredPrice, newFloatingMaxGroupTieredPrice, newFloatingTieredWithMinimumPrice, newFloatingPackageWithAllocationPrice, newFloatingTieredPackageWithMinimumPrice, newFloatingUnitWithPercentPrice, newFloatingTieredWithProrationPrice, newFloatingUnitWithProrationPrice, newFloatingGroupedAllocationPrice, newFloatingGroupedWithProratedMinimumPrice, newFloatingGroupedWithMeteredMinimumPrice, newFloatingMatrixWithDisplayNamePrice, newFloatingBulkWithProrationPrice, newFloatingGroupedTieredPackagePrice) /* spotless:on */ override fun toString(): String = when { @@ -512,6 +526,8 @@ constructor( "PriceCreateBody{newFloatingTieredPackagePrice=$newFloatingTieredPackagePrice}" newFloatingGroupedTieredPrice != null -> "PriceCreateBody{newFloatingGroupedTieredPrice=$newFloatingGroupedTieredPrice}" + newFloatingMaxGroupTieredPrice != null -> + "PriceCreateBody{newFloatingMaxGroupTieredPrice=$newFloatingMaxGroupTieredPrice}" newFloatingTieredWithMinimumPrice != null -> "PriceCreateBody{newFloatingTieredWithMinimumPrice=$newFloatingTieredWithMinimumPrice}" newFloatingPackageWithAllocationPrice != null -> @@ -600,6 +616,11 @@ constructor( newFloatingGroupedTieredPrice: NewFloatingGroupedTieredPrice ) = PriceCreateBody(newFloatingGroupedTieredPrice = newFloatingGroupedTieredPrice) + @JvmStatic + fun ofNewFloatingMaxGroupTieredPrice( + newFloatingMaxGroupTieredPrice: NewFloatingMaxGroupTieredPrice + ) = PriceCreateBody(newFloatingMaxGroupTieredPrice = newFloatingMaxGroupTieredPrice) + @JvmStatic fun ofNewFloatingTieredWithMinimumPrice( newFloatingTieredWithMinimumPrice: NewFloatingTieredWithMinimumPrice @@ -734,6 +755,10 @@ constructor( newFloatingGroupedTieredPrice: NewFloatingGroupedTieredPrice ): T + fun visitNewFloatingMaxGroupTieredPrice( + newFloatingMaxGroupTieredPrice: NewFloatingMaxGroupTieredPrice + ): T + fun visitNewFloatingTieredWithMinimumPrice( newFloatingTieredWithMinimumPrice: NewFloatingTieredWithMinimumPrice ): T @@ -864,6 +889,15 @@ constructor( return PriceCreateBody(newFloatingGroupedTieredPrice = it, _json = json) } } + "max_group_tiered" -> { + tryDeserialize(node, jacksonTypeRef()) + ?.let { + return PriceCreateBody( + newFloatingMaxGroupTieredPrice = it, + _json = json + ) + } + } "tiered_with_minimum" -> { tryDeserialize(node, jacksonTypeRef()) ?.let { @@ -1025,6 +1059,8 @@ constructor( generator.writeObject(value.newFloatingTieredPackagePrice) value.newFloatingGroupedTieredPrice != null -> generator.writeObject(value.newFloatingGroupedTieredPrice) + value.newFloatingMaxGroupTieredPrice != null -> + generator.writeObject(value.newFloatingMaxGroupTieredPrice) value.newFloatingTieredWithMinimumPrice != null -> generator.writeObject(value.newFloatingTieredWithMinimumPrice) value.newFloatingPackageWithAllocationPrice != null -> @@ -1140,6 +1176,12 @@ constructor( body = PriceCreateBody.ofNewFloatingGroupedTieredPrice(newFloatingGroupedTieredPrice) } + fun forNewFloatingMaxGroupTieredPrice( + newFloatingMaxGroupTieredPrice: NewFloatingMaxGroupTieredPrice + ) = apply { + body = PriceCreateBody.ofNewFloatingMaxGroupTieredPrice(newFloatingMaxGroupTieredPrice) + } + fun forNewFloatingTieredWithMinimumPrice( newFloatingTieredWithMinimumPrice: NewFloatingTieredWithMinimumPrice ) = apply { @@ -17579,6 +17621,1235 @@ constructor( "NewFloatingGroupedTieredPrice{cadence=$cadence, currency=$currency, groupedTieredConfig=$groupedTieredConfig, itemId=$itemId, modelType=$modelType, name=$name, billableMetricId=$billableMetricId, billedInAdvance=$billedInAdvance, billingCycleConfiguration=$billingCycleConfiguration, conversionRate=$conversionRate, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, invoicingCycleConfiguration=$invoicingCycleConfiguration, metadata=$metadata, additionalProperties=$additionalProperties}" } + @NoAutoDetect + class NewFloatingMaxGroupTieredPrice + @JsonCreator + private constructor( + @JsonProperty("cadence") + @ExcludeMissing + private val cadence: JsonField = JsonMissing.of(), + @JsonProperty("currency") + @ExcludeMissing + private val currency: JsonField = JsonMissing.of(), + @JsonProperty("item_id") + @ExcludeMissing + private val itemId: JsonField = JsonMissing.of(), + @JsonProperty("max_group_tiered_config") + @ExcludeMissing + private val maxGroupTieredConfig: JsonField = JsonMissing.of(), + @JsonProperty("model_type") + @ExcludeMissing + private val modelType: JsonField = JsonMissing.of(), + @JsonProperty("name") + @ExcludeMissing + private val name: JsonField = JsonMissing.of(), + @JsonProperty("billable_metric_id") + @ExcludeMissing + private val billableMetricId: JsonField = JsonMissing.of(), + @JsonProperty("billed_in_advance") + @ExcludeMissing + private val billedInAdvance: JsonField = JsonMissing.of(), + @JsonProperty("billing_cycle_configuration") + @ExcludeMissing + private val billingCycleConfiguration: JsonField = + JsonMissing.of(), + @JsonProperty("conversion_rate") + @ExcludeMissing + private val conversionRate: JsonField = JsonMissing.of(), + @JsonProperty("external_price_id") + @ExcludeMissing + private val externalPriceId: JsonField = JsonMissing.of(), + @JsonProperty("fixed_price_quantity") + @ExcludeMissing + private val fixedPriceQuantity: JsonField = JsonMissing.of(), + @JsonProperty("invoice_grouping_key") + @ExcludeMissing + private val invoiceGroupingKey: JsonField = JsonMissing.of(), + @JsonProperty("invoicing_cycle_configuration") + @ExcludeMissing + private val invoicingCycleConfiguration: JsonField = + JsonMissing.of(), + @JsonProperty("metadata") + @ExcludeMissing + private val metadata: JsonField = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), + ) { + + /** The cadence to bill for this price on. */ + fun cadence(): Cadence = cadence.getRequired("cadence") + + /** An ISO 4217 currency string for which this price is billed in. */ + fun currency(): String = currency.getRequired("currency") + + /** The id of the item the plan will be associated with. */ + fun itemId(): String = itemId.getRequired("item_id") + + fun maxGroupTieredConfig(): MaxGroupTieredConfig = + maxGroupTieredConfig.getRequired("max_group_tiered_config") + + fun modelType(): ModelType = modelType.getRequired("model_type") + + /** The name of the price. */ + fun name(): String = name.getRequired("name") + + /** The id of the billable metric for the price. Only needed if the price is usage-based. */ + fun billableMetricId(): Optional = + Optional.ofNullable(billableMetricId.getNullable("billable_metric_id")) + + /** + * If the Price represents a fixed cost, the price will be billed in-advance if this is + * true, and in-arrears if this is false. + */ + fun billedInAdvance(): Optional = + Optional.ofNullable(billedInAdvance.getNullable("billed_in_advance")) + + /** For custom cadence: specifies the duration of the billing period in days or months. */ + fun billingCycleConfiguration(): Optional = + Optional.ofNullable( + billingCycleConfiguration.getNullable("billing_cycle_configuration") + ) + + /** The per unit conversion rate of the price currency to the invoicing currency. */ + fun conversionRate(): Optional = + Optional.ofNullable(conversionRate.getNullable("conversion_rate")) + + /** An alias for the price. */ + fun externalPriceId(): Optional = + Optional.ofNullable(externalPriceId.getNullable("external_price_id")) + + /** If the Price represents a fixed cost, this represents the quantity of units applied. */ + fun fixedPriceQuantity(): Optional = + Optional.ofNullable(fixedPriceQuantity.getNullable("fixed_price_quantity")) + + /** The property used to group this price on an invoice */ + fun invoiceGroupingKey(): Optional = + Optional.ofNullable(invoiceGroupingKey.getNullable("invoice_grouping_key")) + + /** + * Within each billing cycle, specifies the cadence at which invoices are produced. If + * unspecified, a single invoice is produced per billing cycle. + */ + fun invoicingCycleConfiguration(): Optional = + Optional.ofNullable( + invoicingCycleConfiguration.getNullable("invoicing_cycle_configuration") + ) + + /** + * User-specified key/value pairs for the resource. Individual keys can be removed by + * setting the value to `null`, and the entire metadata mapping can be cleared by setting + * `metadata` to `null`. + */ + fun metadata(): Optional = Optional.ofNullable(metadata.getNullable("metadata")) + + /** The cadence to bill for this price on. */ + @JsonProperty("cadence") @ExcludeMissing fun _cadence(): JsonField = cadence + + /** An ISO 4217 currency string for which this price is billed in. */ + @JsonProperty("currency") @ExcludeMissing fun _currency(): JsonField = currency + + /** The id of the item the plan will be associated with. */ + @JsonProperty("item_id") @ExcludeMissing fun _itemId(): JsonField = itemId + + @JsonProperty("max_group_tiered_config") + @ExcludeMissing + fun _maxGroupTieredConfig(): JsonField = maxGroupTieredConfig + + @JsonProperty("model_type") + @ExcludeMissing + fun _modelType(): JsonField = modelType + + /** The name of the price. */ + @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name + + /** The id of the billable metric for the price. Only needed if the price is usage-based. */ + @JsonProperty("billable_metric_id") + @ExcludeMissing + fun _billableMetricId(): JsonField = billableMetricId + + /** + * If the Price represents a fixed cost, the price will be billed in-advance if this is + * true, and in-arrears if this is false. + */ + @JsonProperty("billed_in_advance") + @ExcludeMissing + fun _billedInAdvance(): JsonField = billedInAdvance + + /** For custom cadence: specifies the duration of the billing period in days or months. */ + @JsonProperty("billing_cycle_configuration") + @ExcludeMissing + fun _billingCycleConfiguration(): JsonField = + billingCycleConfiguration + + /** The per unit conversion rate of the price currency to the invoicing currency. */ + @JsonProperty("conversion_rate") + @ExcludeMissing + fun _conversionRate(): JsonField = conversionRate + + /** An alias for the price. */ + @JsonProperty("external_price_id") + @ExcludeMissing + fun _externalPriceId(): JsonField = externalPriceId + + /** If the Price represents a fixed cost, this represents the quantity of units applied. */ + @JsonProperty("fixed_price_quantity") + @ExcludeMissing + fun _fixedPriceQuantity(): JsonField = fixedPriceQuantity + + /** The property used to group this price on an invoice */ + @JsonProperty("invoice_grouping_key") + @ExcludeMissing + fun _invoiceGroupingKey(): JsonField = invoiceGroupingKey + + /** + * Within each billing cycle, specifies the cadence at which invoices are produced. If + * unspecified, a single invoice is produced per billing cycle. + */ + @JsonProperty("invoicing_cycle_configuration") + @ExcludeMissing + fun _invoicingCycleConfiguration(): JsonField = + invoicingCycleConfiguration + + /** + * User-specified key/value pairs for the resource. Individual keys can be removed by + * setting the value to `null`, and the entire metadata mapping can be cleared by setting + * `metadata` to `null`. + */ + @JsonProperty("metadata") @ExcludeMissing fun _metadata(): JsonField = metadata + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + private var validated: Boolean = false + + fun validate(): NewFloatingMaxGroupTieredPrice = apply { + if (validated) { + return@apply + } + + cadence() + currency() + itemId() + maxGroupTieredConfig().validate() + modelType() + name() + billableMetricId() + billedInAdvance() + billingCycleConfiguration().ifPresent { it.validate() } + conversionRate() + externalPriceId() + fixedPriceQuantity() + invoiceGroupingKey() + invoicingCycleConfiguration().ifPresent { it.validate() } + metadata().ifPresent { it.validate() } + validated = true + } + + fun toBuilder() = Builder().from(this) + + companion object { + + @JvmStatic fun builder() = Builder() + } + + class Builder { + + private var cadence: JsonField? = null + private var currency: JsonField? = null + private var itemId: JsonField? = null + private var maxGroupTieredConfig: JsonField? = null + private var modelType: JsonField? = null + private var name: JsonField? = null + private var billableMetricId: JsonField = JsonMissing.of() + private var billedInAdvance: JsonField = JsonMissing.of() + private var billingCycleConfiguration: JsonField = + JsonMissing.of() + private var conversionRate: JsonField = JsonMissing.of() + private var externalPriceId: JsonField = JsonMissing.of() + private var fixedPriceQuantity: JsonField = JsonMissing.of() + private var invoiceGroupingKey: JsonField = JsonMissing.of() + private var invoicingCycleConfiguration: JsonField = + JsonMissing.of() + private var metadata: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(newFloatingMaxGroupTieredPrice: NewFloatingMaxGroupTieredPrice) = + apply { + cadence = newFloatingMaxGroupTieredPrice.cadence + currency = newFloatingMaxGroupTieredPrice.currency + itemId = newFloatingMaxGroupTieredPrice.itemId + maxGroupTieredConfig = newFloatingMaxGroupTieredPrice.maxGroupTieredConfig + modelType = newFloatingMaxGroupTieredPrice.modelType + name = newFloatingMaxGroupTieredPrice.name + billableMetricId = newFloatingMaxGroupTieredPrice.billableMetricId + billedInAdvance = newFloatingMaxGroupTieredPrice.billedInAdvance + billingCycleConfiguration = + newFloatingMaxGroupTieredPrice.billingCycleConfiguration + conversionRate = newFloatingMaxGroupTieredPrice.conversionRate + externalPriceId = newFloatingMaxGroupTieredPrice.externalPriceId + fixedPriceQuantity = newFloatingMaxGroupTieredPrice.fixedPriceQuantity + invoiceGroupingKey = newFloatingMaxGroupTieredPrice.invoiceGroupingKey + invoicingCycleConfiguration = + newFloatingMaxGroupTieredPrice.invoicingCycleConfiguration + metadata = newFloatingMaxGroupTieredPrice.metadata + additionalProperties = + newFloatingMaxGroupTieredPrice.additionalProperties.toMutableMap() + } + + /** The cadence to bill for this price on. */ + fun cadence(cadence: Cadence) = cadence(JsonField.of(cadence)) + + /** The cadence to bill for this price on. */ + fun cadence(cadence: JsonField) = apply { this.cadence = cadence } + + /** An ISO 4217 currency string for which this price is billed in. */ + fun currency(currency: String) = currency(JsonField.of(currency)) + + /** An ISO 4217 currency string for which this price is billed in. */ + fun currency(currency: JsonField) = apply { this.currency = currency } + + /** The id of the item the plan will be associated with. */ + fun itemId(itemId: String) = itemId(JsonField.of(itemId)) + + /** The id of the item the plan will be associated with. */ + fun itemId(itemId: JsonField) = apply { this.itemId = itemId } + + fun maxGroupTieredConfig(maxGroupTieredConfig: MaxGroupTieredConfig) = + maxGroupTieredConfig(JsonField.of(maxGroupTieredConfig)) + + fun maxGroupTieredConfig(maxGroupTieredConfig: JsonField) = + apply { + this.maxGroupTieredConfig = maxGroupTieredConfig + } + + fun modelType(modelType: ModelType) = modelType(JsonField.of(modelType)) + + fun modelType(modelType: JsonField) = apply { this.modelType = modelType } + + /** The name of the price. */ + fun name(name: String) = name(JsonField.of(name)) + + /** The name of the price. */ + fun name(name: JsonField) = apply { this.name = name } + + /** + * The id of the billable metric for the price. Only needed if the price is usage-based. + */ + fun billableMetricId(billableMetricId: String?) = + billableMetricId(JsonField.ofNullable(billableMetricId)) + + /** + * The id of the billable metric for the price. Only needed if the price is usage-based. + */ + fun billableMetricId(billableMetricId: Optional) = + billableMetricId(billableMetricId.orElse(null)) + + /** + * The id of the billable metric for the price. Only needed if the price is usage-based. + */ + fun billableMetricId(billableMetricId: JsonField) = apply { + this.billableMetricId = billableMetricId + } + + /** + * If the Price represents a fixed cost, the price will be billed in-advance if this is + * true, and in-arrears if this is false. + */ + fun billedInAdvance(billedInAdvance: Boolean?) = + billedInAdvance(JsonField.ofNullable(billedInAdvance)) + + /** + * If the Price represents a fixed cost, the price will be billed in-advance if this is + * true, and in-arrears if this is false. + */ + fun billedInAdvance(billedInAdvance: Boolean) = + billedInAdvance(billedInAdvance as Boolean?) + + /** + * If the Price represents a fixed cost, the price will be billed in-advance if this is + * true, and in-arrears if this is false. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun billedInAdvance(billedInAdvance: Optional) = + billedInAdvance(billedInAdvance.orElse(null) as Boolean?) + + /** + * If the Price represents a fixed cost, the price will be billed in-advance if this is + * true, and in-arrears if this is false. + */ + fun billedInAdvance(billedInAdvance: JsonField) = apply { + this.billedInAdvance = billedInAdvance + } + + /** + * For custom cadence: specifies the duration of the billing period in days or months. + */ + fun billingCycleConfiguration(billingCycleConfiguration: BillingCycleConfiguration?) = + billingCycleConfiguration(JsonField.ofNullable(billingCycleConfiguration)) + + /** + * For custom cadence: specifies the duration of the billing period in days or months. + */ + fun billingCycleConfiguration( + billingCycleConfiguration: Optional + ) = billingCycleConfiguration(billingCycleConfiguration.orElse(null)) + + /** + * For custom cadence: specifies the duration of the billing period in days or months. + */ + fun billingCycleConfiguration( + billingCycleConfiguration: JsonField + ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } + + /** The per unit conversion rate of the price currency to the invoicing currency. */ + fun conversionRate(conversionRate: Double?) = + conversionRate(JsonField.ofNullable(conversionRate)) + + /** The per unit conversion rate of the price currency to the invoicing currency. */ + fun conversionRate(conversionRate: Double) = conversionRate(conversionRate as Double?) + + /** The per unit conversion rate of the price currency to the invoicing currency. */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun conversionRate(conversionRate: Optional) = + conversionRate(conversionRate.orElse(null) as Double?) + + /** The per unit conversion rate of the price currency to the invoicing currency. */ + fun conversionRate(conversionRate: JsonField) = apply { + this.conversionRate = conversionRate + } + + /** An alias for the price. */ + fun externalPriceId(externalPriceId: String?) = + externalPriceId(JsonField.ofNullable(externalPriceId)) + + /** An alias for the price. */ + fun externalPriceId(externalPriceId: Optional) = + externalPriceId(externalPriceId.orElse(null)) + + /** An alias for the price. */ + fun externalPriceId(externalPriceId: JsonField) = apply { + this.externalPriceId = externalPriceId + } + + /** + * If the Price represents a fixed cost, this represents the quantity of units applied. + */ + fun fixedPriceQuantity(fixedPriceQuantity: Double?) = + fixedPriceQuantity(JsonField.ofNullable(fixedPriceQuantity)) + + /** + * If the Price represents a fixed cost, this represents the quantity of units applied. + */ + fun fixedPriceQuantity(fixedPriceQuantity: Double) = + fixedPriceQuantity(fixedPriceQuantity as Double?) + + /** + * If the Price represents a fixed cost, this represents the quantity of units applied. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun fixedPriceQuantity(fixedPriceQuantity: Optional) = + fixedPriceQuantity(fixedPriceQuantity.orElse(null) as Double?) + + /** + * If the Price represents a fixed cost, this represents the quantity of units applied. + */ + fun fixedPriceQuantity(fixedPriceQuantity: JsonField) = apply { + this.fixedPriceQuantity = fixedPriceQuantity + } + + /** The property used to group this price on an invoice */ + fun invoiceGroupingKey(invoiceGroupingKey: String?) = + invoiceGroupingKey(JsonField.ofNullable(invoiceGroupingKey)) + + /** The property used to group this price on an invoice */ + fun invoiceGroupingKey(invoiceGroupingKey: Optional) = + invoiceGroupingKey(invoiceGroupingKey.orElse(null)) + + /** The property used to group this price on an invoice */ + fun invoiceGroupingKey(invoiceGroupingKey: JsonField) = apply { + this.invoiceGroupingKey = invoiceGroupingKey + } + + /** + * Within each billing cycle, specifies the cadence at which invoices are produced. If + * unspecified, a single invoice is produced per billing cycle. + */ + fun invoicingCycleConfiguration( + invoicingCycleConfiguration: InvoicingCycleConfiguration? + ) = invoicingCycleConfiguration(JsonField.ofNullable(invoicingCycleConfiguration)) + + /** + * Within each billing cycle, specifies the cadence at which invoices are produced. If + * unspecified, a single invoice is produced per billing cycle. + */ + fun invoicingCycleConfiguration( + invoicingCycleConfiguration: Optional + ) = invoicingCycleConfiguration(invoicingCycleConfiguration.orElse(null)) + + /** + * Within each billing cycle, specifies the cadence at which invoices are produced. If + * unspecified, a single invoice is produced per billing cycle. + */ + fun invoicingCycleConfiguration( + invoicingCycleConfiguration: JsonField + ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } + + /** + * User-specified key/value pairs for the resource. Individual keys can be removed by + * setting the value to `null`, and the entire metadata mapping can be cleared by + * setting `metadata` to `null`. + */ + fun metadata(metadata: Metadata?) = metadata(JsonField.ofNullable(metadata)) + + /** + * User-specified key/value pairs for the resource. Individual keys can be removed by + * setting the value to `null`, and the entire metadata mapping can be cleared by + * setting `metadata` to `null`. + */ + fun metadata(metadata: Optional) = metadata(metadata.orElse(null)) + + /** + * User-specified key/value pairs for the resource. Individual keys can be removed by + * setting the value to `null`, and the entire metadata mapping can be cleared by + * setting `metadata` to `null`. + */ + fun metadata(metadata: JsonField) = apply { this.metadata = metadata } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + fun build(): NewFloatingMaxGroupTieredPrice = + NewFloatingMaxGroupTieredPrice( + checkRequired("cadence", cadence), + checkRequired("currency", currency), + checkRequired("itemId", itemId), + checkRequired("maxGroupTieredConfig", maxGroupTieredConfig), + checkRequired("modelType", modelType), + checkRequired("name", name), + billableMetricId, + billedInAdvance, + billingCycleConfiguration, + conversionRate, + externalPriceId, + fixedPriceQuantity, + invoiceGroupingKey, + invoicingCycleConfiguration, + metadata, + additionalProperties.toImmutable(), + ) + } + + class Cadence + @JsonCreator + private constructor( + private val value: JsonField, + ) : Enum { + + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + + companion object { + + @JvmField val ANNUAL = of("annual") + + @JvmField val SEMI_ANNUAL = of("semi_annual") + + @JvmField val MONTHLY = of("monthly") + + @JvmField val QUARTERLY = of("quarterly") + + @JvmField val ONE_TIME = of("one_time") + + @JvmField val CUSTOM = of("custom") + + @JvmStatic fun of(value: String) = Cadence(JsonField.of(value)) + } + + enum class Known { + ANNUAL, + SEMI_ANNUAL, + MONTHLY, + QUARTERLY, + ONE_TIME, + CUSTOM, + } + + enum class Value { + ANNUAL, + SEMI_ANNUAL, + MONTHLY, + QUARTERLY, + ONE_TIME, + CUSTOM, + _UNKNOWN, + } + + fun value(): Value = + when (this) { + ANNUAL -> Value.ANNUAL + SEMI_ANNUAL -> Value.SEMI_ANNUAL + MONTHLY -> Value.MONTHLY + QUARTERLY -> Value.QUARTERLY + ONE_TIME -> Value.ONE_TIME + CUSTOM -> Value.CUSTOM + else -> Value._UNKNOWN + } + + fun known(): Known = + when (this) { + ANNUAL -> Known.ANNUAL + SEMI_ANNUAL -> Known.SEMI_ANNUAL + MONTHLY -> Known.MONTHLY + QUARTERLY -> Known.QUARTERLY + ONE_TIME -> Known.ONE_TIME + CUSTOM -> Known.CUSTOM + else -> throw OrbInvalidDataException("Unknown Cadence: $value") + } + + fun asString(): String = _value().asStringOrThrow() + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is Cadence && value == other.value /* spotless:on */ + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + + @NoAutoDetect + class MaxGroupTieredConfig + @JsonCreator + private constructor( + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), + ) { + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + private var validated: Boolean = false + + fun validate(): MaxGroupTieredConfig = apply { + if (validated) { + return@apply + } + + validated = true + } + + fun toBuilder() = Builder().from(this) + + companion object { + + @JvmStatic fun builder() = Builder() + } + + class Builder { + + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(maxGroupTieredConfig: MaxGroupTieredConfig) = apply { + additionalProperties = maxGroupTieredConfig.additionalProperties.toMutableMap() + } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + fun build(): MaxGroupTieredConfig = + MaxGroupTieredConfig(additionalProperties.toImmutable()) + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is MaxGroupTieredConfig && additionalProperties == other.additionalProperties /* spotless:on */ + } + + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(additionalProperties) } + /* spotless:on */ + + override fun hashCode(): Int = hashCode + + override fun toString() = + "MaxGroupTieredConfig{additionalProperties=$additionalProperties}" + } + + class ModelType + @JsonCreator + private constructor( + private val value: JsonField, + ) : Enum { + + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + + companion object { + + @JvmField val MAX_GROUP_TIERED = of("max_group_tiered") + + @JvmStatic fun of(value: String) = ModelType(JsonField.of(value)) + } + + enum class Known { + MAX_GROUP_TIERED, + } + + enum class Value { + MAX_GROUP_TIERED, + _UNKNOWN, + } + + fun value(): Value = + when (this) { + MAX_GROUP_TIERED -> Value.MAX_GROUP_TIERED + else -> Value._UNKNOWN + } + + fun known(): Known = + when (this) { + MAX_GROUP_TIERED -> Known.MAX_GROUP_TIERED + else -> throw OrbInvalidDataException("Unknown ModelType: $value") + } + + fun asString(): String = _value().asStringOrThrow() + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is ModelType && value == other.value /* spotless:on */ + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + + /** For custom cadence: specifies the duration of the billing period in days or months. */ + @NoAutoDetect + class BillingCycleConfiguration + @JsonCreator + private constructor( + @JsonProperty("duration") + @ExcludeMissing + private val duration: JsonField = JsonMissing.of(), + @JsonProperty("duration_unit") + @ExcludeMissing + private val durationUnit: JsonField = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), + ) { + + /** The duration of the billing period. */ + fun duration(): Long = duration.getRequired("duration") + + /** The unit of billing period duration. */ + fun durationUnit(): DurationUnit = durationUnit.getRequired("duration_unit") + + /** The duration of the billing period. */ + @JsonProperty("duration") @ExcludeMissing fun _duration(): JsonField = duration + + /** The unit of billing period duration. */ + @JsonProperty("duration_unit") + @ExcludeMissing + fun _durationUnit(): JsonField = durationUnit + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + private var validated: Boolean = false + + fun validate(): BillingCycleConfiguration = apply { + if (validated) { + return@apply + } + + duration() + durationUnit() + validated = true + } + + fun toBuilder() = Builder().from(this) + + companion object { + + @JvmStatic fun builder() = Builder() + } + + class Builder { + + private var duration: JsonField? = null + private var durationUnit: JsonField? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(billingCycleConfiguration: BillingCycleConfiguration) = apply { + duration = billingCycleConfiguration.duration + durationUnit = billingCycleConfiguration.durationUnit + additionalProperties = + billingCycleConfiguration.additionalProperties.toMutableMap() + } + + /** The duration of the billing period. */ + fun duration(duration: Long) = duration(JsonField.of(duration)) + + /** The duration of the billing period. */ + fun duration(duration: JsonField) = apply { this.duration = duration } + + /** The unit of billing period duration. */ + fun durationUnit(durationUnit: DurationUnit) = + durationUnit(JsonField.of(durationUnit)) + + /** The unit of billing period duration. */ + fun durationUnit(durationUnit: JsonField) = apply { + this.durationUnit = durationUnit + } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + fun build(): BillingCycleConfiguration = + BillingCycleConfiguration( + checkRequired("duration", duration), + checkRequired("durationUnit", durationUnit), + additionalProperties.toImmutable(), + ) + } + + class DurationUnit + @JsonCreator + private constructor( + private val value: JsonField, + ) : Enum { + + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + + companion object { + + @JvmField val DAY = of("day") + + @JvmField val MONTH = of("month") + + @JvmStatic fun of(value: String) = DurationUnit(JsonField.of(value)) + } + + enum class Known { + DAY, + MONTH, + } + + enum class Value { + DAY, + MONTH, + _UNKNOWN, + } + + fun value(): Value = + when (this) { + DAY -> Value.DAY + MONTH -> Value.MONTH + else -> Value._UNKNOWN + } + + fun known(): Known = + when (this) { + DAY -> Known.DAY + MONTH -> Known.MONTH + else -> throw OrbInvalidDataException("Unknown DurationUnit: $value") + } + + fun asString(): String = _value().asStringOrThrow() + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is DurationUnit && value == other.value /* spotless:on */ + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is BillingCycleConfiguration && duration == other.duration && durationUnit == other.durationUnit && additionalProperties == other.additionalProperties /* spotless:on */ + } + + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(duration, durationUnit, additionalProperties) } + /* spotless:on */ + + override fun hashCode(): Int = hashCode + + override fun toString() = + "BillingCycleConfiguration{duration=$duration, durationUnit=$durationUnit, additionalProperties=$additionalProperties}" + } + + /** + * Within each billing cycle, specifies the cadence at which invoices are produced. If + * unspecified, a single invoice is produced per billing cycle. + */ + @NoAutoDetect + class InvoicingCycleConfiguration + @JsonCreator + private constructor( + @JsonProperty("duration") + @ExcludeMissing + private val duration: JsonField = JsonMissing.of(), + @JsonProperty("duration_unit") + @ExcludeMissing + private val durationUnit: JsonField = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), + ) { + + /** The duration of the billing period. */ + fun duration(): Long = duration.getRequired("duration") + + /** The unit of billing period duration. */ + fun durationUnit(): DurationUnit = durationUnit.getRequired("duration_unit") + + /** The duration of the billing period. */ + @JsonProperty("duration") @ExcludeMissing fun _duration(): JsonField = duration + + /** The unit of billing period duration. */ + @JsonProperty("duration_unit") + @ExcludeMissing + fun _durationUnit(): JsonField = durationUnit + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + private var validated: Boolean = false + + fun validate(): InvoicingCycleConfiguration = apply { + if (validated) { + return@apply + } + + duration() + durationUnit() + validated = true + } + + fun toBuilder() = Builder().from(this) + + companion object { + + @JvmStatic fun builder() = Builder() + } + + class Builder { + + private var duration: JsonField? = null + private var durationUnit: JsonField? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(invoicingCycleConfiguration: InvoicingCycleConfiguration) = + apply { + duration = invoicingCycleConfiguration.duration + durationUnit = invoicingCycleConfiguration.durationUnit + additionalProperties = + invoicingCycleConfiguration.additionalProperties.toMutableMap() + } + + /** The duration of the billing period. */ + fun duration(duration: Long) = duration(JsonField.of(duration)) + + /** The duration of the billing period. */ + fun duration(duration: JsonField) = apply { this.duration = duration } + + /** The unit of billing period duration. */ + fun durationUnit(durationUnit: DurationUnit) = + durationUnit(JsonField.of(durationUnit)) + + /** The unit of billing period duration. */ + fun durationUnit(durationUnit: JsonField) = apply { + this.durationUnit = durationUnit + } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + fun build(): InvoicingCycleConfiguration = + InvoicingCycleConfiguration( + checkRequired("duration", duration), + checkRequired("durationUnit", durationUnit), + additionalProperties.toImmutable(), + ) + } + + class DurationUnit + @JsonCreator + private constructor( + private val value: JsonField, + ) : Enum { + + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + + companion object { + + @JvmField val DAY = of("day") + + @JvmField val MONTH = of("month") + + @JvmStatic fun of(value: String) = DurationUnit(JsonField.of(value)) + } + + enum class Known { + DAY, + MONTH, + } + + enum class Value { + DAY, + MONTH, + _UNKNOWN, + } + + fun value(): Value = + when (this) { + DAY -> Value.DAY + MONTH -> Value.MONTH + else -> Value._UNKNOWN + } + + fun known(): Known = + when (this) { + DAY -> Known.DAY + MONTH -> Known.MONTH + else -> throw OrbInvalidDataException("Unknown DurationUnit: $value") + } + + fun asString(): String = _value().asStringOrThrow() + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is DurationUnit && value == other.value /* spotless:on */ + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is InvoicingCycleConfiguration && duration == other.duration && durationUnit == other.durationUnit && additionalProperties == other.additionalProperties /* spotless:on */ + } + + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(duration, durationUnit, additionalProperties) } + /* spotless:on */ + + override fun hashCode(): Int = hashCode + + override fun toString() = + "InvoicingCycleConfiguration{duration=$duration, durationUnit=$durationUnit, additionalProperties=$additionalProperties}" + } + + /** + * User-specified key/value pairs for the resource. Individual keys can be removed by + * setting the value to `null`, and the entire metadata mapping can be cleared by setting + * `metadata` to `null`. + */ + @NoAutoDetect + class Metadata + @JsonCreator + private constructor( + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), + ) { + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + private var validated: Boolean = false + + fun validate(): Metadata = apply { + if (validated) { + return@apply + } + + validated = true + } + + fun toBuilder() = Builder().from(this) + + companion object { + + @JvmStatic fun builder() = Builder() + } + + class Builder { + + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(metadata: Metadata) = apply { + additionalProperties = metadata.additionalProperties.toMutableMap() + } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + fun build(): Metadata = Metadata(additionalProperties.toImmutable()) + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is Metadata && additionalProperties == other.additionalProperties /* spotless:on */ + } + + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(additionalProperties) } + /* spotless:on */ + + override fun hashCode(): Int = hashCode + + override fun toString() = "Metadata{additionalProperties=$additionalProperties}" + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is NewFloatingMaxGroupTieredPrice && cadence == other.cadence && currency == other.currency && itemId == other.itemId && maxGroupTieredConfig == other.maxGroupTieredConfig && modelType == other.modelType && name == other.name && billableMetricId == other.billableMetricId && billedInAdvance == other.billedInAdvance && billingCycleConfiguration == other.billingCycleConfiguration && conversionRate == other.conversionRate && externalPriceId == other.externalPriceId && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && invoicingCycleConfiguration == other.invoicingCycleConfiguration && metadata == other.metadata && additionalProperties == other.additionalProperties /* spotless:on */ + } + + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(cadence, currency, itemId, maxGroupTieredConfig, modelType, name, billableMetricId, billedInAdvance, billingCycleConfiguration, conversionRate, externalPriceId, fixedPriceQuantity, invoiceGroupingKey, invoicingCycleConfiguration, metadata, additionalProperties) } + /* spotless:on */ + + override fun hashCode(): Int = hashCode + + override fun toString() = + "NewFloatingMaxGroupTieredPrice{cadence=$cadence, currency=$currency, itemId=$itemId, maxGroupTieredConfig=$maxGroupTieredConfig, modelType=$modelType, name=$name, billableMetricId=$billableMetricId, billedInAdvance=$billedInAdvance, billingCycleConfiguration=$billingCycleConfiguration, conversionRate=$conversionRate, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, invoicingCycleConfiguration=$invoicingCycleConfiguration, metadata=$metadata, additionalProperties=$additionalProperties}" + } + @NoAutoDetect class NewFloatingTieredWithMinimumPrice @JsonCreator diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/Subscription.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/Subscription.kt index 2e0e4eb1..a544bea5 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/Subscription.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/Subscription.kt @@ -12082,6 +12082,237 @@ private constructor( fun price(groupedTieredPackagePrice: Price.GroupedTieredPackagePrice) = price(Price.ofGroupedTieredPackagePrice(groupedTieredPackagePrice)) + /** + * The Price resource represents a price that can be billed on a subscription, resulting + * in a charge on an invoice in the form of an invoice line item. Prices take a quantity + * and determine an amount to bill. + * + * Orb supports a few different pricing models out of the box. Each of these models is + * serialized differently in a given Price object. The model_type field determines the + * key for the configuration object that is present. + * + * ## Unit pricing + * + * With unit pricing, each unit costs a fixed amount. + * + * ```json + * { + * ... + * "model_type": "unit", + * "unit_config": { + * "unit_amount": "0.50" + * } + * ... + * } + * ``` + * + * ## Tiered pricing + * + * In tiered pricing, the cost of a given unit depends on the tier range that it falls + * into, where each tier range is defined by an upper and lower bound. For example, the + * first ten units may cost $0.50 each and all units thereafter may cost $0.10 each. + * + * ```json + * { + * ... + * "model_type": "tiered", + * "tiered_config": { + * "tiers": [ + * { + * "first_unit": 1, + * "last_unit": 10, + * "unit_amount": "0.50" + * }, + * { + * "first_unit": 11, + * "last_unit": null, + * "unit_amount": "0.10" + * } + * ] + * } + * ... + * ``` + * + * ## Bulk pricing + * + * Bulk pricing applies when the number of units determine the cost of all units. For + * example, if you've bought less than 10 units, they may each be $0.50 for a total of + * $5.00. Once you've bought more than 10 units, all units may now be priced at $0.40 + * (i.e. 101 units total would be $40.40). + * + * ```json + * { + * ... + * "model_type": "bulk", + * "bulk_config": { + * "tiers": [ + * { + * "maximum_units": 10, + * "unit_amount": "0.50" + * }, + * { + * "maximum_units": 1000, + * "unit_amount": "0.40" + * } + * ] + * } + * ... + * } + * ``` + * + * ## Package pricing + * + * Package pricing defines the size or granularity of a unit for billing purposes. For + * example, if the package size is set to 5, then 4 units will be billed as 5 and 6 + * units will be billed at 10. + * + * ```json + * { + * ... + * "model_type": "package", + * "package_config": { + * "package_amount": "0.80", + * "package_size": 10 + * } + * ... + * } + * ``` + * + * ## BPS pricing + * + * BPS pricing specifies a per-event (e.g. per-payment) rate in one hundredth of a + * percent (the number of basis points to charge), as well as a cap per event to assess. + * For example, this would allow you to assess a fee of 0.25% on every payment you + * process, with a maximum charge of $25 per payment. + * + * ```json + * { + * ... + * "model_type": "bps", + * "bps_config": { + * "bps": 125, + * "per_unit_maximum": "11.00" + * } + * ... + * } + * ``` + * + * ## Bulk BPS pricing + * + * Bulk BPS pricing specifies BPS parameters in a tiered manner, dependent on the total + * quantity across all events. Similar to bulk pricing, the BPS parameters of a given + * event depends on the tier range that the billing period falls into. Each tier range + * is defined by an upper bound. For example, after $1.5M of payment volume is reached, + * each individual payment may have a lower cap or a smaller take-rate. + * + * ```json + * ... + * "model_type": "bulk_bps", + * "bulk_bps_config": { + * "tiers": [ + * { + * "maximum_amount": "1000000.00", + * "bps": 125, + * "per_unit_maximum": "19.00" + * }, + * { + * "maximum_amount": null, + * "bps": 115, + * "per_unit_maximum": "4.00" + * } + * ] + * } + * ... + * } + * ``` + * + * ## Tiered BPS pricing + * + * Tiered BPS pricing specifies BPS parameters in a graduated manner, where an event's + * applicable parameter is a function of its marginal addition to the period total. + * Similar to tiered pricing, the BPS parameters of a given event depends on the tier + * range that it falls into, where each tier range is defined by an upper and lower + * bound. For example, the first few payments may have a 0.8 BPS take-rate and all + * payments after a specific volume may incur a take-rate of 0.5 BPS each. + * + * ```json + * ... + * "model_type": "tiered_bps", + * "tiered_bps_config": { + * "tiers": [ + * { + * "minimum_amount": "0", + * "maximum_amount": "1000000.00", + * "bps": 125, + * "per_unit_maximum": "19.00" + * }, + * { + * "minimum_amount": "1000000.00", + * "maximum_amount": null, + * "bps": 115, + * "per_unit_maximum": "4.00" + * } + * ] + * } + * ... + * } + * ``` + * + * ## Matrix pricing + * + * Matrix pricing defines a set of unit prices in a one or two-dimensional matrix. + * `dimensions` defines the two event property values evaluated in this pricing model. + * In a one-dimensional matrix, the second value is `null`. Every configuration has a + * list of `matrix_values` which give the unit prices for specified property values. In + * a one-dimensional matrix, the matrix values will have `dimension_values` where the + * second value of the pair is null. If an event does not match any of the dimension + * values in the matrix, it will resort to the `default_unit_amount`. + * + * ```json + * { + * "model_type": "matrix" + * "matrix_config": { + * "default_unit_amount": "3.00", + * "dimensions": [ + * "cluster_name", + * "region" + * ], + * "matrix_values": [ + * { + * "dimension_values": [ + * "alpha", + * "west" + * ], + * "unit_amount": "2.00" + * }, + * ... + * ] + * } + * } + * ``` + * + * ## Fixed fees + * + * Fixed fees are prices that are applied independent of usage quantities, and follow + * unit pricing. They also have an additional parameter `fixed_price_quantity`. If the + * Price represents a fixed cost, this represents the quantity of units applied. + * + * ```json + * { + * ... + * "id": "price_id", + * "model_type": "unit", + * "unit_config": { + * "unit_amount": "2.00" + * }, + * "fixed_price_quantity": 3.0 + * ... + * } + * ``` + */ + fun price(maxGroupTieredPrice: Price.MaxGroupTieredPrice) = + price(Price.ofMaxGroupTieredPrice(maxGroupTieredPrice)) + /** * The start date of the price interval. This is the date that Orb starts billing for * this price. diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionCancelResponse.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionCancelResponse.kt index e26e32d4..c5513eed 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionCancelResponse.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionCancelResponse.kt @@ -12069,6 +12069,237 @@ private constructor( fun price(groupedTieredPackagePrice: Price.GroupedTieredPackagePrice) = price(Price.ofGroupedTieredPackagePrice(groupedTieredPackagePrice)) + /** + * The Price resource represents a price that can be billed on a subscription, resulting + * in a charge on an invoice in the form of an invoice line item. Prices take a quantity + * and determine an amount to bill. + * + * Orb supports a few different pricing models out of the box. Each of these models is + * serialized differently in a given Price object. The model_type field determines the + * key for the configuration object that is present. + * + * ## Unit pricing + * + * With unit pricing, each unit costs a fixed amount. + * + * ```json + * { + * ... + * "model_type": "unit", + * "unit_config": { + * "unit_amount": "0.50" + * } + * ... + * } + * ``` + * + * ## Tiered pricing + * + * In tiered pricing, the cost of a given unit depends on the tier range that it falls + * into, where each tier range is defined by an upper and lower bound. For example, the + * first ten units may cost $0.50 each and all units thereafter may cost $0.10 each. + * + * ```json + * { + * ... + * "model_type": "tiered", + * "tiered_config": { + * "tiers": [ + * { + * "first_unit": 1, + * "last_unit": 10, + * "unit_amount": "0.50" + * }, + * { + * "first_unit": 11, + * "last_unit": null, + * "unit_amount": "0.10" + * } + * ] + * } + * ... + * ``` + * + * ## Bulk pricing + * + * Bulk pricing applies when the number of units determine the cost of all units. For + * example, if you've bought less than 10 units, they may each be $0.50 for a total of + * $5.00. Once you've bought more than 10 units, all units may now be priced at $0.40 + * (i.e. 101 units total would be $40.40). + * + * ```json + * { + * ... + * "model_type": "bulk", + * "bulk_config": { + * "tiers": [ + * { + * "maximum_units": 10, + * "unit_amount": "0.50" + * }, + * { + * "maximum_units": 1000, + * "unit_amount": "0.40" + * } + * ] + * } + * ... + * } + * ``` + * + * ## Package pricing + * + * Package pricing defines the size or granularity of a unit for billing purposes. For + * example, if the package size is set to 5, then 4 units will be billed as 5 and 6 + * units will be billed at 10. + * + * ```json + * { + * ... + * "model_type": "package", + * "package_config": { + * "package_amount": "0.80", + * "package_size": 10 + * } + * ... + * } + * ``` + * + * ## BPS pricing + * + * BPS pricing specifies a per-event (e.g. per-payment) rate in one hundredth of a + * percent (the number of basis points to charge), as well as a cap per event to assess. + * For example, this would allow you to assess a fee of 0.25% on every payment you + * process, with a maximum charge of $25 per payment. + * + * ```json + * { + * ... + * "model_type": "bps", + * "bps_config": { + * "bps": 125, + * "per_unit_maximum": "11.00" + * } + * ... + * } + * ``` + * + * ## Bulk BPS pricing + * + * Bulk BPS pricing specifies BPS parameters in a tiered manner, dependent on the total + * quantity across all events. Similar to bulk pricing, the BPS parameters of a given + * event depends on the tier range that the billing period falls into. Each tier range + * is defined by an upper bound. For example, after $1.5M of payment volume is reached, + * each individual payment may have a lower cap or a smaller take-rate. + * + * ```json + * ... + * "model_type": "bulk_bps", + * "bulk_bps_config": { + * "tiers": [ + * { + * "maximum_amount": "1000000.00", + * "bps": 125, + * "per_unit_maximum": "19.00" + * }, + * { + * "maximum_amount": null, + * "bps": 115, + * "per_unit_maximum": "4.00" + * } + * ] + * } + * ... + * } + * ``` + * + * ## Tiered BPS pricing + * + * Tiered BPS pricing specifies BPS parameters in a graduated manner, where an event's + * applicable parameter is a function of its marginal addition to the period total. + * Similar to tiered pricing, the BPS parameters of a given event depends on the tier + * range that it falls into, where each tier range is defined by an upper and lower + * bound. For example, the first few payments may have a 0.8 BPS take-rate and all + * payments after a specific volume may incur a take-rate of 0.5 BPS each. + * + * ```json + * ... + * "model_type": "tiered_bps", + * "tiered_bps_config": { + * "tiers": [ + * { + * "minimum_amount": "0", + * "maximum_amount": "1000000.00", + * "bps": 125, + * "per_unit_maximum": "19.00" + * }, + * { + * "minimum_amount": "1000000.00", + * "maximum_amount": null, + * "bps": 115, + * "per_unit_maximum": "4.00" + * } + * ] + * } + * ... + * } + * ``` + * + * ## Matrix pricing + * + * Matrix pricing defines a set of unit prices in a one or two-dimensional matrix. + * `dimensions` defines the two event property values evaluated in this pricing model. + * In a one-dimensional matrix, the second value is `null`. Every configuration has a + * list of `matrix_values` which give the unit prices for specified property values. In + * a one-dimensional matrix, the matrix values will have `dimension_values` where the + * second value of the pair is null. If an event does not match any of the dimension + * values in the matrix, it will resort to the `default_unit_amount`. + * + * ```json + * { + * "model_type": "matrix" + * "matrix_config": { + * "default_unit_amount": "3.00", + * "dimensions": [ + * "cluster_name", + * "region" + * ], + * "matrix_values": [ + * { + * "dimension_values": [ + * "alpha", + * "west" + * ], + * "unit_amount": "2.00" + * }, + * ... + * ] + * } + * } + * ``` + * + * ## Fixed fees + * + * Fixed fees are prices that are applied independent of usage quantities, and follow + * unit pricing. They also have an additional parameter `fixed_price_quantity`. If the + * Price represents a fixed cost, this represents the quantity of units applied. + * + * ```json + * { + * ... + * "id": "price_id", + * "model_type": "unit", + * "unit_config": { + * "unit_amount": "2.00" + * }, + * "fixed_price_quantity": 3.0 + * ... + * } + * ``` + */ + fun price(maxGroupTieredPrice: Price.MaxGroupTieredPrice) = + price(Price.ofMaxGroupTieredPrice(maxGroupTieredPrice)) + /** * The start date of the price interval. This is the date that Orb starts billing for * this price. diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionCreateResponse.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionCreateResponse.kt index f51fa8b5..b4ce5109 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionCreateResponse.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionCreateResponse.kt @@ -12069,6 +12069,237 @@ private constructor( fun price(groupedTieredPackagePrice: Price.GroupedTieredPackagePrice) = price(Price.ofGroupedTieredPackagePrice(groupedTieredPackagePrice)) + /** + * The Price resource represents a price that can be billed on a subscription, resulting + * in a charge on an invoice in the form of an invoice line item. Prices take a quantity + * and determine an amount to bill. + * + * Orb supports a few different pricing models out of the box. Each of these models is + * serialized differently in a given Price object. The model_type field determines the + * key for the configuration object that is present. + * + * ## Unit pricing + * + * With unit pricing, each unit costs a fixed amount. + * + * ```json + * { + * ... + * "model_type": "unit", + * "unit_config": { + * "unit_amount": "0.50" + * } + * ... + * } + * ``` + * + * ## Tiered pricing + * + * In tiered pricing, the cost of a given unit depends on the tier range that it falls + * into, where each tier range is defined by an upper and lower bound. For example, the + * first ten units may cost $0.50 each and all units thereafter may cost $0.10 each. + * + * ```json + * { + * ... + * "model_type": "tiered", + * "tiered_config": { + * "tiers": [ + * { + * "first_unit": 1, + * "last_unit": 10, + * "unit_amount": "0.50" + * }, + * { + * "first_unit": 11, + * "last_unit": null, + * "unit_amount": "0.10" + * } + * ] + * } + * ... + * ``` + * + * ## Bulk pricing + * + * Bulk pricing applies when the number of units determine the cost of all units. For + * example, if you've bought less than 10 units, they may each be $0.50 for a total of + * $5.00. Once you've bought more than 10 units, all units may now be priced at $0.40 + * (i.e. 101 units total would be $40.40). + * + * ```json + * { + * ... + * "model_type": "bulk", + * "bulk_config": { + * "tiers": [ + * { + * "maximum_units": 10, + * "unit_amount": "0.50" + * }, + * { + * "maximum_units": 1000, + * "unit_amount": "0.40" + * } + * ] + * } + * ... + * } + * ``` + * + * ## Package pricing + * + * Package pricing defines the size or granularity of a unit for billing purposes. For + * example, if the package size is set to 5, then 4 units will be billed as 5 and 6 + * units will be billed at 10. + * + * ```json + * { + * ... + * "model_type": "package", + * "package_config": { + * "package_amount": "0.80", + * "package_size": 10 + * } + * ... + * } + * ``` + * + * ## BPS pricing + * + * BPS pricing specifies a per-event (e.g. per-payment) rate in one hundredth of a + * percent (the number of basis points to charge), as well as a cap per event to assess. + * For example, this would allow you to assess a fee of 0.25% on every payment you + * process, with a maximum charge of $25 per payment. + * + * ```json + * { + * ... + * "model_type": "bps", + * "bps_config": { + * "bps": 125, + * "per_unit_maximum": "11.00" + * } + * ... + * } + * ``` + * + * ## Bulk BPS pricing + * + * Bulk BPS pricing specifies BPS parameters in a tiered manner, dependent on the total + * quantity across all events. Similar to bulk pricing, the BPS parameters of a given + * event depends on the tier range that the billing period falls into. Each tier range + * is defined by an upper bound. For example, after $1.5M of payment volume is reached, + * each individual payment may have a lower cap or a smaller take-rate. + * + * ```json + * ... + * "model_type": "bulk_bps", + * "bulk_bps_config": { + * "tiers": [ + * { + * "maximum_amount": "1000000.00", + * "bps": 125, + * "per_unit_maximum": "19.00" + * }, + * { + * "maximum_amount": null, + * "bps": 115, + * "per_unit_maximum": "4.00" + * } + * ] + * } + * ... + * } + * ``` + * + * ## Tiered BPS pricing + * + * Tiered BPS pricing specifies BPS parameters in a graduated manner, where an event's + * applicable parameter is a function of its marginal addition to the period total. + * Similar to tiered pricing, the BPS parameters of a given event depends on the tier + * range that it falls into, where each tier range is defined by an upper and lower + * bound. For example, the first few payments may have a 0.8 BPS take-rate and all + * payments after a specific volume may incur a take-rate of 0.5 BPS each. + * + * ```json + * ... + * "model_type": "tiered_bps", + * "tiered_bps_config": { + * "tiers": [ + * { + * "minimum_amount": "0", + * "maximum_amount": "1000000.00", + * "bps": 125, + * "per_unit_maximum": "19.00" + * }, + * { + * "minimum_amount": "1000000.00", + * "maximum_amount": null, + * "bps": 115, + * "per_unit_maximum": "4.00" + * } + * ] + * } + * ... + * } + * ``` + * + * ## Matrix pricing + * + * Matrix pricing defines a set of unit prices in a one or two-dimensional matrix. + * `dimensions` defines the two event property values evaluated in this pricing model. + * In a one-dimensional matrix, the second value is `null`. Every configuration has a + * list of `matrix_values` which give the unit prices for specified property values. In + * a one-dimensional matrix, the matrix values will have `dimension_values` where the + * second value of the pair is null. If an event does not match any of the dimension + * values in the matrix, it will resort to the `default_unit_amount`. + * + * ```json + * { + * "model_type": "matrix" + * "matrix_config": { + * "default_unit_amount": "3.00", + * "dimensions": [ + * "cluster_name", + * "region" + * ], + * "matrix_values": [ + * { + * "dimension_values": [ + * "alpha", + * "west" + * ], + * "unit_amount": "2.00" + * }, + * ... + * ] + * } + * } + * ``` + * + * ## Fixed fees + * + * Fixed fees are prices that are applied independent of usage quantities, and follow + * unit pricing. They also have an additional parameter `fixed_price_quantity`. If the + * Price represents a fixed cost, this represents the quantity of units applied. + * + * ```json + * { + * ... + * "id": "price_id", + * "model_type": "unit", + * "unit_config": { + * "unit_amount": "2.00" + * }, + * "fixed_price_quantity": 3.0 + * ... + * } + * ``` + */ + fun price(maxGroupTieredPrice: Price.MaxGroupTieredPrice) = + price(Price.ofMaxGroupTieredPrice(maxGroupTieredPrice)) + /** * The start date of the price interval. This is the date that Orb starts billing for * this price. diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionFetchCostsResponse.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionFetchCostsResponse.kt index 9d23267b..dbfcd2c4 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionFetchCostsResponse.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionFetchCostsResponse.kt @@ -6928,6 +6928,241 @@ private constructor( fun price(groupedTieredPackagePrice: Price.GroupedTieredPackagePrice) = price(Price.ofGroupedTieredPackagePrice(groupedTieredPackagePrice)) + /** + * The Price resource represents a price that can be billed on a subscription, + * resulting in a charge on an invoice in the form of an invoice line item. Prices + * take a quantity and determine an amount to bill. + * + * Orb supports a few different pricing models out of the box. Each of these models + * is serialized differently in a given Price object. The model_type field + * determines the key for the configuration object that is present. + * + * ## Unit pricing + * + * With unit pricing, each unit costs a fixed amount. + * + * ```json + * { + * ... + * "model_type": "unit", + * "unit_config": { + * "unit_amount": "0.50" + * } + * ... + * } + * ``` + * + * ## Tiered pricing + * + * In tiered pricing, the cost of a given unit depends on the tier range that it + * falls into, where each tier range is defined by an upper and lower bound. For + * example, the first ten units may cost $0.50 each and all units thereafter may + * cost $0.10 each. + * + * ```json + * { + * ... + * "model_type": "tiered", + * "tiered_config": { + * "tiers": [ + * { + * "first_unit": 1, + * "last_unit": 10, + * "unit_amount": "0.50" + * }, + * { + * "first_unit": 11, + * "last_unit": null, + * "unit_amount": "0.10" + * } + * ] + * } + * ... + * ``` + * + * ## Bulk pricing + * + * Bulk pricing applies when the number of units determine the cost of all units. + * For example, if you've bought less than 10 units, they may each be $0.50 for a + * total of $5.00. Once you've bought more than 10 units, all units may now be + * priced at $0.40 (i.e. 101 units total would be $40.40). + * + * ```json + * { + * ... + * "model_type": "bulk", + * "bulk_config": { + * "tiers": [ + * { + * "maximum_units": 10, + * "unit_amount": "0.50" + * }, + * { + * "maximum_units": 1000, + * "unit_amount": "0.40" + * } + * ] + * } + * ... + * } + * ``` + * + * ## Package pricing + * + * Package pricing defines the size or granularity of a unit for billing purposes. + * For example, if the package size is set to 5, then 4 units will be billed as 5 + * and 6 units will be billed at 10. + * + * ```json + * { + * ... + * "model_type": "package", + * "package_config": { + * "package_amount": "0.80", + * "package_size": 10 + * } + * ... + * } + * ``` + * + * ## BPS pricing + * + * BPS pricing specifies a per-event (e.g. per-payment) rate in one hundredth of a + * percent (the number of basis points to charge), as well as a cap per event to + * assess. For example, this would allow you to assess a fee of 0.25% on every + * payment you process, with a maximum charge of $25 per payment. + * + * ```json + * { + * ... + * "model_type": "bps", + * "bps_config": { + * "bps": 125, + * "per_unit_maximum": "11.00" + * } + * ... + * } + * ``` + * + * ## Bulk BPS pricing + * + * Bulk BPS pricing specifies BPS parameters in a tiered manner, dependent on the + * total quantity across all events. Similar to bulk pricing, the BPS parameters of + * a given event depends on the tier range that the billing period falls into. Each + * tier range is defined by an upper bound. For example, after $1.5M of payment + * volume is reached, each individual payment may have a lower cap or a smaller + * take-rate. + * + * ```json + * ... + * "model_type": "bulk_bps", + * "bulk_bps_config": { + * "tiers": [ + * { + * "maximum_amount": "1000000.00", + * "bps": 125, + * "per_unit_maximum": "19.00" + * }, + * { + * "maximum_amount": null, + * "bps": 115, + * "per_unit_maximum": "4.00" + * } + * ] + * } + * ... + * } + * ``` + * + * ## Tiered BPS pricing + * + * Tiered BPS pricing specifies BPS parameters in a graduated manner, where an + * event's applicable parameter is a function of its marginal addition to the period + * total. Similar to tiered pricing, the BPS parameters of a given event depends on + * the tier range that it falls into, where each tier range is defined by an upper + * and lower bound. For example, the first few payments may have a 0.8 BPS take-rate + * and all payments after a specific volume may incur a take-rate of 0.5 BPS each. + * + * ```json + * ... + * "model_type": "tiered_bps", + * "tiered_bps_config": { + * "tiers": [ + * { + * "minimum_amount": "0", + * "maximum_amount": "1000000.00", + * "bps": 125, + * "per_unit_maximum": "19.00" + * }, + * { + * "minimum_amount": "1000000.00", + * "maximum_amount": null, + * "bps": 115, + * "per_unit_maximum": "4.00" + * } + * ] + * } + * ... + * } + * ``` + * + * ## Matrix pricing + * + * Matrix pricing defines a set of unit prices in a one or two-dimensional matrix. + * `dimensions` defines the two event property values evaluated in this pricing + * model. In a one-dimensional matrix, the second value is `null`. Every + * configuration has a list of `matrix_values` which give the unit prices for + * specified property values. In a one-dimensional matrix, the matrix values will + * have `dimension_values` where the second value of the pair is null. If an event + * does not match any of the dimension values in the matrix, it will resort to the + * `default_unit_amount`. + * + * ```json + * { + * "model_type": "matrix" + * "matrix_config": { + * "default_unit_amount": "3.00", + * "dimensions": [ + * "cluster_name", + * "region" + * ], + * "matrix_values": [ + * { + * "dimension_values": [ + * "alpha", + * "west" + * ], + * "unit_amount": "2.00" + * }, + * ... + * ] + * } + * } + * ``` + * + * ## Fixed fees + * + * Fixed fees are prices that are applied independent of usage quantities, and + * follow unit pricing. They also have an additional parameter + * `fixed_price_quantity`. If the Price represents a fixed cost, this represents the + * quantity of units applied. + * + * ```json + * { + * ... + * "id": "price_id", + * "model_type": "unit", + * "unit_config": { + * "unit_amount": "2.00" + * }, + * "fixed_price_quantity": 3.0 + * ... + * } + * ``` + */ + fun price(maxGroupTieredPrice: Price.MaxGroupTieredPrice) = + price(Price.ofMaxGroupTieredPrice(maxGroupTieredPrice)) + /** * Price's contributions for the timeframe, excluding any minimums and discounts. */ diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionPriceIntervalsParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionPriceIntervalsParams.kt index f0c39224..aca775dc 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionPriceIntervalsParams.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionPriceIntervalsParams.kt @@ -1077,6 +1077,10 @@ constructor( fun price(newFloatingGroupedTieredPrice: Price.NewFloatingGroupedTieredPrice) = price(Price.ofNewFloatingGroupedTieredPrice(newFloatingGroupedTieredPrice)) + /** The definition of a new price to create and add to the subscription. */ + fun price(newFloatingMaxGroupTieredPrice: Price.NewFloatingMaxGroupTieredPrice) = + price(Price.ofNewFloatingMaxGroupTieredPrice(newFloatingMaxGroupTieredPrice)) + /** The definition of a new price to create and add to the subscription. */ fun price(newFloatingTieredWithMinimumPrice: Price.NewFloatingTieredWithMinimumPrice) = price(Price.ofNewFloatingTieredWithMinimumPrice(newFloatingTieredWithMinimumPrice)) @@ -2679,6 +2683,7 @@ constructor( null, private val newFloatingTieredPackagePrice: NewFloatingTieredPackagePrice? = null, private val newFloatingGroupedTieredPrice: NewFloatingGroupedTieredPrice? = null, + private val newFloatingMaxGroupTieredPrice: NewFloatingMaxGroupTieredPrice? = null, private val newFloatingTieredWithMinimumPrice: NewFloatingTieredWithMinimumPrice? = null, private val newFloatingPackageWithAllocationPrice: @@ -2749,6 +2754,9 @@ constructor( fun newFloatingGroupedTieredPrice(): Optional = Optional.ofNullable(newFloatingGroupedTieredPrice) + fun newFloatingMaxGroupTieredPrice(): Optional = + Optional.ofNullable(newFloatingMaxGroupTieredPrice) + fun newFloatingTieredWithMinimumPrice(): Optional = Optional.ofNullable(newFloatingTieredWithMinimumPrice) @@ -2818,6 +2826,8 @@ constructor( fun isNewFloatingGroupedTieredPrice(): Boolean = newFloatingGroupedTieredPrice != null + fun isNewFloatingMaxGroupTieredPrice(): Boolean = newFloatingMaxGroupTieredPrice != null + fun isNewFloatingTieredWithMinimumPrice(): Boolean = newFloatingTieredWithMinimumPrice != null @@ -2894,6 +2904,9 @@ constructor( fun asNewFloatingGroupedTieredPrice(): NewFloatingGroupedTieredPrice = newFloatingGroupedTieredPrice.getOrThrow("newFloatingGroupedTieredPrice") + fun asNewFloatingMaxGroupTieredPrice(): NewFloatingMaxGroupTieredPrice = + newFloatingMaxGroupTieredPrice.getOrThrow("newFloatingMaxGroupTieredPrice") + fun asNewFloatingTieredWithMinimumPrice(): NewFloatingTieredWithMinimumPrice = newFloatingTieredWithMinimumPrice.getOrThrow("newFloatingTieredWithMinimumPrice") @@ -2979,6 +2992,8 @@ constructor( visitor.visitNewFloatingTieredPackagePrice(newFloatingTieredPackagePrice) newFloatingGroupedTieredPrice != null -> visitor.visitNewFloatingGroupedTieredPrice(newFloatingGroupedTieredPrice) + newFloatingMaxGroupTieredPrice != null -> + visitor.visitNewFloatingMaxGroupTieredPrice(newFloatingMaxGroupTieredPrice) newFloatingTieredWithMinimumPrice != null -> visitor.visitNewFloatingTieredWithMinimumPrice( newFloatingTieredWithMinimumPrice @@ -3114,6 +3129,12 @@ constructor( newFloatingGroupedTieredPrice.validate() } + override fun visitNewFloatingMaxGroupTieredPrice( + newFloatingMaxGroupTieredPrice: NewFloatingMaxGroupTieredPrice + ) { + newFloatingMaxGroupTieredPrice.validate() + } + override fun visitNewFloatingTieredWithMinimumPrice( newFloatingTieredWithMinimumPrice: NewFloatingTieredWithMinimumPrice ) { @@ -3201,10 +3222,10 @@ constructor( return true } - return /* spotless:off */ other is Price && newFloatingUnitPrice == other.newFloatingUnitPrice && newFloatingPackagePrice == other.newFloatingPackagePrice && newFloatingMatrixPrice == other.newFloatingMatrixPrice && newFloatingMatrixWithAllocationPrice == other.newFloatingMatrixWithAllocationPrice && newFloatingTieredPrice == other.newFloatingTieredPrice && newFloatingTieredBpsPrice == other.newFloatingTieredBpsPrice && newFloatingBpsPrice == other.newFloatingBpsPrice && newFloatingBulkBpsPrice == other.newFloatingBulkBpsPrice && newFloatingBulkPrice == other.newFloatingBulkPrice && newFloatingThresholdTotalAmountPrice == other.newFloatingThresholdTotalAmountPrice && newFloatingTieredPackagePrice == other.newFloatingTieredPackagePrice && newFloatingGroupedTieredPrice == other.newFloatingGroupedTieredPrice && newFloatingTieredWithMinimumPrice == other.newFloatingTieredWithMinimumPrice && newFloatingPackageWithAllocationPrice == other.newFloatingPackageWithAllocationPrice && newFloatingTieredPackageWithMinimumPrice == other.newFloatingTieredPackageWithMinimumPrice && newFloatingUnitWithPercentPrice == other.newFloatingUnitWithPercentPrice && newFloatingTieredWithProrationPrice == other.newFloatingTieredWithProrationPrice && newFloatingUnitWithProrationPrice == other.newFloatingUnitWithProrationPrice && newFloatingGroupedAllocationPrice == other.newFloatingGroupedAllocationPrice && newFloatingGroupedWithProratedMinimumPrice == other.newFloatingGroupedWithProratedMinimumPrice && newFloatingGroupedWithMeteredMinimumPrice == other.newFloatingGroupedWithMeteredMinimumPrice && newFloatingMatrixWithDisplayNamePrice == other.newFloatingMatrixWithDisplayNamePrice && newFloatingBulkWithProrationPrice == other.newFloatingBulkWithProrationPrice && newFloatingGroupedTieredPackagePrice == other.newFloatingGroupedTieredPackagePrice /* spotless:on */ + return /* spotless:off */ other is Price && newFloatingUnitPrice == other.newFloatingUnitPrice && newFloatingPackagePrice == other.newFloatingPackagePrice && newFloatingMatrixPrice == other.newFloatingMatrixPrice && newFloatingMatrixWithAllocationPrice == other.newFloatingMatrixWithAllocationPrice && newFloatingTieredPrice == other.newFloatingTieredPrice && newFloatingTieredBpsPrice == other.newFloatingTieredBpsPrice && newFloatingBpsPrice == other.newFloatingBpsPrice && newFloatingBulkBpsPrice == other.newFloatingBulkBpsPrice && newFloatingBulkPrice == other.newFloatingBulkPrice && newFloatingThresholdTotalAmountPrice == other.newFloatingThresholdTotalAmountPrice && newFloatingTieredPackagePrice == other.newFloatingTieredPackagePrice && newFloatingGroupedTieredPrice == other.newFloatingGroupedTieredPrice && newFloatingMaxGroupTieredPrice == other.newFloatingMaxGroupTieredPrice && newFloatingTieredWithMinimumPrice == other.newFloatingTieredWithMinimumPrice && newFloatingPackageWithAllocationPrice == other.newFloatingPackageWithAllocationPrice && newFloatingTieredPackageWithMinimumPrice == other.newFloatingTieredPackageWithMinimumPrice && newFloatingUnitWithPercentPrice == other.newFloatingUnitWithPercentPrice && newFloatingTieredWithProrationPrice == other.newFloatingTieredWithProrationPrice && newFloatingUnitWithProrationPrice == other.newFloatingUnitWithProrationPrice && newFloatingGroupedAllocationPrice == other.newFloatingGroupedAllocationPrice && newFloatingGroupedWithProratedMinimumPrice == other.newFloatingGroupedWithProratedMinimumPrice && newFloatingGroupedWithMeteredMinimumPrice == other.newFloatingGroupedWithMeteredMinimumPrice && newFloatingMatrixWithDisplayNamePrice == other.newFloatingMatrixWithDisplayNamePrice && newFloatingBulkWithProrationPrice == other.newFloatingBulkWithProrationPrice && newFloatingGroupedTieredPackagePrice == other.newFloatingGroupedTieredPackagePrice /* spotless:on */ } - override fun hashCode(): Int = /* spotless:off */ Objects.hash(newFloatingUnitPrice, newFloatingPackagePrice, newFloatingMatrixPrice, newFloatingMatrixWithAllocationPrice, newFloatingTieredPrice, newFloatingTieredBpsPrice, newFloatingBpsPrice, newFloatingBulkBpsPrice, newFloatingBulkPrice, newFloatingThresholdTotalAmountPrice, newFloatingTieredPackagePrice, newFloatingGroupedTieredPrice, newFloatingTieredWithMinimumPrice, newFloatingPackageWithAllocationPrice, newFloatingTieredPackageWithMinimumPrice, newFloatingUnitWithPercentPrice, newFloatingTieredWithProrationPrice, newFloatingUnitWithProrationPrice, newFloatingGroupedAllocationPrice, newFloatingGroupedWithProratedMinimumPrice, newFloatingGroupedWithMeteredMinimumPrice, newFloatingMatrixWithDisplayNamePrice, newFloatingBulkWithProrationPrice, newFloatingGroupedTieredPackagePrice) /* spotless:on */ + override fun hashCode(): Int = /* spotless:off */ Objects.hash(newFloatingUnitPrice, newFloatingPackagePrice, newFloatingMatrixPrice, newFloatingMatrixWithAllocationPrice, newFloatingTieredPrice, newFloatingTieredBpsPrice, newFloatingBpsPrice, newFloatingBulkBpsPrice, newFloatingBulkPrice, newFloatingThresholdTotalAmountPrice, newFloatingTieredPackagePrice, newFloatingGroupedTieredPrice, newFloatingMaxGroupTieredPrice, newFloatingTieredWithMinimumPrice, newFloatingPackageWithAllocationPrice, newFloatingTieredPackageWithMinimumPrice, newFloatingUnitWithPercentPrice, newFloatingTieredWithProrationPrice, newFloatingUnitWithProrationPrice, newFloatingGroupedAllocationPrice, newFloatingGroupedWithProratedMinimumPrice, newFloatingGroupedWithMeteredMinimumPrice, newFloatingMatrixWithDisplayNamePrice, newFloatingBulkWithProrationPrice, newFloatingGroupedTieredPackagePrice) /* spotless:on */ override fun toString(): String = when { @@ -3231,6 +3252,8 @@ constructor( "Price{newFloatingTieredPackagePrice=$newFloatingTieredPackagePrice}" newFloatingGroupedTieredPrice != null -> "Price{newFloatingGroupedTieredPrice=$newFloatingGroupedTieredPrice}" + newFloatingMaxGroupTieredPrice != null -> + "Price{newFloatingMaxGroupTieredPrice=$newFloatingMaxGroupTieredPrice}" newFloatingTieredWithMinimumPrice != null -> "Price{newFloatingTieredWithMinimumPrice=$newFloatingTieredWithMinimumPrice}" newFloatingPackageWithAllocationPrice != null -> @@ -3320,6 +3343,11 @@ constructor( newFloatingGroupedTieredPrice: NewFloatingGroupedTieredPrice ) = Price(newFloatingGroupedTieredPrice = newFloatingGroupedTieredPrice) + @JvmStatic + fun ofNewFloatingMaxGroupTieredPrice( + newFloatingMaxGroupTieredPrice: NewFloatingMaxGroupTieredPrice + ) = Price(newFloatingMaxGroupTieredPrice = newFloatingMaxGroupTieredPrice) + @JvmStatic fun ofNewFloatingTieredWithMinimumPrice( newFloatingTieredWithMinimumPrice: NewFloatingTieredWithMinimumPrice @@ -3447,6 +3475,10 @@ constructor( newFloatingGroupedTieredPrice: NewFloatingGroupedTieredPrice ): T + fun visitNewFloatingMaxGroupTieredPrice( + newFloatingMaxGroupTieredPrice: NewFloatingMaxGroupTieredPrice + ): T + fun visitNewFloatingTieredWithMinimumPrice( newFloatingTieredWithMinimumPrice: NewFloatingTieredWithMinimumPrice ): T @@ -3619,6 +3651,14 @@ constructor( return Price(newFloatingGroupedTieredPrice = it, _json = json) } } + "max_group_tiered" -> { + tryDeserialize(node, jacksonTypeRef()) { + it.validate() + } + ?.let { + return Price(newFloatingMaxGroupTieredPrice = it, _json = json) + } + } "tiered_with_minimum" -> { tryDeserialize( node, @@ -3822,6 +3862,8 @@ constructor( generator.writeObject(value.newFloatingTieredPackagePrice) value.newFloatingGroupedTieredPrice != null -> generator.writeObject(value.newFloatingGroupedTieredPrice) + value.newFloatingMaxGroupTieredPrice != null -> + generator.writeObject(value.newFloatingMaxGroupTieredPrice) value.newFloatingTieredWithMinimumPrice != null -> generator.writeObject(value.newFloatingTieredWithMinimumPrice) value.newFloatingPackageWithAllocationPrice != null -> @@ -21082,6 +21124,1310 @@ constructor( "NewFloatingGroupedTieredPrice{cadence=$cadence, currency=$currency, groupedTieredConfig=$groupedTieredConfig, itemId=$itemId, modelType=$modelType, name=$name, billableMetricId=$billableMetricId, billedInAdvance=$billedInAdvance, billingCycleConfiguration=$billingCycleConfiguration, conversionRate=$conversionRate, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, invoicingCycleConfiguration=$invoicingCycleConfiguration, metadata=$metadata, additionalProperties=$additionalProperties}" } + @NoAutoDetect + class NewFloatingMaxGroupTieredPrice + @JsonCreator + private constructor( + @JsonProperty("cadence") + @ExcludeMissing + private val cadence: JsonField = JsonMissing.of(), + @JsonProperty("currency") + @ExcludeMissing + private val currency: JsonField = JsonMissing.of(), + @JsonProperty("item_id") + @ExcludeMissing + private val itemId: JsonField = JsonMissing.of(), + @JsonProperty("max_group_tiered_config") + @ExcludeMissing + private val maxGroupTieredConfig: JsonField = + JsonMissing.of(), + @JsonProperty("model_type") + @ExcludeMissing + private val modelType: JsonField = JsonMissing.of(), + @JsonProperty("name") + @ExcludeMissing + private val name: JsonField = JsonMissing.of(), + @JsonProperty("billable_metric_id") + @ExcludeMissing + private val billableMetricId: JsonField = JsonMissing.of(), + @JsonProperty("billed_in_advance") + @ExcludeMissing + private val billedInAdvance: JsonField = JsonMissing.of(), + @JsonProperty("billing_cycle_configuration") + @ExcludeMissing + private val billingCycleConfiguration: JsonField = + JsonMissing.of(), + @JsonProperty("conversion_rate") + @ExcludeMissing + private val conversionRate: JsonField = JsonMissing.of(), + @JsonProperty("external_price_id") + @ExcludeMissing + private val externalPriceId: JsonField = JsonMissing.of(), + @JsonProperty("fixed_price_quantity") + @ExcludeMissing + private val fixedPriceQuantity: JsonField = JsonMissing.of(), + @JsonProperty("invoice_grouping_key") + @ExcludeMissing + private val invoiceGroupingKey: JsonField = JsonMissing.of(), + @JsonProperty("invoicing_cycle_configuration") + @ExcludeMissing + private val invoicingCycleConfiguration: JsonField = + JsonMissing.of(), + @JsonProperty("metadata") + @ExcludeMissing + private val metadata: JsonField = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), + ) { + + /** The cadence to bill for this price on. */ + fun cadence(): Cadence = cadence.getRequired("cadence") + + /** An ISO 4217 currency string for which this price is billed in. */ + fun currency(): String = currency.getRequired("currency") + + /** The id of the item the plan will be associated with. */ + fun itemId(): String = itemId.getRequired("item_id") + + fun maxGroupTieredConfig(): MaxGroupTieredConfig = + maxGroupTieredConfig.getRequired("max_group_tiered_config") + + fun modelType(): ModelType = modelType.getRequired("model_type") + + /** The name of the price. */ + fun name(): String = name.getRequired("name") + + /** + * The id of the billable metric for the price. Only needed if the price is + * usage-based. + */ + fun billableMetricId(): Optional = + Optional.ofNullable(billableMetricId.getNullable("billable_metric_id")) + + /** + * If the Price represents a fixed cost, the price will be billed in-advance if this + * is true, and in-arrears if this is false. + */ + fun billedInAdvance(): Optional = + Optional.ofNullable(billedInAdvance.getNullable("billed_in_advance")) + + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + fun billingCycleConfiguration(): Optional = + Optional.ofNullable( + billingCycleConfiguration.getNullable("billing_cycle_configuration") + ) + + /** The per unit conversion rate of the price currency to the invoicing currency. */ + fun conversionRate(): Optional = + Optional.ofNullable(conversionRate.getNullable("conversion_rate")) + + /** An alias for the price. */ + fun externalPriceId(): Optional = + Optional.ofNullable(externalPriceId.getNullable("external_price_id")) + + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + fun fixedPriceQuantity(): Optional = + Optional.ofNullable(fixedPriceQuantity.getNullable("fixed_price_quantity")) + + /** The property used to group this price on an invoice */ + fun invoiceGroupingKey(): Optional = + Optional.ofNullable(invoiceGroupingKey.getNullable("invoice_grouping_key")) + + /** + * Within each billing cycle, specifies the cadence at which invoices are produced. + * If unspecified, a single invoice is produced per billing cycle. + */ + fun invoicingCycleConfiguration(): Optional = + Optional.ofNullable( + invoicingCycleConfiguration.getNullable("invoicing_cycle_configuration") + ) + + /** + * User-specified key/value pairs for the resource. Individual keys can be removed + * by setting the value to `null`, and the entire metadata mapping can be cleared by + * setting `metadata` to `null`. + */ + fun metadata(): Optional = + Optional.ofNullable(metadata.getNullable("metadata")) + + /** The cadence to bill for this price on. */ + @JsonProperty("cadence") + @ExcludeMissing + fun _cadence(): JsonField = cadence + + /** An ISO 4217 currency string for which this price is billed in. */ + @JsonProperty("currency") + @ExcludeMissing + fun _currency(): JsonField = currency + + /** The id of the item the plan will be associated with. */ + @JsonProperty("item_id") @ExcludeMissing fun _itemId(): JsonField = itemId + + @JsonProperty("max_group_tiered_config") + @ExcludeMissing + fun _maxGroupTieredConfig(): JsonField = maxGroupTieredConfig + + @JsonProperty("model_type") + @ExcludeMissing + fun _modelType(): JsonField = modelType + + /** The name of the price. */ + @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name + + /** + * The id of the billable metric for the price. Only needed if the price is + * usage-based. + */ + @JsonProperty("billable_metric_id") + @ExcludeMissing + fun _billableMetricId(): JsonField = billableMetricId + + /** + * If the Price represents a fixed cost, the price will be billed in-advance if this + * is true, and in-arrears if this is false. + */ + @JsonProperty("billed_in_advance") + @ExcludeMissing + fun _billedInAdvance(): JsonField = billedInAdvance + + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + @JsonProperty("billing_cycle_configuration") + @ExcludeMissing + fun _billingCycleConfiguration(): JsonField = + billingCycleConfiguration + + /** The per unit conversion rate of the price currency to the invoicing currency. */ + @JsonProperty("conversion_rate") + @ExcludeMissing + fun _conversionRate(): JsonField = conversionRate + + /** An alias for the price. */ + @JsonProperty("external_price_id") + @ExcludeMissing + fun _externalPriceId(): JsonField = externalPriceId + + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + @JsonProperty("fixed_price_quantity") + @ExcludeMissing + fun _fixedPriceQuantity(): JsonField = fixedPriceQuantity + + /** The property used to group this price on an invoice */ + @JsonProperty("invoice_grouping_key") + @ExcludeMissing + fun _invoiceGroupingKey(): JsonField = invoiceGroupingKey + + /** + * Within each billing cycle, specifies the cadence at which invoices are produced. + * If unspecified, a single invoice is produced per billing cycle. + */ + @JsonProperty("invoicing_cycle_configuration") + @ExcludeMissing + fun _invoicingCycleConfiguration(): JsonField = + invoicingCycleConfiguration + + /** + * User-specified key/value pairs for the resource. Individual keys can be removed + * by setting the value to `null`, and the entire metadata mapping can be cleared by + * setting `metadata` to `null`. + */ + @JsonProperty("metadata") + @ExcludeMissing + fun _metadata(): JsonField = metadata + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + private var validated: Boolean = false + + fun validate(): NewFloatingMaxGroupTieredPrice = apply { + if (validated) { + return@apply + } + + cadence() + currency() + itemId() + maxGroupTieredConfig().validate() + modelType() + name() + billableMetricId() + billedInAdvance() + billingCycleConfiguration().ifPresent { it.validate() } + conversionRate() + externalPriceId() + fixedPriceQuantity() + invoiceGroupingKey() + invoicingCycleConfiguration().ifPresent { it.validate() } + metadata().ifPresent { it.validate() } + validated = true + } + + fun toBuilder() = Builder().from(this) + + companion object { + + @JvmStatic fun builder() = Builder() + } + + class Builder { + + private var cadence: JsonField? = null + private var currency: JsonField? = null + private var itemId: JsonField? = null + private var maxGroupTieredConfig: JsonField? = null + private var modelType: JsonField? = null + private var name: JsonField? = null + private var billableMetricId: JsonField = JsonMissing.of() + private var billedInAdvance: JsonField = JsonMissing.of() + private var billingCycleConfiguration: JsonField = + JsonMissing.of() + private var conversionRate: JsonField = JsonMissing.of() + private var externalPriceId: JsonField = JsonMissing.of() + private var fixedPriceQuantity: JsonField = JsonMissing.of() + private var invoiceGroupingKey: JsonField = JsonMissing.of() + private var invoicingCycleConfiguration: + JsonField = + JsonMissing.of() + private var metadata: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from( + newFloatingMaxGroupTieredPrice: NewFloatingMaxGroupTieredPrice + ) = apply { + cadence = newFloatingMaxGroupTieredPrice.cadence + currency = newFloatingMaxGroupTieredPrice.currency + itemId = newFloatingMaxGroupTieredPrice.itemId + maxGroupTieredConfig = newFloatingMaxGroupTieredPrice.maxGroupTieredConfig + modelType = newFloatingMaxGroupTieredPrice.modelType + name = newFloatingMaxGroupTieredPrice.name + billableMetricId = newFloatingMaxGroupTieredPrice.billableMetricId + billedInAdvance = newFloatingMaxGroupTieredPrice.billedInAdvance + billingCycleConfiguration = + newFloatingMaxGroupTieredPrice.billingCycleConfiguration + conversionRate = newFloatingMaxGroupTieredPrice.conversionRate + externalPriceId = newFloatingMaxGroupTieredPrice.externalPriceId + fixedPriceQuantity = newFloatingMaxGroupTieredPrice.fixedPriceQuantity + invoiceGroupingKey = newFloatingMaxGroupTieredPrice.invoiceGroupingKey + invoicingCycleConfiguration = + newFloatingMaxGroupTieredPrice.invoicingCycleConfiguration + metadata = newFloatingMaxGroupTieredPrice.metadata + additionalProperties = + newFloatingMaxGroupTieredPrice.additionalProperties.toMutableMap() + } + + /** The cadence to bill for this price on. */ + fun cadence(cadence: Cadence) = cadence(JsonField.of(cadence)) + + /** The cadence to bill for this price on. */ + fun cadence(cadence: JsonField) = apply { this.cadence = cadence } + + /** An ISO 4217 currency string for which this price is billed in. */ + fun currency(currency: String) = currency(JsonField.of(currency)) + + /** An ISO 4217 currency string for which this price is billed in. */ + fun currency(currency: JsonField) = apply { this.currency = currency } + + /** The id of the item the plan will be associated with. */ + fun itemId(itemId: String) = itemId(JsonField.of(itemId)) + + /** The id of the item the plan will be associated with. */ + fun itemId(itemId: JsonField) = apply { this.itemId = itemId } + + fun maxGroupTieredConfig(maxGroupTieredConfig: MaxGroupTieredConfig) = + maxGroupTieredConfig(JsonField.of(maxGroupTieredConfig)) + + fun maxGroupTieredConfig( + maxGroupTieredConfig: JsonField + ) = apply { this.maxGroupTieredConfig = maxGroupTieredConfig } + + fun modelType(modelType: ModelType) = modelType(JsonField.of(modelType)) + + fun modelType(modelType: JsonField) = apply { + this.modelType = modelType + } + + /** The name of the price. */ + fun name(name: String) = name(JsonField.of(name)) + + /** The name of the price. */ + fun name(name: JsonField) = apply { this.name = name } + + /** + * The id of the billable metric for the price. Only needed if the price is + * usage-based. + */ + fun billableMetricId(billableMetricId: String?) = + billableMetricId(JsonField.ofNullable(billableMetricId)) + + /** + * The id of the billable metric for the price. Only needed if the price is + * usage-based. + */ + fun billableMetricId(billableMetricId: Optional) = + billableMetricId(billableMetricId.orElse(null)) + + /** + * The id of the billable metric for the price. Only needed if the price is + * usage-based. + */ + fun billableMetricId(billableMetricId: JsonField) = apply { + this.billableMetricId = billableMetricId + } + + /** + * If the Price represents a fixed cost, the price will be billed in-advance if + * this is true, and in-arrears if this is false. + */ + fun billedInAdvance(billedInAdvance: Boolean?) = + billedInAdvance(JsonField.ofNullable(billedInAdvance)) + + /** + * If the Price represents a fixed cost, the price will be billed in-advance if + * this is true, and in-arrears if this is false. + */ + fun billedInAdvance(billedInAdvance: Boolean) = + billedInAdvance(billedInAdvance as Boolean?) + + /** + * If the Price represents a fixed cost, the price will be billed in-advance if + * this is true, and in-arrears if this is false. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun billedInAdvance(billedInAdvance: Optional) = + billedInAdvance(billedInAdvance.orElse(null) as Boolean?) + + /** + * If the Price represents a fixed cost, the price will be billed in-advance if + * this is true, and in-arrears if this is false. + */ + fun billedInAdvance(billedInAdvance: JsonField) = apply { + this.billedInAdvance = billedInAdvance + } + + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + fun billingCycleConfiguration( + billingCycleConfiguration: BillingCycleConfiguration? + ) = billingCycleConfiguration(JsonField.ofNullable(billingCycleConfiguration)) + + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + fun billingCycleConfiguration( + billingCycleConfiguration: Optional + ) = billingCycleConfiguration(billingCycleConfiguration.orElse(null)) + + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + fun billingCycleConfiguration( + billingCycleConfiguration: JsonField + ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } + + /** + * The per unit conversion rate of the price currency to the invoicing currency. + */ + fun conversionRate(conversionRate: Double?) = + conversionRate(JsonField.ofNullable(conversionRate)) + + /** + * The per unit conversion rate of the price currency to the invoicing currency. + */ + fun conversionRate(conversionRate: Double) = + conversionRate(conversionRate as Double?) + + /** + * The per unit conversion rate of the price currency to the invoicing currency. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun conversionRate(conversionRate: Optional) = + conversionRate(conversionRate.orElse(null) as Double?) + + /** + * The per unit conversion rate of the price currency to the invoicing currency. + */ + fun conversionRate(conversionRate: JsonField) = apply { + this.conversionRate = conversionRate + } + + /** An alias for the price. */ + fun externalPriceId(externalPriceId: String?) = + externalPriceId(JsonField.ofNullable(externalPriceId)) + + /** An alias for the price. */ + fun externalPriceId(externalPriceId: Optional) = + externalPriceId(externalPriceId.orElse(null)) + + /** An alias for the price. */ + fun externalPriceId(externalPriceId: JsonField) = apply { + this.externalPriceId = externalPriceId + } + + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + fun fixedPriceQuantity(fixedPriceQuantity: Double?) = + fixedPriceQuantity(JsonField.ofNullable(fixedPriceQuantity)) + + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + fun fixedPriceQuantity(fixedPriceQuantity: Double) = + fixedPriceQuantity(fixedPriceQuantity as Double?) + + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun fixedPriceQuantity(fixedPriceQuantity: Optional) = + fixedPriceQuantity(fixedPriceQuantity.orElse(null) as Double?) + + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + fun fixedPriceQuantity(fixedPriceQuantity: JsonField) = apply { + this.fixedPriceQuantity = fixedPriceQuantity + } + + /** The property used to group this price on an invoice */ + fun invoiceGroupingKey(invoiceGroupingKey: String?) = + invoiceGroupingKey(JsonField.ofNullable(invoiceGroupingKey)) + + /** The property used to group this price on an invoice */ + fun invoiceGroupingKey(invoiceGroupingKey: Optional) = + invoiceGroupingKey(invoiceGroupingKey.orElse(null)) + + /** The property used to group this price on an invoice */ + fun invoiceGroupingKey(invoiceGroupingKey: JsonField) = apply { + this.invoiceGroupingKey = invoiceGroupingKey + } + + /** + * Within each billing cycle, specifies the cadence at which invoices are + * produced. If unspecified, a single invoice is produced per billing cycle. + */ + fun invoicingCycleConfiguration( + invoicingCycleConfiguration: InvoicingCycleConfiguration? + ) = + invoicingCycleConfiguration( + JsonField.ofNullable(invoicingCycleConfiguration) + ) + + /** + * Within each billing cycle, specifies the cadence at which invoices are + * produced. If unspecified, a single invoice is produced per billing cycle. + */ + fun invoicingCycleConfiguration( + invoicingCycleConfiguration: Optional + ) = invoicingCycleConfiguration(invoicingCycleConfiguration.orElse(null)) + + /** + * Within each billing cycle, specifies the cadence at which invoices are + * produced. If unspecified, a single invoice is produced per billing cycle. + */ + fun invoicingCycleConfiguration( + invoicingCycleConfiguration: JsonField + ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } + + /** + * User-specified key/value pairs for the resource. Individual keys can be + * removed by setting the value to `null`, and the entire metadata mapping can + * be cleared by setting `metadata` to `null`. + */ + fun metadata(metadata: Metadata?) = metadata(JsonField.ofNullable(metadata)) + + /** + * User-specified key/value pairs for the resource. Individual keys can be + * removed by setting the value to `null`, and the entire metadata mapping can + * be cleared by setting `metadata` to `null`. + */ + fun metadata(metadata: Optional) = metadata(metadata.orElse(null)) + + /** + * User-specified key/value pairs for the resource. Individual keys can be + * removed by setting the value to `null`, and the entire metadata mapping can + * be cleared by setting `metadata` to `null`. + */ + fun metadata(metadata: JsonField) = apply { this.metadata = metadata } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + fun build(): NewFloatingMaxGroupTieredPrice = + NewFloatingMaxGroupTieredPrice( + checkRequired("cadence", cadence), + checkRequired("currency", currency), + checkRequired("itemId", itemId), + checkRequired("maxGroupTieredConfig", maxGroupTieredConfig), + checkRequired("modelType", modelType), + checkRequired("name", name), + billableMetricId, + billedInAdvance, + billingCycleConfiguration, + conversionRate, + externalPriceId, + fixedPriceQuantity, + invoiceGroupingKey, + invoicingCycleConfiguration, + metadata, + additionalProperties.toImmutable(), + ) + } + + class Cadence + @JsonCreator + private constructor( + private val value: JsonField, + ) : Enum { + + @com.fasterxml.jackson.annotation.JsonValue + fun _value(): JsonField = value + + companion object { + + @JvmField val ANNUAL = of("annual") + + @JvmField val SEMI_ANNUAL = of("semi_annual") + + @JvmField val MONTHLY = of("monthly") + + @JvmField val QUARTERLY = of("quarterly") + + @JvmField val ONE_TIME = of("one_time") + + @JvmField val CUSTOM = of("custom") + + @JvmStatic fun of(value: String) = Cadence(JsonField.of(value)) + } + + enum class Known { + ANNUAL, + SEMI_ANNUAL, + MONTHLY, + QUARTERLY, + ONE_TIME, + CUSTOM, + } + + enum class Value { + ANNUAL, + SEMI_ANNUAL, + MONTHLY, + QUARTERLY, + ONE_TIME, + CUSTOM, + _UNKNOWN, + } + + fun value(): Value = + when (this) { + ANNUAL -> Value.ANNUAL + SEMI_ANNUAL -> Value.SEMI_ANNUAL + MONTHLY -> Value.MONTHLY + QUARTERLY -> Value.QUARTERLY + ONE_TIME -> Value.ONE_TIME + CUSTOM -> Value.CUSTOM + else -> Value._UNKNOWN + } + + fun known(): Known = + when (this) { + ANNUAL -> Known.ANNUAL + SEMI_ANNUAL -> Known.SEMI_ANNUAL + MONTHLY -> Known.MONTHLY + QUARTERLY -> Known.QUARTERLY + ONE_TIME -> Known.ONE_TIME + CUSTOM -> Known.CUSTOM + else -> throw OrbInvalidDataException("Unknown Cadence: $value") + } + + fun asString(): String = _value().asStringOrThrow() + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is Cadence && value == other.value /* spotless:on */ + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + + @NoAutoDetect + class MaxGroupTieredConfig + @JsonCreator + private constructor( + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), + ) { + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + private var validated: Boolean = false + + fun validate(): MaxGroupTieredConfig = apply { + if (validated) { + return@apply + } + + validated = true + } + + fun toBuilder() = Builder().from(this) + + companion object { + + @JvmStatic fun builder() = Builder() + } + + class Builder { + + private var additionalProperties: MutableMap = + mutableMapOf() + + @JvmSynthetic + internal fun from(maxGroupTieredConfig: MaxGroupTieredConfig) = apply { + additionalProperties = + maxGroupTieredConfig.additionalProperties.toMutableMap() + } + + fun additionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties( + additionalProperties: Map + ) = apply { this.additionalProperties.putAll(additionalProperties) } + + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + fun build(): MaxGroupTieredConfig = + MaxGroupTieredConfig(additionalProperties.toImmutable()) + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is MaxGroupTieredConfig && additionalProperties == other.additionalProperties /* spotless:on */ + } + + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(additionalProperties) } + /* spotless:on */ + + override fun hashCode(): Int = hashCode + + override fun toString() = + "MaxGroupTieredConfig{additionalProperties=$additionalProperties}" + } + + class ModelType + @JsonCreator + private constructor( + private val value: JsonField, + ) : Enum { + + @com.fasterxml.jackson.annotation.JsonValue + fun _value(): JsonField = value + + companion object { + + @JvmField val MAX_GROUP_TIERED = of("max_group_tiered") + + @JvmStatic fun of(value: String) = ModelType(JsonField.of(value)) + } + + enum class Known { + MAX_GROUP_TIERED, + } + + enum class Value { + MAX_GROUP_TIERED, + _UNKNOWN, + } + + fun value(): Value = + when (this) { + MAX_GROUP_TIERED -> Value.MAX_GROUP_TIERED + else -> Value._UNKNOWN + } + + fun known(): Known = + when (this) { + MAX_GROUP_TIERED -> Known.MAX_GROUP_TIERED + else -> throw OrbInvalidDataException("Unknown ModelType: $value") + } + + fun asString(): String = _value().asStringOrThrow() + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is ModelType && value == other.value /* spotless:on */ + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + @NoAutoDetect + class BillingCycleConfiguration + @JsonCreator + private constructor( + @JsonProperty("duration") + @ExcludeMissing + private val duration: JsonField = JsonMissing.of(), + @JsonProperty("duration_unit") + @ExcludeMissing + private val durationUnit: JsonField = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), + ) { + + /** The duration of the billing period. */ + fun duration(): Long = duration.getRequired("duration") + + /** The unit of billing period duration. */ + fun durationUnit(): DurationUnit = durationUnit.getRequired("duration_unit") + + /** The duration of the billing period. */ + @JsonProperty("duration") + @ExcludeMissing + fun _duration(): JsonField = duration + + /** The unit of billing period duration. */ + @JsonProperty("duration_unit") + @ExcludeMissing + fun _durationUnit(): JsonField = durationUnit + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + private var validated: Boolean = false + + fun validate(): BillingCycleConfiguration = apply { + if (validated) { + return@apply + } + + duration() + durationUnit() + validated = true + } + + fun toBuilder() = Builder().from(this) + + companion object { + + @JvmStatic fun builder() = Builder() + } + + class Builder { + + private var duration: JsonField? = null + private var durationUnit: JsonField? = null + private var additionalProperties: MutableMap = + mutableMapOf() + + @JvmSynthetic + internal fun from(billingCycleConfiguration: BillingCycleConfiguration) = + apply { + duration = billingCycleConfiguration.duration + durationUnit = billingCycleConfiguration.durationUnit + additionalProperties = + billingCycleConfiguration.additionalProperties.toMutableMap() + } + + /** The duration of the billing period. */ + fun duration(duration: Long) = duration(JsonField.of(duration)) + + /** The duration of the billing period. */ + fun duration(duration: JsonField) = apply { this.duration = duration } + + /** The unit of billing period duration. */ + fun durationUnit(durationUnit: DurationUnit) = + durationUnit(JsonField.of(durationUnit)) + + /** The unit of billing period duration. */ + fun durationUnit(durationUnit: JsonField) = apply { + this.durationUnit = durationUnit + } + + fun additionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties( + additionalProperties: Map + ) = apply { this.additionalProperties.putAll(additionalProperties) } + + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + fun build(): BillingCycleConfiguration = + BillingCycleConfiguration( + checkRequired("duration", duration), + checkRequired("durationUnit", durationUnit), + additionalProperties.toImmutable(), + ) + } + + class DurationUnit + @JsonCreator + private constructor( + private val value: JsonField, + ) : Enum { + + @com.fasterxml.jackson.annotation.JsonValue + fun _value(): JsonField = value + + companion object { + + @JvmField val DAY = of("day") + + @JvmField val MONTH = of("month") + + @JvmStatic fun of(value: String) = DurationUnit(JsonField.of(value)) + } + + enum class Known { + DAY, + MONTH, + } + + enum class Value { + DAY, + MONTH, + _UNKNOWN, + } + + fun value(): Value = + when (this) { + DAY -> Value.DAY + MONTH -> Value.MONTH + else -> Value._UNKNOWN + } + + fun known(): Known = + when (this) { + DAY -> Known.DAY + MONTH -> Known.MONTH + else -> + throw OrbInvalidDataException("Unknown DurationUnit: $value") + } + + fun asString(): String = _value().asStringOrThrow() + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is DurationUnit && value == other.value /* spotless:on */ + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is BillingCycleConfiguration && duration == other.duration && durationUnit == other.durationUnit && additionalProperties == other.additionalProperties /* spotless:on */ + } + + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(duration, durationUnit, additionalProperties) } + /* spotless:on */ + + override fun hashCode(): Int = hashCode + + override fun toString() = + "BillingCycleConfiguration{duration=$duration, durationUnit=$durationUnit, additionalProperties=$additionalProperties}" + } + + /** + * Within each billing cycle, specifies the cadence at which invoices are produced. + * If unspecified, a single invoice is produced per billing cycle. + */ + @NoAutoDetect + class InvoicingCycleConfiguration + @JsonCreator + private constructor( + @JsonProperty("duration") + @ExcludeMissing + private val duration: JsonField = JsonMissing.of(), + @JsonProperty("duration_unit") + @ExcludeMissing + private val durationUnit: JsonField = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), + ) { + + /** The duration of the billing period. */ + fun duration(): Long = duration.getRequired("duration") + + /** The unit of billing period duration. */ + fun durationUnit(): DurationUnit = durationUnit.getRequired("duration_unit") + + /** The duration of the billing period. */ + @JsonProperty("duration") + @ExcludeMissing + fun _duration(): JsonField = duration + + /** The unit of billing period duration. */ + @JsonProperty("duration_unit") + @ExcludeMissing + fun _durationUnit(): JsonField = durationUnit + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + private var validated: Boolean = false + + fun validate(): InvoicingCycleConfiguration = apply { + if (validated) { + return@apply + } + + duration() + durationUnit() + validated = true + } + + fun toBuilder() = Builder().from(this) + + companion object { + + @JvmStatic fun builder() = Builder() + } + + class Builder { + + private var duration: JsonField? = null + private var durationUnit: JsonField? = null + private var additionalProperties: MutableMap = + mutableMapOf() + + @JvmSynthetic + internal fun from( + invoicingCycleConfiguration: InvoicingCycleConfiguration + ) = apply { + duration = invoicingCycleConfiguration.duration + durationUnit = invoicingCycleConfiguration.durationUnit + additionalProperties = + invoicingCycleConfiguration.additionalProperties.toMutableMap() + } + + /** The duration of the billing period. */ + fun duration(duration: Long) = duration(JsonField.of(duration)) + + /** The duration of the billing period. */ + fun duration(duration: JsonField) = apply { this.duration = duration } + + /** The unit of billing period duration. */ + fun durationUnit(durationUnit: DurationUnit) = + durationUnit(JsonField.of(durationUnit)) + + /** The unit of billing period duration. */ + fun durationUnit(durationUnit: JsonField) = apply { + this.durationUnit = durationUnit + } + + fun additionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties( + additionalProperties: Map + ) = apply { this.additionalProperties.putAll(additionalProperties) } + + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + fun build(): InvoicingCycleConfiguration = + InvoicingCycleConfiguration( + checkRequired("duration", duration), + checkRequired("durationUnit", durationUnit), + additionalProperties.toImmutable(), + ) + } + + class DurationUnit + @JsonCreator + private constructor( + private val value: JsonField, + ) : Enum { + + @com.fasterxml.jackson.annotation.JsonValue + fun _value(): JsonField = value + + companion object { + + @JvmField val DAY = of("day") + + @JvmField val MONTH = of("month") + + @JvmStatic fun of(value: String) = DurationUnit(JsonField.of(value)) + } + + enum class Known { + DAY, + MONTH, + } + + enum class Value { + DAY, + MONTH, + _UNKNOWN, + } + + fun value(): Value = + when (this) { + DAY -> Value.DAY + MONTH -> Value.MONTH + else -> Value._UNKNOWN + } + + fun known(): Known = + when (this) { + DAY -> Known.DAY + MONTH -> Known.MONTH + else -> + throw OrbInvalidDataException("Unknown DurationUnit: $value") + } + + fun asString(): String = _value().asStringOrThrow() + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is DurationUnit && value == other.value /* spotless:on */ + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is InvoicingCycleConfiguration && duration == other.duration && durationUnit == other.durationUnit && additionalProperties == other.additionalProperties /* spotless:on */ + } + + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(duration, durationUnit, additionalProperties) } + /* spotless:on */ + + override fun hashCode(): Int = hashCode + + override fun toString() = + "InvoicingCycleConfiguration{duration=$duration, durationUnit=$durationUnit, additionalProperties=$additionalProperties}" + } + + /** + * User-specified key/value pairs for the resource. Individual keys can be removed + * by setting the value to `null`, and the entire metadata mapping can be cleared by + * setting `metadata` to `null`. + */ + @NoAutoDetect + class Metadata + @JsonCreator + private constructor( + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), + ) { + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + private var validated: Boolean = false + + fun validate(): Metadata = apply { + if (validated) { + return@apply + } + + validated = true + } + + fun toBuilder() = Builder().from(this) + + companion object { + + @JvmStatic fun builder() = Builder() + } + + class Builder { + + private var additionalProperties: MutableMap = + mutableMapOf() + + @JvmSynthetic + internal fun from(metadata: Metadata) = apply { + additionalProperties = metadata.additionalProperties.toMutableMap() + } + + fun additionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties( + additionalProperties: Map + ) = apply { this.additionalProperties.putAll(additionalProperties) } + + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + fun build(): Metadata = Metadata(additionalProperties.toImmutable()) + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is Metadata && additionalProperties == other.additionalProperties /* spotless:on */ + } + + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(additionalProperties) } + /* spotless:on */ + + override fun hashCode(): Int = hashCode + + override fun toString() = "Metadata{additionalProperties=$additionalProperties}" + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is NewFloatingMaxGroupTieredPrice && cadence == other.cadence && currency == other.currency && itemId == other.itemId && maxGroupTieredConfig == other.maxGroupTieredConfig && modelType == other.modelType && name == other.name && billableMetricId == other.billableMetricId && billedInAdvance == other.billedInAdvance && billingCycleConfiguration == other.billingCycleConfiguration && conversionRate == other.conversionRate && externalPriceId == other.externalPriceId && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && invoicingCycleConfiguration == other.invoicingCycleConfiguration && metadata == other.metadata && additionalProperties == other.additionalProperties /* spotless:on */ + } + + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(cadence, currency, itemId, maxGroupTieredConfig, modelType, name, billableMetricId, billedInAdvance, billingCycleConfiguration, conversionRate, externalPriceId, fixedPriceQuantity, invoiceGroupingKey, invoicingCycleConfiguration, metadata, additionalProperties) } + /* spotless:on */ + + override fun hashCode(): Int = hashCode + + override fun toString() = + "NewFloatingMaxGroupTieredPrice{cadence=$cadence, currency=$currency, itemId=$itemId, maxGroupTieredConfig=$maxGroupTieredConfig, modelType=$modelType, name=$name, billableMetricId=$billableMetricId, billedInAdvance=$billedInAdvance, billingCycleConfiguration=$billingCycleConfiguration, conversionRate=$conversionRate, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, invoicingCycleConfiguration=$invoicingCycleConfiguration, metadata=$metadata, additionalProperties=$additionalProperties}" + } + @NoAutoDetect class NewFloatingTieredWithMinimumPrice @JsonCreator diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionPriceIntervalsResponse.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionPriceIntervalsResponse.kt index 4a326738..1ab49bec 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionPriceIntervalsResponse.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionPriceIntervalsResponse.kt @@ -12078,6 +12078,237 @@ private constructor( fun price(groupedTieredPackagePrice: Price.GroupedTieredPackagePrice) = price(Price.ofGroupedTieredPackagePrice(groupedTieredPackagePrice)) + /** + * The Price resource represents a price that can be billed on a subscription, resulting + * in a charge on an invoice in the form of an invoice line item. Prices take a quantity + * and determine an amount to bill. + * + * Orb supports a few different pricing models out of the box. Each of these models is + * serialized differently in a given Price object. The model_type field determines the + * key for the configuration object that is present. + * + * ## Unit pricing + * + * With unit pricing, each unit costs a fixed amount. + * + * ```json + * { + * ... + * "model_type": "unit", + * "unit_config": { + * "unit_amount": "0.50" + * } + * ... + * } + * ``` + * + * ## Tiered pricing + * + * In tiered pricing, the cost of a given unit depends on the tier range that it falls + * into, where each tier range is defined by an upper and lower bound. For example, the + * first ten units may cost $0.50 each and all units thereafter may cost $0.10 each. + * + * ```json + * { + * ... + * "model_type": "tiered", + * "tiered_config": { + * "tiers": [ + * { + * "first_unit": 1, + * "last_unit": 10, + * "unit_amount": "0.50" + * }, + * { + * "first_unit": 11, + * "last_unit": null, + * "unit_amount": "0.10" + * } + * ] + * } + * ... + * ``` + * + * ## Bulk pricing + * + * Bulk pricing applies when the number of units determine the cost of all units. For + * example, if you've bought less than 10 units, they may each be $0.50 for a total of + * $5.00. Once you've bought more than 10 units, all units may now be priced at $0.40 + * (i.e. 101 units total would be $40.40). + * + * ```json + * { + * ... + * "model_type": "bulk", + * "bulk_config": { + * "tiers": [ + * { + * "maximum_units": 10, + * "unit_amount": "0.50" + * }, + * { + * "maximum_units": 1000, + * "unit_amount": "0.40" + * } + * ] + * } + * ... + * } + * ``` + * + * ## Package pricing + * + * Package pricing defines the size or granularity of a unit for billing purposes. For + * example, if the package size is set to 5, then 4 units will be billed as 5 and 6 + * units will be billed at 10. + * + * ```json + * { + * ... + * "model_type": "package", + * "package_config": { + * "package_amount": "0.80", + * "package_size": 10 + * } + * ... + * } + * ``` + * + * ## BPS pricing + * + * BPS pricing specifies a per-event (e.g. per-payment) rate in one hundredth of a + * percent (the number of basis points to charge), as well as a cap per event to assess. + * For example, this would allow you to assess a fee of 0.25% on every payment you + * process, with a maximum charge of $25 per payment. + * + * ```json + * { + * ... + * "model_type": "bps", + * "bps_config": { + * "bps": 125, + * "per_unit_maximum": "11.00" + * } + * ... + * } + * ``` + * + * ## Bulk BPS pricing + * + * Bulk BPS pricing specifies BPS parameters in a tiered manner, dependent on the total + * quantity across all events. Similar to bulk pricing, the BPS parameters of a given + * event depends on the tier range that the billing period falls into. Each tier range + * is defined by an upper bound. For example, after $1.5M of payment volume is reached, + * each individual payment may have a lower cap or a smaller take-rate. + * + * ```json + * ... + * "model_type": "bulk_bps", + * "bulk_bps_config": { + * "tiers": [ + * { + * "maximum_amount": "1000000.00", + * "bps": 125, + * "per_unit_maximum": "19.00" + * }, + * { + * "maximum_amount": null, + * "bps": 115, + * "per_unit_maximum": "4.00" + * } + * ] + * } + * ... + * } + * ``` + * + * ## Tiered BPS pricing + * + * Tiered BPS pricing specifies BPS parameters in a graduated manner, where an event's + * applicable parameter is a function of its marginal addition to the period total. + * Similar to tiered pricing, the BPS parameters of a given event depends on the tier + * range that it falls into, where each tier range is defined by an upper and lower + * bound. For example, the first few payments may have a 0.8 BPS take-rate and all + * payments after a specific volume may incur a take-rate of 0.5 BPS each. + * + * ```json + * ... + * "model_type": "tiered_bps", + * "tiered_bps_config": { + * "tiers": [ + * { + * "minimum_amount": "0", + * "maximum_amount": "1000000.00", + * "bps": 125, + * "per_unit_maximum": "19.00" + * }, + * { + * "minimum_amount": "1000000.00", + * "maximum_amount": null, + * "bps": 115, + * "per_unit_maximum": "4.00" + * } + * ] + * } + * ... + * } + * ``` + * + * ## Matrix pricing + * + * Matrix pricing defines a set of unit prices in a one or two-dimensional matrix. + * `dimensions` defines the two event property values evaluated in this pricing model. + * In a one-dimensional matrix, the second value is `null`. Every configuration has a + * list of `matrix_values` which give the unit prices for specified property values. In + * a one-dimensional matrix, the matrix values will have `dimension_values` where the + * second value of the pair is null. If an event does not match any of the dimension + * values in the matrix, it will resort to the `default_unit_amount`. + * + * ```json + * { + * "model_type": "matrix" + * "matrix_config": { + * "default_unit_amount": "3.00", + * "dimensions": [ + * "cluster_name", + * "region" + * ], + * "matrix_values": [ + * { + * "dimension_values": [ + * "alpha", + * "west" + * ], + * "unit_amount": "2.00" + * }, + * ... + * ] + * } + * } + * ``` + * + * ## Fixed fees + * + * Fixed fees are prices that are applied independent of usage quantities, and follow + * unit pricing. They also have an additional parameter `fixed_price_quantity`. If the + * Price represents a fixed cost, this represents the quantity of units applied. + * + * ```json + * { + * ... + * "id": "price_id", + * "model_type": "unit", + * "unit_config": { + * "unit_amount": "2.00" + * }, + * "fixed_price_quantity": 3.0 + * ... + * } + * ``` + */ + fun price(maxGroupTieredPrice: Price.MaxGroupTieredPrice) = + price(Price.ofMaxGroupTieredPrice(maxGroupTieredPrice)) + /** * The start date of the price interval. This is the date that Orb starts billing for * this price. diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionSchedulePlanChangeResponse.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionSchedulePlanChangeResponse.kt index 773a34f5..0dbf0fda 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionSchedulePlanChangeResponse.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionSchedulePlanChangeResponse.kt @@ -12079,6 +12079,237 @@ private constructor( fun price(groupedTieredPackagePrice: Price.GroupedTieredPackagePrice) = price(Price.ofGroupedTieredPackagePrice(groupedTieredPackagePrice)) + /** + * The Price resource represents a price that can be billed on a subscription, resulting + * in a charge on an invoice in the form of an invoice line item. Prices take a quantity + * and determine an amount to bill. + * + * Orb supports a few different pricing models out of the box. Each of these models is + * serialized differently in a given Price object. The model_type field determines the + * key for the configuration object that is present. + * + * ## Unit pricing + * + * With unit pricing, each unit costs a fixed amount. + * + * ```json + * { + * ... + * "model_type": "unit", + * "unit_config": { + * "unit_amount": "0.50" + * } + * ... + * } + * ``` + * + * ## Tiered pricing + * + * In tiered pricing, the cost of a given unit depends on the tier range that it falls + * into, where each tier range is defined by an upper and lower bound. For example, the + * first ten units may cost $0.50 each and all units thereafter may cost $0.10 each. + * + * ```json + * { + * ... + * "model_type": "tiered", + * "tiered_config": { + * "tiers": [ + * { + * "first_unit": 1, + * "last_unit": 10, + * "unit_amount": "0.50" + * }, + * { + * "first_unit": 11, + * "last_unit": null, + * "unit_amount": "0.10" + * } + * ] + * } + * ... + * ``` + * + * ## Bulk pricing + * + * Bulk pricing applies when the number of units determine the cost of all units. For + * example, if you've bought less than 10 units, they may each be $0.50 for a total of + * $5.00. Once you've bought more than 10 units, all units may now be priced at $0.40 + * (i.e. 101 units total would be $40.40). + * + * ```json + * { + * ... + * "model_type": "bulk", + * "bulk_config": { + * "tiers": [ + * { + * "maximum_units": 10, + * "unit_amount": "0.50" + * }, + * { + * "maximum_units": 1000, + * "unit_amount": "0.40" + * } + * ] + * } + * ... + * } + * ``` + * + * ## Package pricing + * + * Package pricing defines the size or granularity of a unit for billing purposes. For + * example, if the package size is set to 5, then 4 units will be billed as 5 and 6 + * units will be billed at 10. + * + * ```json + * { + * ... + * "model_type": "package", + * "package_config": { + * "package_amount": "0.80", + * "package_size": 10 + * } + * ... + * } + * ``` + * + * ## BPS pricing + * + * BPS pricing specifies a per-event (e.g. per-payment) rate in one hundredth of a + * percent (the number of basis points to charge), as well as a cap per event to assess. + * For example, this would allow you to assess a fee of 0.25% on every payment you + * process, with a maximum charge of $25 per payment. + * + * ```json + * { + * ... + * "model_type": "bps", + * "bps_config": { + * "bps": 125, + * "per_unit_maximum": "11.00" + * } + * ... + * } + * ``` + * + * ## Bulk BPS pricing + * + * Bulk BPS pricing specifies BPS parameters in a tiered manner, dependent on the total + * quantity across all events. Similar to bulk pricing, the BPS parameters of a given + * event depends on the tier range that the billing period falls into. Each tier range + * is defined by an upper bound. For example, after $1.5M of payment volume is reached, + * each individual payment may have a lower cap or a smaller take-rate. + * + * ```json + * ... + * "model_type": "bulk_bps", + * "bulk_bps_config": { + * "tiers": [ + * { + * "maximum_amount": "1000000.00", + * "bps": 125, + * "per_unit_maximum": "19.00" + * }, + * { + * "maximum_amount": null, + * "bps": 115, + * "per_unit_maximum": "4.00" + * } + * ] + * } + * ... + * } + * ``` + * + * ## Tiered BPS pricing + * + * Tiered BPS pricing specifies BPS parameters in a graduated manner, where an event's + * applicable parameter is a function of its marginal addition to the period total. + * Similar to tiered pricing, the BPS parameters of a given event depends on the tier + * range that it falls into, where each tier range is defined by an upper and lower + * bound. For example, the first few payments may have a 0.8 BPS take-rate and all + * payments after a specific volume may incur a take-rate of 0.5 BPS each. + * + * ```json + * ... + * "model_type": "tiered_bps", + * "tiered_bps_config": { + * "tiers": [ + * { + * "minimum_amount": "0", + * "maximum_amount": "1000000.00", + * "bps": 125, + * "per_unit_maximum": "19.00" + * }, + * { + * "minimum_amount": "1000000.00", + * "maximum_amount": null, + * "bps": 115, + * "per_unit_maximum": "4.00" + * } + * ] + * } + * ... + * } + * ``` + * + * ## Matrix pricing + * + * Matrix pricing defines a set of unit prices in a one or two-dimensional matrix. + * `dimensions` defines the two event property values evaluated in this pricing model. + * In a one-dimensional matrix, the second value is `null`. Every configuration has a + * list of `matrix_values` which give the unit prices for specified property values. In + * a one-dimensional matrix, the matrix values will have `dimension_values` where the + * second value of the pair is null. If an event does not match any of the dimension + * values in the matrix, it will resort to the `default_unit_amount`. + * + * ```json + * { + * "model_type": "matrix" + * "matrix_config": { + * "default_unit_amount": "3.00", + * "dimensions": [ + * "cluster_name", + * "region" + * ], + * "matrix_values": [ + * { + * "dimension_values": [ + * "alpha", + * "west" + * ], + * "unit_amount": "2.00" + * }, + * ... + * ] + * } + * } + * ``` + * + * ## Fixed fees + * + * Fixed fees are prices that are applied independent of usage quantities, and follow + * unit pricing. They also have an additional parameter `fixed_price_quantity`. If the + * Price represents a fixed cost, this represents the quantity of units applied. + * + * ```json + * { + * ... + * "id": "price_id", + * "model_type": "unit", + * "unit_config": { + * "unit_amount": "2.00" + * }, + * "fixed_price_quantity": 3.0 + * ... + * } + * ``` + */ + fun price(maxGroupTieredPrice: Price.MaxGroupTieredPrice) = + price(Price.ofMaxGroupTieredPrice(maxGroupTieredPrice)) + /** * The start date of the price interval. This is the date that Orb starts billing for * this price. diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionTriggerPhaseResponse.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionTriggerPhaseResponse.kt index 8734f106..b4628bcc 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionTriggerPhaseResponse.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionTriggerPhaseResponse.kt @@ -12076,6 +12076,237 @@ private constructor( fun price(groupedTieredPackagePrice: Price.GroupedTieredPackagePrice) = price(Price.ofGroupedTieredPackagePrice(groupedTieredPackagePrice)) + /** + * The Price resource represents a price that can be billed on a subscription, resulting + * in a charge on an invoice in the form of an invoice line item. Prices take a quantity + * and determine an amount to bill. + * + * Orb supports a few different pricing models out of the box. Each of these models is + * serialized differently in a given Price object. The model_type field determines the + * key for the configuration object that is present. + * + * ## Unit pricing + * + * With unit pricing, each unit costs a fixed amount. + * + * ```json + * { + * ... + * "model_type": "unit", + * "unit_config": { + * "unit_amount": "0.50" + * } + * ... + * } + * ``` + * + * ## Tiered pricing + * + * In tiered pricing, the cost of a given unit depends on the tier range that it falls + * into, where each tier range is defined by an upper and lower bound. For example, the + * first ten units may cost $0.50 each and all units thereafter may cost $0.10 each. + * + * ```json + * { + * ... + * "model_type": "tiered", + * "tiered_config": { + * "tiers": [ + * { + * "first_unit": 1, + * "last_unit": 10, + * "unit_amount": "0.50" + * }, + * { + * "first_unit": 11, + * "last_unit": null, + * "unit_amount": "0.10" + * } + * ] + * } + * ... + * ``` + * + * ## Bulk pricing + * + * Bulk pricing applies when the number of units determine the cost of all units. For + * example, if you've bought less than 10 units, they may each be $0.50 for a total of + * $5.00. Once you've bought more than 10 units, all units may now be priced at $0.40 + * (i.e. 101 units total would be $40.40). + * + * ```json + * { + * ... + * "model_type": "bulk", + * "bulk_config": { + * "tiers": [ + * { + * "maximum_units": 10, + * "unit_amount": "0.50" + * }, + * { + * "maximum_units": 1000, + * "unit_amount": "0.40" + * } + * ] + * } + * ... + * } + * ``` + * + * ## Package pricing + * + * Package pricing defines the size or granularity of a unit for billing purposes. For + * example, if the package size is set to 5, then 4 units will be billed as 5 and 6 + * units will be billed at 10. + * + * ```json + * { + * ... + * "model_type": "package", + * "package_config": { + * "package_amount": "0.80", + * "package_size": 10 + * } + * ... + * } + * ``` + * + * ## BPS pricing + * + * BPS pricing specifies a per-event (e.g. per-payment) rate in one hundredth of a + * percent (the number of basis points to charge), as well as a cap per event to assess. + * For example, this would allow you to assess a fee of 0.25% on every payment you + * process, with a maximum charge of $25 per payment. + * + * ```json + * { + * ... + * "model_type": "bps", + * "bps_config": { + * "bps": 125, + * "per_unit_maximum": "11.00" + * } + * ... + * } + * ``` + * + * ## Bulk BPS pricing + * + * Bulk BPS pricing specifies BPS parameters in a tiered manner, dependent on the total + * quantity across all events. Similar to bulk pricing, the BPS parameters of a given + * event depends on the tier range that the billing period falls into. Each tier range + * is defined by an upper bound. For example, after $1.5M of payment volume is reached, + * each individual payment may have a lower cap or a smaller take-rate. + * + * ```json + * ... + * "model_type": "bulk_bps", + * "bulk_bps_config": { + * "tiers": [ + * { + * "maximum_amount": "1000000.00", + * "bps": 125, + * "per_unit_maximum": "19.00" + * }, + * { + * "maximum_amount": null, + * "bps": 115, + * "per_unit_maximum": "4.00" + * } + * ] + * } + * ... + * } + * ``` + * + * ## Tiered BPS pricing + * + * Tiered BPS pricing specifies BPS parameters in a graduated manner, where an event's + * applicable parameter is a function of its marginal addition to the period total. + * Similar to tiered pricing, the BPS parameters of a given event depends on the tier + * range that it falls into, where each tier range is defined by an upper and lower + * bound. For example, the first few payments may have a 0.8 BPS take-rate and all + * payments after a specific volume may incur a take-rate of 0.5 BPS each. + * + * ```json + * ... + * "model_type": "tiered_bps", + * "tiered_bps_config": { + * "tiers": [ + * { + * "minimum_amount": "0", + * "maximum_amount": "1000000.00", + * "bps": 125, + * "per_unit_maximum": "19.00" + * }, + * { + * "minimum_amount": "1000000.00", + * "maximum_amount": null, + * "bps": 115, + * "per_unit_maximum": "4.00" + * } + * ] + * } + * ... + * } + * ``` + * + * ## Matrix pricing + * + * Matrix pricing defines a set of unit prices in a one or two-dimensional matrix. + * `dimensions` defines the two event property values evaluated in this pricing model. + * In a one-dimensional matrix, the second value is `null`. Every configuration has a + * list of `matrix_values` which give the unit prices for specified property values. In + * a one-dimensional matrix, the matrix values will have `dimension_values` where the + * second value of the pair is null. If an event does not match any of the dimension + * values in the matrix, it will resort to the `default_unit_amount`. + * + * ```json + * { + * "model_type": "matrix" + * "matrix_config": { + * "default_unit_amount": "3.00", + * "dimensions": [ + * "cluster_name", + * "region" + * ], + * "matrix_values": [ + * { + * "dimension_values": [ + * "alpha", + * "west" + * ], + * "unit_amount": "2.00" + * }, + * ... + * ] + * } + * } + * ``` + * + * ## Fixed fees + * + * Fixed fees are prices that are applied independent of usage quantities, and follow + * unit pricing. They also have an additional parameter `fixed_price_quantity`. If the + * Price represents a fixed cost, this represents the quantity of units applied. + * + * ```json + * { + * ... + * "id": "price_id", + * "model_type": "unit", + * "unit_config": { + * "unit_amount": "2.00" + * }, + * "fixed_price_quantity": 3.0 + * ... + * } + * ``` + */ + fun price(maxGroupTieredPrice: Price.MaxGroupTieredPrice) = + price(Price.ofMaxGroupTieredPrice(maxGroupTieredPrice)) + /** * The start date of the price interval. This is the date that Orb starts billing for * this price. diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionUnscheduleCancellationResponse.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionUnscheduleCancellationResponse.kt index ea7bf275..1432b553 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionUnscheduleCancellationResponse.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionUnscheduleCancellationResponse.kt @@ -12085,6 +12085,237 @@ private constructor( fun price(groupedTieredPackagePrice: Price.GroupedTieredPackagePrice) = price(Price.ofGroupedTieredPackagePrice(groupedTieredPackagePrice)) + /** + * The Price resource represents a price that can be billed on a subscription, resulting + * in a charge on an invoice in the form of an invoice line item. Prices take a quantity + * and determine an amount to bill. + * + * Orb supports a few different pricing models out of the box. Each of these models is + * serialized differently in a given Price object. The model_type field determines the + * key for the configuration object that is present. + * + * ## Unit pricing + * + * With unit pricing, each unit costs a fixed amount. + * + * ```json + * { + * ... + * "model_type": "unit", + * "unit_config": { + * "unit_amount": "0.50" + * } + * ... + * } + * ``` + * + * ## Tiered pricing + * + * In tiered pricing, the cost of a given unit depends on the tier range that it falls + * into, where each tier range is defined by an upper and lower bound. For example, the + * first ten units may cost $0.50 each and all units thereafter may cost $0.10 each. + * + * ```json + * { + * ... + * "model_type": "tiered", + * "tiered_config": { + * "tiers": [ + * { + * "first_unit": 1, + * "last_unit": 10, + * "unit_amount": "0.50" + * }, + * { + * "first_unit": 11, + * "last_unit": null, + * "unit_amount": "0.10" + * } + * ] + * } + * ... + * ``` + * + * ## Bulk pricing + * + * Bulk pricing applies when the number of units determine the cost of all units. For + * example, if you've bought less than 10 units, they may each be $0.50 for a total of + * $5.00. Once you've bought more than 10 units, all units may now be priced at $0.40 + * (i.e. 101 units total would be $40.40). + * + * ```json + * { + * ... + * "model_type": "bulk", + * "bulk_config": { + * "tiers": [ + * { + * "maximum_units": 10, + * "unit_amount": "0.50" + * }, + * { + * "maximum_units": 1000, + * "unit_amount": "0.40" + * } + * ] + * } + * ... + * } + * ``` + * + * ## Package pricing + * + * Package pricing defines the size or granularity of a unit for billing purposes. For + * example, if the package size is set to 5, then 4 units will be billed as 5 and 6 + * units will be billed at 10. + * + * ```json + * { + * ... + * "model_type": "package", + * "package_config": { + * "package_amount": "0.80", + * "package_size": 10 + * } + * ... + * } + * ``` + * + * ## BPS pricing + * + * BPS pricing specifies a per-event (e.g. per-payment) rate in one hundredth of a + * percent (the number of basis points to charge), as well as a cap per event to assess. + * For example, this would allow you to assess a fee of 0.25% on every payment you + * process, with a maximum charge of $25 per payment. + * + * ```json + * { + * ... + * "model_type": "bps", + * "bps_config": { + * "bps": 125, + * "per_unit_maximum": "11.00" + * } + * ... + * } + * ``` + * + * ## Bulk BPS pricing + * + * Bulk BPS pricing specifies BPS parameters in a tiered manner, dependent on the total + * quantity across all events. Similar to bulk pricing, the BPS parameters of a given + * event depends on the tier range that the billing period falls into. Each tier range + * is defined by an upper bound. For example, after $1.5M of payment volume is reached, + * each individual payment may have a lower cap or a smaller take-rate. + * + * ```json + * ... + * "model_type": "bulk_bps", + * "bulk_bps_config": { + * "tiers": [ + * { + * "maximum_amount": "1000000.00", + * "bps": 125, + * "per_unit_maximum": "19.00" + * }, + * { + * "maximum_amount": null, + * "bps": 115, + * "per_unit_maximum": "4.00" + * } + * ] + * } + * ... + * } + * ``` + * + * ## Tiered BPS pricing + * + * Tiered BPS pricing specifies BPS parameters in a graduated manner, where an event's + * applicable parameter is a function of its marginal addition to the period total. + * Similar to tiered pricing, the BPS parameters of a given event depends on the tier + * range that it falls into, where each tier range is defined by an upper and lower + * bound. For example, the first few payments may have a 0.8 BPS take-rate and all + * payments after a specific volume may incur a take-rate of 0.5 BPS each. + * + * ```json + * ... + * "model_type": "tiered_bps", + * "tiered_bps_config": { + * "tiers": [ + * { + * "minimum_amount": "0", + * "maximum_amount": "1000000.00", + * "bps": 125, + * "per_unit_maximum": "19.00" + * }, + * { + * "minimum_amount": "1000000.00", + * "maximum_amount": null, + * "bps": 115, + * "per_unit_maximum": "4.00" + * } + * ] + * } + * ... + * } + * ``` + * + * ## Matrix pricing + * + * Matrix pricing defines a set of unit prices in a one or two-dimensional matrix. + * `dimensions` defines the two event property values evaluated in this pricing model. + * In a one-dimensional matrix, the second value is `null`. Every configuration has a + * list of `matrix_values` which give the unit prices for specified property values. In + * a one-dimensional matrix, the matrix values will have `dimension_values` where the + * second value of the pair is null. If an event does not match any of the dimension + * values in the matrix, it will resort to the `default_unit_amount`. + * + * ```json + * { + * "model_type": "matrix" + * "matrix_config": { + * "default_unit_amount": "3.00", + * "dimensions": [ + * "cluster_name", + * "region" + * ], + * "matrix_values": [ + * { + * "dimension_values": [ + * "alpha", + * "west" + * ], + * "unit_amount": "2.00" + * }, + * ... + * ] + * } + * } + * ``` + * + * ## Fixed fees + * + * Fixed fees are prices that are applied independent of usage quantities, and follow + * unit pricing. They also have an additional parameter `fixed_price_quantity`. If the + * Price represents a fixed cost, this represents the quantity of units applied. + * + * ```json + * { + * ... + * "id": "price_id", + * "model_type": "unit", + * "unit_config": { + * "unit_amount": "2.00" + * }, + * "fixed_price_quantity": 3.0 + * ... + * } + * ``` + */ + fun price(maxGroupTieredPrice: Price.MaxGroupTieredPrice) = + price(Price.ofMaxGroupTieredPrice(maxGroupTieredPrice)) + /** * The start date of the price interval. This is the date that Orb starts billing for * this price. diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionUnscheduleFixedFeeQuantityUpdatesResponse.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionUnscheduleFixedFeeQuantityUpdatesResponse.kt index b9e09b83..e1d6f61c 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionUnscheduleFixedFeeQuantityUpdatesResponse.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionUnscheduleFixedFeeQuantityUpdatesResponse.kt @@ -12093,6 +12093,237 @@ private constructor( fun price(groupedTieredPackagePrice: Price.GroupedTieredPackagePrice) = price(Price.ofGroupedTieredPackagePrice(groupedTieredPackagePrice)) + /** + * The Price resource represents a price that can be billed on a subscription, resulting + * in a charge on an invoice in the form of an invoice line item. Prices take a quantity + * and determine an amount to bill. + * + * Orb supports a few different pricing models out of the box. Each of these models is + * serialized differently in a given Price object. The model_type field determines the + * key for the configuration object that is present. + * + * ## Unit pricing + * + * With unit pricing, each unit costs a fixed amount. + * + * ```json + * { + * ... + * "model_type": "unit", + * "unit_config": { + * "unit_amount": "0.50" + * } + * ... + * } + * ``` + * + * ## Tiered pricing + * + * In tiered pricing, the cost of a given unit depends on the tier range that it falls + * into, where each tier range is defined by an upper and lower bound. For example, the + * first ten units may cost $0.50 each and all units thereafter may cost $0.10 each. + * + * ```json + * { + * ... + * "model_type": "tiered", + * "tiered_config": { + * "tiers": [ + * { + * "first_unit": 1, + * "last_unit": 10, + * "unit_amount": "0.50" + * }, + * { + * "first_unit": 11, + * "last_unit": null, + * "unit_amount": "0.10" + * } + * ] + * } + * ... + * ``` + * + * ## Bulk pricing + * + * Bulk pricing applies when the number of units determine the cost of all units. For + * example, if you've bought less than 10 units, they may each be $0.50 for a total of + * $5.00. Once you've bought more than 10 units, all units may now be priced at $0.40 + * (i.e. 101 units total would be $40.40). + * + * ```json + * { + * ... + * "model_type": "bulk", + * "bulk_config": { + * "tiers": [ + * { + * "maximum_units": 10, + * "unit_amount": "0.50" + * }, + * { + * "maximum_units": 1000, + * "unit_amount": "0.40" + * } + * ] + * } + * ... + * } + * ``` + * + * ## Package pricing + * + * Package pricing defines the size or granularity of a unit for billing purposes. For + * example, if the package size is set to 5, then 4 units will be billed as 5 and 6 + * units will be billed at 10. + * + * ```json + * { + * ... + * "model_type": "package", + * "package_config": { + * "package_amount": "0.80", + * "package_size": 10 + * } + * ... + * } + * ``` + * + * ## BPS pricing + * + * BPS pricing specifies a per-event (e.g. per-payment) rate in one hundredth of a + * percent (the number of basis points to charge), as well as a cap per event to assess. + * For example, this would allow you to assess a fee of 0.25% on every payment you + * process, with a maximum charge of $25 per payment. + * + * ```json + * { + * ... + * "model_type": "bps", + * "bps_config": { + * "bps": 125, + * "per_unit_maximum": "11.00" + * } + * ... + * } + * ``` + * + * ## Bulk BPS pricing + * + * Bulk BPS pricing specifies BPS parameters in a tiered manner, dependent on the total + * quantity across all events. Similar to bulk pricing, the BPS parameters of a given + * event depends on the tier range that the billing period falls into. Each tier range + * is defined by an upper bound. For example, after $1.5M of payment volume is reached, + * each individual payment may have a lower cap or a smaller take-rate. + * + * ```json + * ... + * "model_type": "bulk_bps", + * "bulk_bps_config": { + * "tiers": [ + * { + * "maximum_amount": "1000000.00", + * "bps": 125, + * "per_unit_maximum": "19.00" + * }, + * { + * "maximum_amount": null, + * "bps": 115, + * "per_unit_maximum": "4.00" + * } + * ] + * } + * ... + * } + * ``` + * + * ## Tiered BPS pricing + * + * Tiered BPS pricing specifies BPS parameters in a graduated manner, where an event's + * applicable parameter is a function of its marginal addition to the period total. + * Similar to tiered pricing, the BPS parameters of a given event depends on the tier + * range that it falls into, where each tier range is defined by an upper and lower + * bound. For example, the first few payments may have a 0.8 BPS take-rate and all + * payments after a specific volume may incur a take-rate of 0.5 BPS each. + * + * ```json + * ... + * "model_type": "tiered_bps", + * "tiered_bps_config": { + * "tiers": [ + * { + * "minimum_amount": "0", + * "maximum_amount": "1000000.00", + * "bps": 125, + * "per_unit_maximum": "19.00" + * }, + * { + * "minimum_amount": "1000000.00", + * "maximum_amount": null, + * "bps": 115, + * "per_unit_maximum": "4.00" + * } + * ] + * } + * ... + * } + * ``` + * + * ## Matrix pricing + * + * Matrix pricing defines a set of unit prices in a one or two-dimensional matrix. + * `dimensions` defines the two event property values evaluated in this pricing model. + * In a one-dimensional matrix, the second value is `null`. Every configuration has a + * list of `matrix_values` which give the unit prices for specified property values. In + * a one-dimensional matrix, the matrix values will have `dimension_values` where the + * second value of the pair is null. If an event does not match any of the dimension + * values in the matrix, it will resort to the `default_unit_amount`. + * + * ```json + * { + * "model_type": "matrix" + * "matrix_config": { + * "default_unit_amount": "3.00", + * "dimensions": [ + * "cluster_name", + * "region" + * ], + * "matrix_values": [ + * { + * "dimension_values": [ + * "alpha", + * "west" + * ], + * "unit_amount": "2.00" + * }, + * ... + * ] + * } + * } + * ``` + * + * ## Fixed fees + * + * Fixed fees are prices that are applied independent of usage quantities, and follow + * unit pricing. They also have an additional parameter `fixed_price_quantity`. If the + * Price represents a fixed cost, this represents the quantity of units applied. + * + * ```json + * { + * ... + * "id": "price_id", + * "model_type": "unit", + * "unit_config": { + * "unit_amount": "2.00" + * }, + * "fixed_price_quantity": 3.0 + * ... + * } + * ``` + */ + fun price(maxGroupTieredPrice: Price.MaxGroupTieredPrice) = + price(Price.ofMaxGroupTieredPrice(maxGroupTieredPrice)) + /** * The start date of the price interval. This is the date that Orb starts billing for * this price. diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionUnschedulePendingPlanChangesResponse.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionUnschedulePendingPlanChangesResponse.kt index 000e039b..5fb2e6e3 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionUnschedulePendingPlanChangesResponse.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionUnschedulePendingPlanChangesResponse.kt @@ -12089,6 +12089,237 @@ private constructor( fun price(groupedTieredPackagePrice: Price.GroupedTieredPackagePrice) = price(Price.ofGroupedTieredPackagePrice(groupedTieredPackagePrice)) + /** + * The Price resource represents a price that can be billed on a subscription, resulting + * in a charge on an invoice in the form of an invoice line item. Prices take a quantity + * and determine an amount to bill. + * + * Orb supports a few different pricing models out of the box. Each of these models is + * serialized differently in a given Price object. The model_type field determines the + * key for the configuration object that is present. + * + * ## Unit pricing + * + * With unit pricing, each unit costs a fixed amount. + * + * ```json + * { + * ... + * "model_type": "unit", + * "unit_config": { + * "unit_amount": "0.50" + * } + * ... + * } + * ``` + * + * ## Tiered pricing + * + * In tiered pricing, the cost of a given unit depends on the tier range that it falls + * into, where each tier range is defined by an upper and lower bound. For example, the + * first ten units may cost $0.50 each and all units thereafter may cost $0.10 each. + * + * ```json + * { + * ... + * "model_type": "tiered", + * "tiered_config": { + * "tiers": [ + * { + * "first_unit": 1, + * "last_unit": 10, + * "unit_amount": "0.50" + * }, + * { + * "first_unit": 11, + * "last_unit": null, + * "unit_amount": "0.10" + * } + * ] + * } + * ... + * ``` + * + * ## Bulk pricing + * + * Bulk pricing applies when the number of units determine the cost of all units. For + * example, if you've bought less than 10 units, they may each be $0.50 for a total of + * $5.00. Once you've bought more than 10 units, all units may now be priced at $0.40 + * (i.e. 101 units total would be $40.40). + * + * ```json + * { + * ... + * "model_type": "bulk", + * "bulk_config": { + * "tiers": [ + * { + * "maximum_units": 10, + * "unit_amount": "0.50" + * }, + * { + * "maximum_units": 1000, + * "unit_amount": "0.40" + * } + * ] + * } + * ... + * } + * ``` + * + * ## Package pricing + * + * Package pricing defines the size or granularity of a unit for billing purposes. For + * example, if the package size is set to 5, then 4 units will be billed as 5 and 6 + * units will be billed at 10. + * + * ```json + * { + * ... + * "model_type": "package", + * "package_config": { + * "package_amount": "0.80", + * "package_size": 10 + * } + * ... + * } + * ``` + * + * ## BPS pricing + * + * BPS pricing specifies a per-event (e.g. per-payment) rate in one hundredth of a + * percent (the number of basis points to charge), as well as a cap per event to assess. + * For example, this would allow you to assess a fee of 0.25% on every payment you + * process, with a maximum charge of $25 per payment. + * + * ```json + * { + * ... + * "model_type": "bps", + * "bps_config": { + * "bps": 125, + * "per_unit_maximum": "11.00" + * } + * ... + * } + * ``` + * + * ## Bulk BPS pricing + * + * Bulk BPS pricing specifies BPS parameters in a tiered manner, dependent on the total + * quantity across all events. Similar to bulk pricing, the BPS parameters of a given + * event depends on the tier range that the billing period falls into. Each tier range + * is defined by an upper bound. For example, after $1.5M of payment volume is reached, + * each individual payment may have a lower cap or a smaller take-rate. + * + * ```json + * ... + * "model_type": "bulk_bps", + * "bulk_bps_config": { + * "tiers": [ + * { + * "maximum_amount": "1000000.00", + * "bps": 125, + * "per_unit_maximum": "19.00" + * }, + * { + * "maximum_amount": null, + * "bps": 115, + * "per_unit_maximum": "4.00" + * } + * ] + * } + * ... + * } + * ``` + * + * ## Tiered BPS pricing + * + * Tiered BPS pricing specifies BPS parameters in a graduated manner, where an event's + * applicable parameter is a function of its marginal addition to the period total. + * Similar to tiered pricing, the BPS parameters of a given event depends on the tier + * range that it falls into, where each tier range is defined by an upper and lower + * bound. For example, the first few payments may have a 0.8 BPS take-rate and all + * payments after a specific volume may incur a take-rate of 0.5 BPS each. + * + * ```json + * ... + * "model_type": "tiered_bps", + * "tiered_bps_config": { + * "tiers": [ + * { + * "minimum_amount": "0", + * "maximum_amount": "1000000.00", + * "bps": 125, + * "per_unit_maximum": "19.00" + * }, + * { + * "minimum_amount": "1000000.00", + * "maximum_amount": null, + * "bps": 115, + * "per_unit_maximum": "4.00" + * } + * ] + * } + * ... + * } + * ``` + * + * ## Matrix pricing + * + * Matrix pricing defines a set of unit prices in a one or two-dimensional matrix. + * `dimensions` defines the two event property values evaluated in this pricing model. + * In a one-dimensional matrix, the second value is `null`. Every configuration has a + * list of `matrix_values` which give the unit prices for specified property values. In + * a one-dimensional matrix, the matrix values will have `dimension_values` where the + * second value of the pair is null. If an event does not match any of the dimension + * values in the matrix, it will resort to the `default_unit_amount`. + * + * ```json + * { + * "model_type": "matrix" + * "matrix_config": { + * "default_unit_amount": "3.00", + * "dimensions": [ + * "cluster_name", + * "region" + * ], + * "matrix_values": [ + * { + * "dimension_values": [ + * "alpha", + * "west" + * ], + * "unit_amount": "2.00" + * }, + * ... + * ] + * } + * } + * ``` + * + * ## Fixed fees + * + * Fixed fees are prices that are applied independent of usage quantities, and follow + * unit pricing. They also have an additional parameter `fixed_price_quantity`. If the + * Price represents a fixed cost, this represents the quantity of units applied. + * + * ```json + * { + * ... + * "id": "price_id", + * "model_type": "unit", + * "unit_config": { + * "unit_amount": "2.00" + * }, + * "fixed_price_quantity": 3.0 + * ... + * } + * ``` + */ + fun price(maxGroupTieredPrice: Price.MaxGroupTieredPrice) = + price(Price.ofMaxGroupTieredPrice(maxGroupTieredPrice)) + /** * The start date of the price interval. This is the date that Orb starts billing for * this price. diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionUpdateFixedFeeQuantityResponse.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionUpdateFixedFeeQuantityResponse.kt index 70390fa2..0f337ca7 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionUpdateFixedFeeQuantityResponse.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionUpdateFixedFeeQuantityResponse.kt @@ -12085,6 +12085,237 @@ private constructor( fun price(groupedTieredPackagePrice: Price.GroupedTieredPackagePrice) = price(Price.ofGroupedTieredPackagePrice(groupedTieredPackagePrice)) + /** + * The Price resource represents a price that can be billed on a subscription, resulting + * in a charge on an invoice in the form of an invoice line item. Prices take a quantity + * and determine an amount to bill. + * + * Orb supports a few different pricing models out of the box. Each of these models is + * serialized differently in a given Price object. The model_type field determines the + * key for the configuration object that is present. + * + * ## Unit pricing + * + * With unit pricing, each unit costs a fixed amount. + * + * ```json + * { + * ... + * "model_type": "unit", + * "unit_config": { + * "unit_amount": "0.50" + * } + * ... + * } + * ``` + * + * ## Tiered pricing + * + * In tiered pricing, the cost of a given unit depends on the tier range that it falls + * into, where each tier range is defined by an upper and lower bound. For example, the + * first ten units may cost $0.50 each and all units thereafter may cost $0.10 each. + * + * ```json + * { + * ... + * "model_type": "tiered", + * "tiered_config": { + * "tiers": [ + * { + * "first_unit": 1, + * "last_unit": 10, + * "unit_amount": "0.50" + * }, + * { + * "first_unit": 11, + * "last_unit": null, + * "unit_amount": "0.10" + * } + * ] + * } + * ... + * ``` + * + * ## Bulk pricing + * + * Bulk pricing applies when the number of units determine the cost of all units. For + * example, if you've bought less than 10 units, they may each be $0.50 for a total of + * $5.00. Once you've bought more than 10 units, all units may now be priced at $0.40 + * (i.e. 101 units total would be $40.40). + * + * ```json + * { + * ... + * "model_type": "bulk", + * "bulk_config": { + * "tiers": [ + * { + * "maximum_units": 10, + * "unit_amount": "0.50" + * }, + * { + * "maximum_units": 1000, + * "unit_amount": "0.40" + * } + * ] + * } + * ... + * } + * ``` + * + * ## Package pricing + * + * Package pricing defines the size or granularity of a unit for billing purposes. For + * example, if the package size is set to 5, then 4 units will be billed as 5 and 6 + * units will be billed at 10. + * + * ```json + * { + * ... + * "model_type": "package", + * "package_config": { + * "package_amount": "0.80", + * "package_size": 10 + * } + * ... + * } + * ``` + * + * ## BPS pricing + * + * BPS pricing specifies a per-event (e.g. per-payment) rate in one hundredth of a + * percent (the number of basis points to charge), as well as a cap per event to assess. + * For example, this would allow you to assess a fee of 0.25% on every payment you + * process, with a maximum charge of $25 per payment. + * + * ```json + * { + * ... + * "model_type": "bps", + * "bps_config": { + * "bps": 125, + * "per_unit_maximum": "11.00" + * } + * ... + * } + * ``` + * + * ## Bulk BPS pricing + * + * Bulk BPS pricing specifies BPS parameters in a tiered manner, dependent on the total + * quantity across all events. Similar to bulk pricing, the BPS parameters of a given + * event depends on the tier range that the billing period falls into. Each tier range + * is defined by an upper bound. For example, after $1.5M of payment volume is reached, + * each individual payment may have a lower cap or a smaller take-rate. + * + * ```json + * ... + * "model_type": "bulk_bps", + * "bulk_bps_config": { + * "tiers": [ + * { + * "maximum_amount": "1000000.00", + * "bps": 125, + * "per_unit_maximum": "19.00" + * }, + * { + * "maximum_amount": null, + * "bps": 115, + * "per_unit_maximum": "4.00" + * } + * ] + * } + * ... + * } + * ``` + * + * ## Tiered BPS pricing + * + * Tiered BPS pricing specifies BPS parameters in a graduated manner, where an event's + * applicable parameter is a function of its marginal addition to the period total. + * Similar to tiered pricing, the BPS parameters of a given event depends on the tier + * range that it falls into, where each tier range is defined by an upper and lower + * bound. For example, the first few payments may have a 0.8 BPS take-rate and all + * payments after a specific volume may incur a take-rate of 0.5 BPS each. + * + * ```json + * ... + * "model_type": "tiered_bps", + * "tiered_bps_config": { + * "tiers": [ + * { + * "minimum_amount": "0", + * "maximum_amount": "1000000.00", + * "bps": 125, + * "per_unit_maximum": "19.00" + * }, + * { + * "minimum_amount": "1000000.00", + * "maximum_amount": null, + * "bps": 115, + * "per_unit_maximum": "4.00" + * } + * ] + * } + * ... + * } + * ``` + * + * ## Matrix pricing + * + * Matrix pricing defines a set of unit prices in a one or two-dimensional matrix. + * `dimensions` defines the two event property values evaluated in this pricing model. + * In a one-dimensional matrix, the second value is `null`. Every configuration has a + * list of `matrix_values` which give the unit prices for specified property values. In + * a one-dimensional matrix, the matrix values will have `dimension_values` where the + * second value of the pair is null. If an event does not match any of the dimension + * values in the matrix, it will resort to the `default_unit_amount`. + * + * ```json + * { + * "model_type": "matrix" + * "matrix_config": { + * "default_unit_amount": "3.00", + * "dimensions": [ + * "cluster_name", + * "region" + * ], + * "matrix_values": [ + * { + * "dimension_values": [ + * "alpha", + * "west" + * ], + * "unit_amount": "2.00" + * }, + * ... + * ] + * } + * } + * ``` + * + * ## Fixed fees + * + * Fixed fees are prices that are applied independent of usage quantities, and follow + * unit pricing. They also have an additional parameter `fixed_price_quantity`. If the + * Price represents a fixed cost, this represents the quantity of units applied. + * + * ```json + * { + * ... + * "id": "price_id", + * "model_type": "unit", + * "unit_config": { + * "unit_amount": "2.00" + * }, + * "fixed_price_quantity": 3.0 + * ... + * } + * ``` + */ + fun price(maxGroupTieredPrice: Price.MaxGroupTieredPrice) = + price(Price.ofMaxGroupTieredPrice(maxGroupTieredPrice)) + /** * The start date of the price interval. This is the date that Orb starts billing for * this price. diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionUpdateTrialResponse.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionUpdateTrialResponse.kt index b713d62e..c95bd080 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionUpdateTrialResponse.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionUpdateTrialResponse.kt @@ -12076,6 +12076,237 @@ private constructor( fun price(groupedTieredPackagePrice: Price.GroupedTieredPackagePrice) = price(Price.ofGroupedTieredPackagePrice(groupedTieredPackagePrice)) + /** + * The Price resource represents a price that can be billed on a subscription, resulting + * in a charge on an invoice in the form of an invoice line item. Prices take a quantity + * and determine an amount to bill. + * + * Orb supports a few different pricing models out of the box. Each of these models is + * serialized differently in a given Price object. The model_type field determines the + * key for the configuration object that is present. + * + * ## Unit pricing + * + * With unit pricing, each unit costs a fixed amount. + * + * ```json + * { + * ... + * "model_type": "unit", + * "unit_config": { + * "unit_amount": "0.50" + * } + * ... + * } + * ``` + * + * ## Tiered pricing + * + * In tiered pricing, the cost of a given unit depends on the tier range that it falls + * into, where each tier range is defined by an upper and lower bound. For example, the + * first ten units may cost $0.50 each and all units thereafter may cost $0.10 each. + * + * ```json + * { + * ... + * "model_type": "tiered", + * "tiered_config": { + * "tiers": [ + * { + * "first_unit": 1, + * "last_unit": 10, + * "unit_amount": "0.50" + * }, + * { + * "first_unit": 11, + * "last_unit": null, + * "unit_amount": "0.10" + * } + * ] + * } + * ... + * ``` + * + * ## Bulk pricing + * + * Bulk pricing applies when the number of units determine the cost of all units. For + * example, if you've bought less than 10 units, they may each be $0.50 for a total of + * $5.00. Once you've bought more than 10 units, all units may now be priced at $0.40 + * (i.e. 101 units total would be $40.40). + * + * ```json + * { + * ... + * "model_type": "bulk", + * "bulk_config": { + * "tiers": [ + * { + * "maximum_units": 10, + * "unit_amount": "0.50" + * }, + * { + * "maximum_units": 1000, + * "unit_amount": "0.40" + * } + * ] + * } + * ... + * } + * ``` + * + * ## Package pricing + * + * Package pricing defines the size or granularity of a unit for billing purposes. For + * example, if the package size is set to 5, then 4 units will be billed as 5 and 6 + * units will be billed at 10. + * + * ```json + * { + * ... + * "model_type": "package", + * "package_config": { + * "package_amount": "0.80", + * "package_size": 10 + * } + * ... + * } + * ``` + * + * ## BPS pricing + * + * BPS pricing specifies a per-event (e.g. per-payment) rate in one hundredth of a + * percent (the number of basis points to charge), as well as a cap per event to assess. + * For example, this would allow you to assess a fee of 0.25% on every payment you + * process, with a maximum charge of $25 per payment. + * + * ```json + * { + * ... + * "model_type": "bps", + * "bps_config": { + * "bps": 125, + * "per_unit_maximum": "11.00" + * } + * ... + * } + * ``` + * + * ## Bulk BPS pricing + * + * Bulk BPS pricing specifies BPS parameters in a tiered manner, dependent on the total + * quantity across all events. Similar to bulk pricing, the BPS parameters of a given + * event depends on the tier range that the billing period falls into. Each tier range + * is defined by an upper bound. For example, after $1.5M of payment volume is reached, + * each individual payment may have a lower cap or a smaller take-rate. + * + * ```json + * ... + * "model_type": "bulk_bps", + * "bulk_bps_config": { + * "tiers": [ + * { + * "maximum_amount": "1000000.00", + * "bps": 125, + * "per_unit_maximum": "19.00" + * }, + * { + * "maximum_amount": null, + * "bps": 115, + * "per_unit_maximum": "4.00" + * } + * ] + * } + * ... + * } + * ``` + * + * ## Tiered BPS pricing + * + * Tiered BPS pricing specifies BPS parameters in a graduated manner, where an event's + * applicable parameter is a function of its marginal addition to the period total. + * Similar to tiered pricing, the BPS parameters of a given event depends on the tier + * range that it falls into, where each tier range is defined by an upper and lower + * bound. For example, the first few payments may have a 0.8 BPS take-rate and all + * payments after a specific volume may incur a take-rate of 0.5 BPS each. + * + * ```json + * ... + * "model_type": "tiered_bps", + * "tiered_bps_config": { + * "tiers": [ + * { + * "minimum_amount": "0", + * "maximum_amount": "1000000.00", + * "bps": 125, + * "per_unit_maximum": "19.00" + * }, + * { + * "minimum_amount": "1000000.00", + * "maximum_amount": null, + * "bps": 115, + * "per_unit_maximum": "4.00" + * } + * ] + * } + * ... + * } + * ``` + * + * ## Matrix pricing + * + * Matrix pricing defines a set of unit prices in a one or two-dimensional matrix. + * `dimensions` defines the two event property values evaluated in this pricing model. + * In a one-dimensional matrix, the second value is `null`. Every configuration has a + * list of `matrix_values` which give the unit prices for specified property values. In + * a one-dimensional matrix, the matrix values will have `dimension_values` where the + * second value of the pair is null. If an event does not match any of the dimension + * values in the matrix, it will resort to the `default_unit_amount`. + * + * ```json + * { + * "model_type": "matrix" + * "matrix_config": { + * "default_unit_amount": "3.00", + * "dimensions": [ + * "cluster_name", + * "region" + * ], + * "matrix_values": [ + * { + * "dimension_values": [ + * "alpha", + * "west" + * ], + * "unit_amount": "2.00" + * }, + * ... + * ] + * } + * } + * ``` + * + * ## Fixed fees + * + * Fixed fees are prices that are applied independent of usage quantities, and follow + * unit pricing. They also have an additional parameter `fixed_price_quantity`. If the + * Price represents a fixed cost, this represents the quantity of units applied. + * + * ```json + * { + * ... + * "id": "price_id", + * "model_type": "unit", + * "unit_config": { + * "unit_amount": "2.00" + * }, + * "fixed_price_quantity": 3.0 + * ... + * } + * ``` + */ + fun price(maxGroupTieredPrice: Price.MaxGroupTieredPrice) = + price(Price.ofMaxGroupTieredPrice(maxGroupTieredPrice)) + /** * The start date of the price interval. This is the date that Orb starts billing for * this price.