import { CreationOptional, DataTypes, InferAttributes, InferCreationAttributes, FindOptions } from 'sequelize'; import type { LiteralUnion } from 'type-fest'; import { TenantModel } from '../tenant-model'; import type { NFTConfig, Restrictions, VCConfig, VerificationType } from './types'; import type { TPaymentCurrency } from './payment-currency'; export declare class PromotionCode extends TenantModel, InferCreationAttributes> { id: CreationOptional; livemode: boolean; instance_did?: string; active: boolean; locked: CreationOptional; code: string; description?: string; coupon_id: string; max_redemptions?: number; restrictions?: Restrictions; customer_id?: string; times_redeemed?: number; expires_at?: number; created_at: CreationOptional; updated_at: CreationOptional; verification_type?: VerificationType; nft_config?: NFTConfig; vc_config?: VCConfig; customer_dids?: string[]; metadata?: Record; created_via: LiteralUnion<'api' | 'dashboard' | 'portal', string>; static readonly GENESIS_ATTRIBUTES: { id: { type: DataTypes.StringDataType; primaryKey: boolean; allowNull: boolean; defaultValue: (size?: number) => string; }; livemode: { type: DataTypes.AbstractDataTypeConstructor; allowNull: boolean; }; locked: { type: DataTypes.AbstractDataTypeConstructor; defaultValue: boolean; }; active: { type: DataTypes.AbstractDataTypeConstructor; defaultValue: boolean; }; code: { type: DataTypes.StringDataType; allowNull: boolean; }; description: { type: DataTypes.TextDataTypeConstructor; allowNull: boolean; }; coupon_id: { type: DataTypes.StringDataType; allowNull: boolean; }; max_redemptions: { type: DataTypes.IntegerDataTypeConstructor; allowNull: boolean; }; restrictions: { type: DataTypes.AbstractDataTypeConstructor; defaultValue: {}; }; customer_id: { type: DataTypes.StringDataType; allowNull: boolean; }; times_redeemed: { type: DataTypes.IntegerDataTypeConstructor; defaultValue: number; }; metadata: { type: DataTypes.AbstractDataTypeConstructor; allowNull: boolean; }; created_via: { type: DataTypes.EnumDataType<"api" | "dashboard" | "portal">; }; expires_at: { type: DataTypes.IntegerDataTypeConstructor; allowNull: boolean; }; created_at: { type: DataTypes.DateDataTypeConstructor; defaultValue: DataTypes.AbstractDataTypeConstructor; allowNull: boolean; }; updated_at: { type: DataTypes.DateDataTypeConstructor; defaultValue: DataTypes.AbstractDataTypeConstructor; allowNull: boolean; }; }; static initialize(sequelize: any): void; static associate(models: any): void; static formatBeforeSave(promotionCode: Partial): Partial>; /** * Find promotion code by multiple criteria: * - id: promotion code ID * - code: promotion code string * - nft_address: NFT contract address (when verification_type is 'nft') * - vc_role: VC role (when verification_type is 'vc') * - userDid: user DID (when verification_type is 'user_restricted') */ static findByMultipleCriteria(searchValue: string, options?: FindOptions, verificationType?: VerificationType | null): Promise; /** * Find promotion code by specific criteria type */ static findByCode(code: string, options?: FindOptions): Promise; static findByNftAddress(nftAddress: string, options?: FindOptions): Promise; static findByVcRole(vcRole: string, options?: FindOptions): Promise; static findByUserDid(userDid: string, options?: FindOptions): Promise; /** * Check if promotion code is being used */ isUsed(): Promise; /** * Check if promotion code is valid for use */ isValid(): { valid: boolean; reason: string; } | { valid: boolean; reason?: undefined; }; /** * Insert promotion code with formatting */ static insert(promotionCode: Partial): Promise; /** * Format restrictions currency options for storage - convert unit amounts to token amounts */ static formatRestrictionsCurrencyOptions(restrictions: Restrictions | undefined, currencies: TPaymentCurrency[]): Restrictions | undefined; } export type TPromotionCode = InferAttributes;