import { mergeDeep, someNumber, someString, someRepeated, someDate, } from '@wix/metro-common-builders';
import { SortOrder, AgentOfferStatusEnum, EventType, PlatformEnum, } from './types.impl';
// @ts-ignore
import stack from 'callsite';
export function aOfferEvent(overrideObject) {
    if (overrideObject === void 0) { overrideObject = {}; }
    if (isCurrentBuilderWasPreviouslyCalled()) {
        return {};
    }
    return mergeDeep({
        agentMark: aAgentMarkedPayload(),
        offerId: someString({
            validations: [{ type: 'FORMAT', value: 'GUID' }],
        }),
        userId: someString({
            validations: [{ type: 'FORMAT', value: 'GUID' }],
        }),
        targetAccountId: someString({
            validations: [{ type: 'FORMAT', value: 'GUID' }],
        }),
        loggedInAccountId: someString({
            validations: [{ type: 'FORMAT', value: 'GUID' }],
        }),
        siteId: someString({
            validations: [{ type: 'FORMAT', value: 'GUID' }],
        }),
        eventId: someString({
            validations: [
                { type: 'FORMAT', value: 'GUID' },
                { type: 'READ_ONLY', value: 'true' },
            ],
        }),
        createdAt: someDate({
            validations: [{ type: 'READ_ONLY', value: 'true' }],
        }),
        type: aEventType(),
        realEstateId: someString(),
        httpReferrer: someString(),
        assetId: someString({
            validations: [{ type: 'FORMAT', value: 'GUID' }],
        }),
        platform: aPlatformEnum(),
    }, overrideObject);
}
export function aEventType(enumFirstItem) {
    if (enumFirstItem === void 0) { enumFirstItem = EventType.UNKNOWN; }
    return enumFirstItem;
}
export function aAgentMarkedPayload(overrideObject) {
    if (overrideObject === void 0) { overrideObject = {}; }
    if (isCurrentBuilderWasPreviouslyCalled()) {
        return {};
    }
    return mergeDeep({
        agentId: someString({
            validations: [{ type: 'FORMAT', value: 'GUID' }],
        }),
        status: aAgentOfferStatusEnum(),
    }, overrideObject);
}
export function aAgentOfferStatusEnum(enumFirstItem) {
    if (enumFirstItem === void 0) { enumFirstItem = AgentOfferStatusEnum.NOT_STARTED; }
    return enumFirstItem;
}
export function aCTAClickPayload(overrideObject) {
    if (overrideObject === void 0) { overrideObject = {}; }
    return mergeDeep({
        targetUrl: someString(),
    }, overrideObject);
}
export function aPlatformEnum(enumFirstItem) {
    if (enumFirstItem === void 0) { enumFirstItem = PlatformEnum.UNKNOWN; }
    return enumFirstItem;
}
export function aReportEventRequest(overrideObject) {
    if (overrideObject === void 0) { overrideObject = {}; }
    if (isCurrentBuilderWasPreviouslyCalled()) {
        return {};
    }
    return mergeDeep({
        event: aOfferEvent(),
        deviantArtUserId: someString({
            validations: [{ type: 'MAX_LENGTH', value: '4096' }],
        }),
    }, overrideObject);
}
export function aReportEventResponse(overrideObject) {
    if (overrideObject === void 0) { overrideObject = {}; }
    return mergeDeep({}, overrideObject);
}
export function aListEventsSummaryRequest(overrideObject) {
    if (overrideObject === void 0) { overrideObject = {}; }
    if (isCurrentBuilderWasPreviouslyCalled()) {
        return {};
    }
    return mergeDeep({
        offerIds: [
            someString({
                validations: [{ type: 'FORMAT', value: 'GUID' }],
            }),
        ],
        campaignIds: [
            someString({
                validations: [{ type: 'FORMAT', value: 'GUID' }],
            }),
        ],
        summaryFilter: aSummaryFilter(),
    }, overrideObject);
}
export function aSummaryFilter(overrideObject) {
    if (overrideObject === void 0) { overrideObject = {}; }
    return mergeDeep({
        userId: someString({
            validations: [{ type: 'FORMAT', value: 'GUID' }],
        }),
        targetAccountId: someString({
            validations: [{ type: 'FORMAT', value: 'GUID' }],
        }),
        siteId: someString({
            validations: [{ type: 'FORMAT', value: 'GUID' }],
        }),
        placementId: someString({
            validations: [{ type: 'FORMAT', value: 'GUID' }],
        }),
        fieldMask: someRepeated(),
    }, overrideObject);
}
export function aListEventsSummaryResponse(overrideObject) {
    if (overrideObject === void 0) { overrideObject = {}; }
    if (isCurrentBuilderWasPreviouslyCalled()) {
        return {};
    }
    return mergeDeep({
        eventsSummary: [aEventsSummary()],
        campaignEventsSummary: [aEventsSummary()],
    }, overrideObject);
}
export function aEventsSummary(overrideObject) {
    if (overrideObject === void 0) { overrideObject = {}; }
    if (isCurrentBuilderWasPreviouslyCalled()) {
        return {};
    }
    return mergeDeep({
        offerId: someString({
            validations: [{ type: 'FORMAT', value: 'GUID' }],
        }),
        campaignId: someString({
            validations: [{ type: 'FORMAT', value: 'GUID' }],
        }),
        lastEvent: { lastEvent: aOfferEvent() },
        eventsCount: { eventsCount: aEventCounts() },
    }, overrideObject);
}
export function aEventCounts(overrideObject) {
    if (overrideObject === void 0) { overrideObject = {}; }
    return mergeDeep({
        totalCount: someNumber(),
    }, overrideObject);
}
export function aQueryEventsRequest(overrideObject) {
    if (overrideObject === void 0) { overrideObject = {}; }
    if (isCurrentBuilderWasPreviouslyCalled()) {
        return {};
    }
    return mergeDeep({
        query: aQuery(),
    }, overrideObject);
}
export function aQuery(overrideObject) {
    if (overrideObject === void 0) { overrideObject = {}; }
    if (isCurrentBuilderWasPreviouslyCalled()) {
        return {};
    }
    return mergeDeep({
        filter: {},
        sort: [aSorting()],
        paging: aPaging(),
        fields: [someString()],
        fieldsets: [someString()],
    }, overrideObject);
}
export function aSorting(overrideObject) {
    if (overrideObject === void 0) { overrideObject = {}; }
    if (isCurrentBuilderWasPreviouslyCalled()) {
        return {};
    }
    return mergeDeep({
        fieldName: someString({
            validations: [{ type: 'MAX_LENGTH', value: '512' }],
        }),
        order: aSortOrder(),
        selectItemsBy: [{}, {}, {}, {}, {}, {}, {}, {}, {}, {}],
    }, overrideObject);
}
export function aSortOrder(enumFirstItem) {
    if (enumFirstItem === void 0) { enumFirstItem = SortOrder.ASC; }
    return enumFirstItem;
}
export function aPaging(overrideObject) {
    if (overrideObject === void 0) { overrideObject = {}; }
    return mergeDeep({
        limit: someNumber({
            validations: [{ type: 'MIN' }],
        }),
        offset: someNumber({
            validations: [{ type: 'MIN' }],
        }),
    }, overrideObject);
}
export function aQueryEventsResponse(overrideObject) {
    if (overrideObject === void 0) { overrideObject = {}; }
    if (isCurrentBuilderWasPreviouslyCalled()) {
        return {};
    }
    return mergeDeep({
        events: [aOfferEvent()],
        pagingMetadata: aPagingMetadata(),
    }, overrideObject);
}
export function aPagingMetadata(overrideObject) {
    if (overrideObject === void 0) { overrideObject = {}; }
    return mergeDeep({
        count: someNumber(),
        offset: someNumber(),
        total: someNumber(),
        tooManyToCount: true,
        hasNext: true,
    }, overrideObject);
}
function isCurrentBuilderWasPreviouslyCalled() {
    var callChainFunctionNames = stack().map(function (item) {
        return item.getFunctionName();
    });
    var callChainWithoutCurrentBuilder = callChainFunctionNames.splice(2);
    var currentBuilderName = callChainFunctionNames[1];
    return callChainWithoutCurrentBuilder.some(function (functionName) { return functionName === currentBuilderName; });
}
export * from '@wix/metro-common-builders';
//# sourceMappingURL=builders.impl.js.map