"use strict";
/***********************************************************************************************************************
* This file is auto-generated. If you have an issue, please create a GitHub issue.                                     *
***********************************************************************************************************************/
Object.defineProperty(exports, "__esModule", { value: true });
exports.ProductListing = void 0;
const base_1 = require("../../base");
const types_1 = require("../../../lib/types");
const image_1 = require("./image");
const variant_1 = require("./variant");
class ProductListing extends base_1.Base {
    static async find({ session, product_id }) {
        const result = await this.baseFind({
            session: session,
            urlIds: { "product_id": product_id },
            params: {},
        });
        return result.data ? result.data[0] : null;
    }
    static async delete({ session, product_id }) {
        const response = await this.request({
            http_method: "delete",
            operation: "delete",
            session: session,
            urlIds: { "product_id": product_id },
            params: {},
        });
        return response ? response.body : null;
    }
    static async all({ session, product_ids = null, limit = null, collection_id = null, updated_at_min = null, handle = null, ...otherArgs }) {
        const response = await this.baseFind({
            session: session,
            urlIds: {},
            params: { "product_ids": product_ids, "limit": limit, "collection_id": collection_id, "updated_at_min": updated_at_min, "handle": handle, ...otherArgs },
        });
        return response;
    }
    static async count({ session, ...otherArgs }) {
        const response = await this.request({
            http_method: "get",
            operation: "count",
            session: session,
            urlIds: {},
            params: { ...otherArgs },
            body: {},
            entity: null,
        });
        return response ? response.body : null;
    }
    static async product_ids({ session, limit = null, ...otherArgs }) {
        const response = await this.request({
            http_method: "get",
            operation: "product_ids",
            session: session,
            urlIds: {},
            params: { "limit": limit, ...otherArgs },
            body: {},
            entity: null,
        });
        return response ? response.body : null;
    }
}
exports.ProductListing = ProductListing;
ProductListing.apiVersion = types_1.ApiVersion.October23;
ProductListing.hasOne = {};
ProductListing.hasMany = {
    "images": image_1.Image,
    "variants": variant_1.Variant
};
ProductListing.paths = [
    { "http_method": "delete", "operation": "delete", "ids": ["product_id"], "path": "product_listings/<product_id>.json" },
    { "http_method": "get", "operation": "count", "ids": [], "path": "product_listings/count.json" },
    { "http_method": "get", "operation": "get", "ids": [], "path": "product_listings.json" },
    { "http_method": "get", "operation": "get", "ids": ["product_id"], "path": "product_listings/<product_id>.json" },
    { "http_method": "get", "operation": "product_ids", "ids": [], "path": "product_listings/product_ids.json" },
    { "http_method": "put", "operation": "put", "ids": ["product_id"], "path": "product_listings/<product_id>.json" }
];
ProductListing.primaryKey = "product_id";
ProductListing.resourceNames = [
    {
        "singular": "product_listing",
        "plural": "product_listings"
    }
];
//# sourceMappingURL=product_listing.js.map