"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
    if (k2 === undefined) k2 = k;
    Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (function(o, m, k, k2) {
    if (k2 === undefined) k2 = k;
    o[k2] = m[k];
}));
var __exportStar = (this && this.__exportStar) || function(m, exports) {
    for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
};
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.aPagingMetadata = exports.aQueryEventsResponse = exports.aPaging = exports.aSortOrder = exports.aSorting = exports.aQuery = exports.aQueryEventsRequest = exports.aEventCounts = exports.aEventsSummary = exports.aListEventsSummaryResponse = exports.aSummaryFilter = exports.aListEventsSummaryRequest = exports.aReportEventResponse = exports.aReportEventRequest = exports.aPlatformEnum = exports.aCTAClickPayload = exports.aAgentOfferStatusEnum = exports.aAgentMarkedPayload = exports.aEventType = exports.aOfferEvent = void 0;
var metro_common_builders_1 = require("@wix/metro-common-builders");
var types_impl_1 = require("./types.impl");
// @ts-ignore
var callsite_1 = __importDefault(require("callsite"));
function aOfferEvent(overrideObject) {
    if (overrideObject === void 0) { overrideObject = {}; }
    if (isCurrentBuilderWasPreviouslyCalled()) {
        return {};
    }
    return (0, metro_common_builders_1.mergeDeep)({
        agentMark: aAgentMarkedPayload(),
        offerId: (0, metro_common_builders_1.someString)({
            validations: [{ type: 'FORMAT', value: 'GUID' }],
        }),
        userId: (0, metro_common_builders_1.someString)({
            validations: [{ type: 'FORMAT', value: 'GUID' }],
        }),
        targetAccountId: (0, metro_common_builders_1.someString)({
            validations: [{ type: 'FORMAT', value: 'GUID' }],
        }),
        loggedInAccountId: (0, metro_common_builders_1.someString)({
            validations: [{ type: 'FORMAT', value: 'GUID' }],
        }),
        siteId: (0, metro_common_builders_1.someString)({
            validations: [{ type: 'FORMAT', value: 'GUID' }],
        }),
        eventId: (0, metro_common_builders_1.someString)({
            validations: [
                { type: 'FORMAT', value: 'GUID' },
                { type: 'READ_ONLY', value: 'true' },
            ],
        }),
        createdAt: (0, metro_common_builders_1.someDate)({
            validations: [{ type: 'READ_ONLY', value: 'true' }],
        }),
        type: aEventType(),
        realEstateId: (0, metro_common_builders_1.someString)(),
        httpReferrer: (0, metro_common_builders_1.someString)(),
        assetId: (0, metro_common_builders_1.someString)({
            validations: [{ type: 'FORMAT', value: 'GUID' }],
        }),
        platform: aPlatformEnum(),
    }, overrideObject);
}
exports.aOfferEvent = aOfferEvent;
function aEventType(enumFirstItem) {
    if (enumFirstItem === void 0) { enumFirstItem = types_impl_1.EventType.UNKNOWN; }
    return enumFirstItem;
}
exports.aEventType = aEventType;
function aAgentMarkedPayload(overrideObject) {
    if (overrideObject === void 0) { overrideObject = {}; }
    if (isCurrentBuilderWasPreviouslyCalled()) {
        return {};
    }
    return (0, metro_common_builders_1.mergeDeep)({
        agentId: (0, metro_common_builders_1.someString)({
            validations: [{ type: 'FORMAT', value: 'GUID' }],
        }),
        status: aAgentOfferStatusEnum(),
    }, overrideObject);
}
exports.aAgentMarkedPayload = aAgentMarkedPayload;
function aAgentOfferStatusEnum(enumFirstItem) {
    if (enumFirstItem === void 0) { enumFirstItem = types_impl_1.AgentOfferStatusEnum.NOT_STARTED; }
    return enumFirstItem;
}
exports.aAgentOfferStatusEnum = aAgentOfferStatusEnum;
function aCTAClickPayload(overrideObject) {
    if (overrideObject === void 0) { overrideObject = {}; }
    return (0, metro_common_builders_1.mergeDeep)({
        targetUrl: (0, metro_common_builders_1.someString)(),
    }, overrideObject);
}
exports.aCTAClickPayload = aCTAClickPayload;
function aPlatformEnum(enumFirstItem) {
    if (enumFirstItem === void 0) { enumFirstItem = types_impl_1.PlatformEnum.UNKNOWN; }
    return enumFirstItem;
}
exports.aPlatformEnum = aPlatformEnum;
function aReportEventRequest(overrideObject) {
    if (overrideObject === void 0) { overrideObject = {}; }
    if (isCurrentBuilderWasPreviouslyCalled()) {
        return {};
    }
    return (0, metro_common_builders_1.mergeDeep)({
        event: aOfferEvent(),
        deviantArtUserId: (0, metro_common_builders_1.someString)({
            validations: [{ type: 'MAX_LENGTH', value: '4096' }],
        }),
    }, overrideObject);
}
exports.aReportEventRequest = aReportEventRequest;
function aReportEventResponse(overrideObject) {
    if (overrideObject === void 0) { overrideObject = {}; }
    return (0, metro_common_builders_1.mergeDeep)({}, overrideObject);
}
exports.aReportEventResponse = aReportEventResponse;
function aListEventsSummaryRequest(overrideObject) {
    if (overrideObject === void 0) { overrideObject = {}; }
    if (isCurrentBuilderWasPreviouslyCalled()) {
        return {};
    }
    return (0, metro_common_builders_1.mergeDeep)({
        offerIds: [
            (0, metro_common_builders_1.someString)({
                validations: [{ type: 'FORMAT', value: 'GUID' }],
            }),
        ],
        campaignIds: [
            (0, metro_common_builders_1.someString)({
                validations: [{ type: 'FORMAT', value: 'GUID' }],
            }),
        ],
        summaryFilter: aSummaryFilter(),
    }, overrideObject);
}
exports.aListEventsSummaryRequest = aListEventsSummaryRequest;
function aSummaryFilter(overrideObject) {
    if (overrideObject === void 0) { overrideObject = {}; }
    return (0, metro_common_builders_1.mergeDeep)({
        userId: (0, metro_common_builders_1.someString)({
            validations: [{ type: 'FORMAT', value: 'GUID' }],
        }),
        targetAccountId: (0, metro_common_builders_1.someString)({
            validations: [{ type: 'FORMAT', value: 'GUID' }],
        }),
        siteId: (0, metro_common_builders_1.someString)({
            validations: [{ type: 'FORMAT', value: 'GUID' }],
        }),
        placementId: (0, metro_common_builders_1.someString)({
            validations: [{ type: 'FORMAT', value: 'GUID' }],
        }),
        fieldMask: (0, metro_common_builders_1.someRepeated)(),
    }, overrideObject);
}
exports.aSummaryFilter = aSummaryFilter;
function aListEventsSummaryResponse(overrideObject) {
    if (overrideObject === void 0) { overrideObject = {}; }
    if (isCurrentBuilderWasPreviouslyCalled()) {
        return {};
    }
    return (0, metro_common_builders_1.mergeDeep)({
        eventsSummary: [aEventsSummary()],
        campaignEventsSummary: [aEventsSummary()],
    }, overrideObject);
}
exports.aListEventsSummaryResponse = aListEventsSummaryResponse;
function aEventsSummary(overrideObject) {
    if (overrideObject === void 0) { overrideObject = {}; }
    if (isCurrentBuilderWasPreviouslyCalled()) {
        return {};
    }
    return (0, metro_common_builders_1.mergeDeep)({
        offerId: (0, metro_common_builders_1.someString)({
            validations: [{ type: 'FORMAT', value: 'GUID' }],
        }),
        campaignId: (0, metro_common_builders_1.someString)({
            validations: [{ type: 'FORMAT', value: 'GUID' }],
        }),
        lastEvent: { lastEvent: aOfferEvent() },
        eventsCount: { eventsCount: aEventCounts() },
    }, overrideObject);
}
exports.aEventsSummary = aEventsSummary;
function aEventCounts(overrideObject) {
    if (overrideObject === void 0) { overrideObject = {}; }
    return (0, metro_common_builders_1.mergeDeep)({
        totalCount: (0, metro_common_builders_1.someNumber)(),
    }, overrideObject);
}
exports.aEventCounts = aEventCounts;
function aQueryEventsRequest(overrideObject) {
    if (overrideObject === void 0) { overrideObject = {}; }
    if (isCurrentBuilderWasPreviouslyCalled()) {
        return {};
    }
    return (0, metro_common_builders_1.mergeDeep)({
        query: aQuery(),
    }, overrideObject);
}
exports.aQueryEventsRequest = aQueryEventsRequest;
function aQuery(overrideObject) {
    if (overrideObject === void 0) { overrideObject = {}; }
    if (isCurrentBuilderWasPreviouslyCalled()) {
        return {};
    }
    return (0, metro_common_builders_1.mergeDeep)({
        filter: {},
        sort: [aSorting()],
        paging: aPaging(),
        fields: [(0, metro_common_builders_1.someString)()],
        fieldsets: [(0, metro_common_builders_1.someString)()],
    }, overrideObject);
}
exports.aQuery = aQuery;
function aSorting(overrideObject) {
    if (overrideObject === void 0) { overrideObject = {}; }
    if (isCurrentBuilderWasPreviouslyCalled()) {
        return {};
    }
    return (0, metro_common_builders_1.mergeDeep)({
        fieldName: (0, metro_common_builders_1.someString)({
            validations: [{ type: 'MAX_LENGTH', value: '512' }],
        }),
        order: aSortOrder(),
        selectItemsBy: [{}, {}, {}, {}, {}, {}, {}, {}, {}, {}],
    }, overrideObject);
}
exports.aSorting = aSorting;
function aSortOrder(enumFirstItem) {
    if (enumFirstItem === void 0) { enumFirstItem = types_impl_1.SortOrder.ASC; }
    return enumFirstItem;
}
exports.aSortOrder = aSortOrder;
function aPaging(overrideObject) {
    if (overrideObject === void 0) { overrideObject = {}; }
    return (0, metro_common_builders_1.mergeDeep)({
        limit: (0, metro_common_builders_1.someNumber)({
            validations: [{ type: 'MIN' }],
        }),
        offset: (0, metro_common_builders_1.someNumber)({
            validations: [{ type: 'MIN' }],
        }),
    }, overrideObject);
}
exports.aPaging = aPaging;
function aQueryEventsResponse(overrideObject) {
    if (overrideObject === void 0) { overrideObject = {}; }
    if (isCurrentBuilderWasPreviouslyCalled()) {
        return {};
    }
    return (0, metro_common_builders_1.mergeDeep)({
        events: [aOfferEvent()],
        pagingMetadata: aPagingMetadata(),
    }, overrideObject);
}
exports.aQueryEventsResponse = aQueryEventsResponse;
function aPagingMetadata(overrideObject) {
    if (overrideObject === void 0) { overrideObject = {}; }
    return (0, metro_common_builders_1.mergeDeep)({
        count: (0, metro_common_builders_1.someNumber)(),
        offset: (0, metro_common_builders_1.someNumber)(),
        total: (0, metro_common_builders_1.someNumber)(),
        tooManyToCount: true,
        hasNext: true,
    }, overrideObject);
}
exports.aPagingMetadata = aPagingMetadata;
function isCurrentBuilderWasPreviouslyCalled() {
    var callChainFunctionNames = (0, callsite_1.default)().map(function (item) {
        return item.getFunctionName();
    });
    var callChainWithoutCurrentBuilder = callChainFunctionNames.splice(2);
    var currentBuilderName = callChainFunctionNames[1];
    return callChainWithoutCurrentBuilder.some(function (functionName) { return functionName === currentBuilderName; });
}
__exportStar(require("@wix/metro-common-builders"), exports);
//# sourceMappingURL=builders.impl.js.map