import { BaseCoreSDK } from "./../mixins/base-core-sdk";
import { getBaseMetadataEntities, getProductV1MetadataEntities, getProductV1Products, getProductWithVariants, getProductWithVariantsFromOfferId, getAllProductsWithVariants, getAllProductsWithNotVoidedVariants, getBundleMetadataEntities } from "./subgraph";
export class MetadataMixin extends BaseCoreSDK {
    /* -------------------------------------------------------------------------- */
    /*                          Metadata related methods                          */
    /* -------------------------------------------------------------------------- */
    /**
     * Stores supported offer metadata via the MetadataStorage instance which was passed in
     * at construction.
     * @param metadata - Offer metadata of type `BASE` or `PRODUCT_V1`.
     * @returns Metadata hash / identifier.
     */
    async storeMetadata(metadata) {
        if (!this._metadataStorage) {
            throw new Error("No metadata storage set");
        }
        return this._metadataStorage.storeMetadata(metadata);
    }
    /**
     * Returns supported offer metadata from passed in `MetadataStorage` instance.
     * @param metadataHashOrUri - Metadata hash or uri that can be handled by the
     * storage instance.
     * @returns Offer metadata.
     */
    async getMetadata(metadataHashOrUri) {
        if (!this._metadataStorage) {
            throw new Error("No metadata storage set");
        }
        return this._metadataStorage.getMetadata(metadataHashOrUri);
    }
    /**
     * Returns `BASE` type offer metadata entities from subgraph.
     * @param queryVars - Optional query variables to skip, order or filter.
     * @returns BaseMetadataEntities from subgraph.
     */
    async getBaseMetadataEntities(queryVars) {
        return getBaseMetadataEntities(this._subgraphUrl, queryVars);
    }
    /**
     * Returns `PRODUCT_V1` type offer metadata entities from subgraph.
     * @param queryVars - Optional query variables to skip, order or filter.
     * @returns ProductV1MetadataEntities from subgraph.
     */
    async getProductV1MetadataEntities(queryVars) {
        return getProductV1MetadataEntities(this._subgraphUrl, queryVars);
    }
    /**
     * Returns `BUNDLE` type offer metadata entities from subgraph.
     * @param queryVars - Optional query variables to skip, order or filter.
     * @returns BundleMetadataEntities from subgraph.
     */
    async getBundleMetadataEntities(queryVars) {
        return getBundleMetadataEntities(this._subgraphUrl, queryVars);
    }
    async getProductV1Products(queryVars) {
        return getProductV1Products(this._subgraphUrl, queryVars);
    }
    async getProductWithVariants(sellerId, productUuid) {
        return getProductWithVariants(this._subgraphUrl, sellerId, productUuid);
    }
    getProductWithVariantsFromOfferId(offerId) {
        return getProductWithVariantsFromOfferId(this._subgraphUrl, offerId);
    }
    getAllProductsWithVariants(queryVars) {
        return getAllProductsWithVariants(this._subgraphUrl, queryVars);
    }
    async getAllProductsWithNotVoidedVariants(queryVars) {
        return getAllProductsWithNotVoidedVariants(this._subgraphUrl, queryVars);
    }
}
//# sourceMappingURL=mixin.js.map