"use strict";
/***********************************************************************************************************************
* This file is auto-generated. If you have an issue, please create a GitHub issue.                                     *
***********************************************************************************************************************/
Object.defineProperty(exports, "__esModule", { value: true });
exports.DiscountCode = void 0;
const base_1 = require("../../base");
const types_1 = require("../../../lib/types");
class DiscountCode extends base_1.Base {
    static async find({ session, id, price_rule_id = null }) {
        const result = await this.baseFind({
            session: session,
            urlIds: { "id": id, "price_rule_id": price_rule_id },
            params: {},
        });
        return result.data ? result.data[0] : null;
    }
    static async delete({ session, id, price_rule_id = null }) {
        const response = await this.request({
            http_method: "delete",
            operation: "delete",
            session: session,
            urlIds: { "id": id, "price_rule_id": price_rule_id },
            params: {},
        });
        return response ? response.body : null;
    }
    static async all({ session, price_rule_id = null, batch_id = null, ...otherArgs }) {
        const response = await this.baseFind({
            session: session,
            urlIds: { "price_rule_id": price_rule_id, "batch_id": batch_id },
            params: { ...otherArgs },
        });
        return response;
    }
    static async count({ session, times_used = null, times_used_min = null, times_used_max = null, ...otherArgs }) {
        const response = await this.request({
            http_method: "get",
            operation: "count",
            session: session,
            urlIds: {},
            params: { "times_used": times_used, "times_used_min": times_used_min, "times_used_max": times_used_max, ...otherArgs },
            body: {},
            entity: null,
        });
        return response ? response.body : null;
    }
    static async get_all({ session, price_rule_id = null, batch_id = null, ...otherArgs }) {
        const response = await this.request({
            http_method: "get",
            operation: "get_all",
            session: session,
            urlIds: { "price_rule_id": price_rule_id, "batch_id": batch_id },
            params: { ...otherArgs },
            body: {},
            entity: null,
        });
        return response ? response.body : null;
    }
    static async lookup({ session, code = null, ...otherArgs }) {
        const response = await this.request({
            http_method: "get",
            operation: "lookup",
            session: session,
            urlIds: {},
            params: { "code": code, ...otherArgs },
            body: {},
            entity: null,
        });
        return response ? response.body : null;
    }
    async batch({ body = null, ...otherArgs }) {
        const response = await this.request({
            http_method: "post",
            operation: "batch",
            session: this.session,
            urlIds: { "price_rule_id": this.price_rule_id },
            params: { ...otherArgs },
            body: body,
            entity: this,
        });
        return response ? response.body : null;
    }
}
exports.DiscountCode = DiscountCode;
DiscountCode.apiVersion = types_1.ApiVersion.April23;
DiscountCode.hasOne = {};
DiscountCode.hasMany = {};
DiscountCode.paths = [
    { "http_method": "delete", "operation": "delete", "ids": ["price_rule_id", "id"], "path": "price_rules/<price_rule_id>/discount_codes/<id>.json" },
    { "http_method": "get", "operation": "count", "ids": [], "path": "discount_codes/count.json" },
    { "http_method": "get", "operation": "get", "ids": ["price_rule_id", "batch_id"], "path": "price_rules/<price_rule_id>/batch/<batch_id>/discount_codes.json" },
    { "http_method": "get", "operation": "get", "ids": ["price_rule_id"], "path": "price_rules/<price_rule_id>/discount_codes.json" },
    { "http_method": "get", "operation": "get", "ids": ["price_rule_id", "id"], "path": "price_rules/<price_rule_id>/discount_codes/<id>.json" },
    { "http_method": "get", "operation": "get_all", "ids": ["price_rule_id", "batch_id"], "path": "price_rules/<price_rule_id>/batch/<batch_id>.json" },
    { "http_method": "get", "operation": "lookup", "ids": [], "path": "discount_codes/lookup.json" },
    { "http_method": "post", "operation": "batch", "ids": ["price_rule_id"], "path": "price_rules/<price_rule_id>/batch.json" },
    { "http_method": "post", "operation": "post", "ids": ["price_rule_id"], "path": "price_rules/<price_rule_id>/discount_codes.json" },
    { "http_method": "put", "operation": "put", "ids": ["price_rule_id", "id"], "path": "price_rules/<price_rule_id>/discount_codes/<id>.json" }
];
DiscountCode.resourceNames = [
    {
        "singular": "discount_code",
        "plural": "discount_codes"
    }
];
//# sourceMappingURL=discount_code.js.map