"use strict";
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.ChangeOrderItemStatusRequests = exports.ChangeOrderItemStatusRequest = exports.COMMAND_MESSAGE_REQUEST_CHANGE_ORDER_ITEM_STATUS = void 0;
const jackson_js_1 = require("jackson-js");
const lodash_1 = __importDefault(require("lodash"));
exports.COMMAND_MESSAGE_REQUEST_CHANGE_ORDER_ITEM_STATUS = "change-order-item-request";
class ChangeOrderItemStatusRequest {
}
__decorate([
    (0, jackson_js_1.JsonProperty)()
], ChangeOrderItemStatusRequest.prototype, "orderId", void 0);
__decorate([
    (0, jackson_js_1.JsonProperty)()
], ChangeOrderItemStatusRequest.prototype, "orderItemId", void 0);
__decorate([
    (0, jackson_js_1.JsonProperty)()
], ChangeOrderItemStatusRequest.prototype, "status", void 0);
__decorate([
    (0, jackson_js_1.JsonProperty)(),
    (0, jackson_js_1.JsonClassType)({ type: () => [Date] })
], ChangeOrderItemStatusRequest.prototype, "date", void 0);
exports.ChangeOrderItemStatusRequest = ChangeOrderItemStatusRequest;
class ChangeOrderItemStatusRequests {
    constructor(tenant) {
        this.tenant = tenant;
        this.requests = [];
    }
    getUniqueOrderIds() {
        return lodash_1.default.chain(this.requests)
            .uniqBy("orderId")
            .map((r) => (r.orderId))
            .value();
    }
    getUniqueOrderItemIds() {
        return lodash_1.default.chain(this.requests)
            .uniqBy("orderItemId")
            .map((r) => (r.orderItemId))
            .value();
    }
}
__decorate([
    (0, jackson_js_1.JsonProperty)()
], ChangeOrderItemStatusRequests.prototype, "tenant", void 0);
__decorate([
    (0, jackson_js_1.JsonProperty)(),
    (0, jackson_js_1.JsonClassType)({ type: () => [Array, [ChangeOrderItemStatusRequest]] })
], ChangeOrderItemStatusRequests.prototype, "requests", void 0);
exports.ChangeOrderItemStatusRequests = ChangeOrderItemStatusRequests;
//# sourceMappingURL=change_order_item_status.js.map