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,EAEA,MAAM,YAAA,CAAa,0BAAA,EAA+D,MAAA,EAAsC,OAAA,EAA8D;AACrL,IAAA,MAAM,2BAAA,GAA+B,2BAAwD,EAAA,IAAM,0BAAA;AACnG,IAAA,OAAO,IAAA,CAAK,SAAA,CAAU,KAAA,CAAkB,EAAE,IAAA,EAAM,cAAA,EAAe,EAAG,CAAA,6BAAA,EAAgC,2BAA2B,CAAA,aAAA,CAAA,EAAiB,MAAA,EAAQ,OAAO,CAAA;AAAA,EAC9J;AAAA,EAEA,MAAM,OAAA,CAAQ,0BAAA,EAA+D,MAAA,EAAkC,OAAA,EAA0D;AACxK,IAAA,MAAM,2BAAA,GAA+B,2BAAwD,EAAA,IAAM,0BAAA;AACnG,IAAA,OAAO,IAAA,CAAK,SAAA,CAAU,KAAA,CAAc,EAAE,IAAA,EAAM,SAAA,EAAU,EAAG,CAAA,6BAAA,EAAgC,2BAA2B,CAAA,QAAA,CAAA,EAAY,MAAA,EAAQ,OAAO,CAAA;AAAA,EAChJ;AAAA,EAGA,2BAA2B,QAAA,EAAqD;AAC/E,IAAA,OAAO,QAAA,CAAS,IAAA,IAAS,QAAA,CAAS,IAAA,KAAS,0BAAA,CAA0B,IAAA;AAAA,EACtE;AAAA,EAGA,aAAa,EAAA,EAA6D;AACzE,IAAA,OAAO,KAAA,CAAM,qBAAkD,EAAE,CAAA;AAAA,EAClE;AAAA,EAEA,sBAAsB,GAAA,EAA8C;AACnE,IAAA,OAAO,KAAA,CAAM,qBAAA,CAAmD,GAAG,GAAG,CAAA;AAAA,EACvE;AAAA,EAGA,IAAA,GAAqC;AACpC,IAAA,OAAO,0BAAA,CAA0B,IAAA;AAAA,EAClC;AAED,CAAA;AAGA,IAAM,QAAA,GAAW,IAAI,yBAAA,EAA0B;AAC/C,IAAO,oCAAA,GAAQ","file":"chunk-ZZOSKORP.cjs","sourcesContent":["import { ApiResource } from '../resource'\nimport type { Resource, ResourceCreate, ResourceUpdate, ResourceId, ResourcesConfig, ResourceRel, ListResponse, ResourceSort, /* ResourceFilter */ } from '../resource'\nimport type { QueryParamsRetrieve, QueryParamsList } from '../query'\n\nimport type { Version } from './versions'\nimport type { EventStore } from './event_stores'\nimport type { Coupon, CouponType } from './coupons'\nimport type { PercentageDiscountPromotion, PercentageDiscountPromotionType } from './percentage_discount_promotions'\nimport type { FreeShippingPromotion, FreeShippingPromotionType } from './free_shipping_promotions'\nimport type { BuyXPayYPromotion, BuyXPayYPromotionType } from './buy_x_pay_y_promotions'\nimport type { FreeGiftPromotion, FreeGiftPromotionType } from './free_gift_promotions'\nimport type { FixedPricePromotion, FixedPricePromotionType } from './fixed_price_promotions'\nimport type { ExternalPromotion, ExternalPromotionType } from './external_promotions'\nimport type { FixedAmountPromotion, FixedAmountPromotionType } from './fixed_amount_promotions'\nimport type { FlexPromotion, FlexPromotionType } from './flex_promotions'\n\n\ntype CouponCodesPromotionRuleType = 'coupon_codes_promotion_rules'\ntype CouponCodesPromotionRuleRel = ResourceRel & { type: CouponCodesPromotionRuleType }\ntype PercentageDiscountPromotionRel = ResourceRel & { type: PercentageDiscountPromotionType }\ntype FreeShippingPromotionRel = ResourceRel & { type: FreeShippingPromotionType }\ntype BuyXPayYPromotionRel = ResourceRel & { type: BuyXPayYPromotionType }\ntype FreeGiftPromotionRel = ResourceRel & { type: FreeGiftPromotionType }\ntype FixedPricePromotionRel = ResourceRel & { type: FixedPricePromotionType }\ntype ExternalPromotionRel = ResourceRel & { type: ExternalPromotionType }\ntype FixedAmountPromotionRel = ResourceRel & { type: FixedAmountPromotionType }\ntype FlexPromotionRel = ResourceRel & { type: FlexPromotionType }\ntype CouponRel = ResourceRel & { type: CouponType }\n\n\nexport type CouponCodesPromotionRuleSort = Pick<CouponCodesPromotionRule, 'id'> & ResourceSort\n// export type CouponCodesPromotionRuleFilter = Pick<CouponCodesPromotionRule, 'id'> & ResourceFilter\n\n\ninterface CouponCodesPromotionRule extends Resource {\n\t\n\treadonly type: CouponCodesPromotionRuleType\n\n\n\tpromotion?: PercentageDiscountPromotion | FreeShippingPromotion | BuyXPayYPromotion | FreeGiftPromotion | FixedPricePromotion | ExternalPromotion | FixedAmountPromotion | FlexPromotion | null\n\tversions?: Version[] | null\n\tevent_stores?: EventStore[] | null\n\tcoupons?: Coupon[] | null\n\n}\n\n\ninterface CouponCodesPromotionRuleCreate extends ResourceCreate {\n\t\n\tpromotion: PercentageDiscountPromotionRel | FreeShippingPromotionRel | BuyXPayYPromotionRel | FreeGiftPromotionRel | FixedPricePromotionRel | ExternalPromotionRel | FixedAmountPromotionRel | FlexPromotionRel\n\tcoupons?: CouponRel[] | null\n\n}\n\n\ninterface CouponCodesPromotionRuleUpdate extends ResourceUpdate {\n\t\n\tpromotion?: PercentageDiscountPromotionRel | FreeShippingPromotionRel | BuyXPayYPromotionRel | FreeGiftPromotionRel | FixedPricePromotionRel | ExternalPromotionRel | FixedAmountPromotionRel | FlexPromotionRel | null\n\tcoupons?: CouponRel[] | null\n\n}\n\n\nclass CouponCodesPromotionRules extends ApiResource<CouponCodesPromotionRule> {\n\n\tstatic readonly TYPE: CouponCodesPromotionRuleType = 'coupon_codes_promotion_rules' as const\n\n\tasync create(resource: CouponCodesPromotionRuleCreate, params?: QueryParamsRetrieve<CouponCodesPromotionRule>, options?: ResourcesConfig): Promise<CouponCodesPromotionRule> {\n\t\treturn this.resources.create<CouponCodesPromotionRuleCreate, CouponCodesPromotionRule>({ ...resource, type: CouponCodesPromotionRules.TYPE }, params, options)\n\t}\n\n\tasync update(resource: CouponCodesPromotionRuleUpdate, params?: QueryParamsRetrieve<CouponCodesPromotionRule>, options?: ResourcesConfig): Promise<CouponCodesPromotionRule> {\n\t\treturn this.resources.update<CouponCodesPromotionRuleUpdate, CouponCodesPromotionRule>({ ...resource, type: CouponCodesPromotionRules.TYPE }, params, options)\n\t}\n\n\tasync delete(id: string | ResourceId, options?: ResourcesConfig): Promise<void> {\n\t\tawait this.resources.delete((typeof id === 'string')? { id, type: CouponCodesPromotionRules.TYPE } : id, options)\n\t}\n\n\tasync versions(couponCodesPromotionRuleId: string | CouponCodesPromotionRule, params?: QueryParamsList<Version>, options?: ResourcesConfig): Promise<ListResponse<Version>> {\n\t\tconst _couponCodesPromotionRuleId = (couponCodesPromotionRuleId as CouponCodesPromotionRule).id || couponCodesPromotionRuleId as string\n\t\treturn this.resources.fetch<Version>({ type: 'versions' }, `coupon_codes_promotion_rules/${_couponCodesPromotionRuleId}/versions`, params, options) as unknown as ListResponse<Version>\n\t}\n\n\tasync event_stores(couponCodesPromotionRuleId: string | CouponCodesPromotionRule, params?: QueryParamsList<EventStore>, options?: ResourcesConfig): Promise<ListResponse<EventStore>> {\n\t\tconst _couponCodesPromotionRuleId = (couponCodesPromotionRuleId as CouponCodesPromotionRule).id || couponCodesPromotionRuleId as string\n\t\treturn this.resources.fetch<EventStore>({ type: 'event_stores' }, `coupon_codes_promotion_rules/${_couponCodesPromotionRuleId}/event_stores`, params, options) as unknown as ListResponse<EventStore>\n\t}\n\n\tasync coupons(couponCodesPromotionRuleId: string | CouponCodesPromotionRule, params?: QueryParamsList<Coupon>, options?: ResourcesConfig): Promise<ListResponse<Coupon>> {\n\t\tconst _couponCodesPromotionRuleId = (couponCodesPromotionRuleId as CouponCodesPromotionRule).id || couponCodesPromotionRuleId as string\n\t\treturn this.resources.fetch<Coupon>({ type: 'coupons' }, `coupon_codes_promotion_rules/${_couponCodesPromotionRuleId}/coupons`, params, options) as unknown as ListResponse<Coupon>\n\t}\n\n\n\tisCouponCodesPromotionRule(resource: any): resource is CouponCodesPromotionRule {\n\t\treturn resource.type && (resource.type === CouponCodesPromotionRules.TYPE)\n\t}\n\n\n\trelationship(id: string | ResourceId | null): CouponCodesPromotionRuleRel {\n\t\treturn super.relationshipOneToOne<CouponCodesPromotionRuleRel>(id)\n\t}\n\n\trelationshipToMany(...ids: string[]): CouponCodesPromotionRuleRel[] {\n\t\treturn super.relationshipOneToMany<CouponCodesPromotionRuleRel>(...ids)\n\t}\n\n\n\ttype(): CouponCodesPromotionRuleType {\n\t\treturn CouponCodesPromotionRules.TYPE\n\t}\n\n}\n\n\nconst instance = new CouponCodesPromotionRules()\nexport default instance\n\nexport type { CouponCodesPromotionRules, CouponCodesPromotionRule, CouponCodesPromotionRuleCreate, CouponCodesPromotionRuleUpdate, CouponCodesPromotionRuleType }\n"]}