"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.settings = exports.devUserSelfResponse = exports.timelineEntriesCreateResponse = exports.accountCreateResponse = exports.revUserUpdateTagsResponse = exports.revUsersCreateResponse = exports.revUsersSingleList = exports.revUsersListResponse = exports.revorgsListResponse = exports.accountsListResponse = exports.tagsResponse = exports.testRevUserOlder = exports.testRevUserNewer = exports.testRevOrgNotDefaultOlder = exports.testRevOrgDefaultNewer = exports.testAccountDomain = exports.testTag = exports.testDisplayName = exports.assignTo = exports.partId = exports.event = exports.testEventPayload = exports.testContext = exports.testAnonymousId = exports.testMessageId = exports.testEventName = exports.testDescription = exports.testUserFullName = exports.testWorkspaceRef = exports.testAccountRef = exports.testUserRef = exports.testUserId = exports.domain = exports.email = exports.olderCreateDate = exports.newerCreateDate = exports.accountName = exports.accountId = void 0;
const actions_core_1 = require("@segment/actions-core");
exports.accountId = 'test-account-id';
exports.accountName = 'test-account-name';
exports.newerCreateDate = '2023-06-02T09:17:21.681Z';
exports.olderCreateDate = '2023-04-05T20:14:54.646Z';
exports.email = 'test-user@test.com';
exports.domain = exports.email.split('@')[1];
exports.testUserId = 'test-user-id';
exports.testUserRef = 'test-user-ref';
exports.testAccountRef = 'test-account-ref';
exports.testWorkspaceRef = 'test-workspace-ref';
exports.testUserFullName = 'test-user-full-name';
exports.testDescription = 'test-description';
exports.testEventName = 'test-event-name';
exports.testMessageId = 'test-message-id';
exports.testAnonymousId = 'test-anonymous-id';
exports.testContext = {
    userAgent: 'Mozilla/5.0 (iPhone; CPU iPhone OS 9_1 like Mac OS X) AppleWebKit/601.1.46 (KHTML, like Gecko) Version/9.0 Mobile/13B143 Safari/601.1'
};
exports.testEventPayload = {
    type: 'track',
    userId: exports.testUserId,
    event: exports.testEventName,
    timestamp: exports.newerCreateDate,
    properties: {
        description: exports.testDescription,
        email: exports.email,
        name: exports.testUserFullName
    }
};
exports.event = (0, actions_core_1.createTestEvent)(exports.testEventPayload);
exports.partId = 'test-part-id';
exports.assignTo = 'test-devuser-id';
exports.testDisplayName = 'test-user';
exports.testTag = {
    id: 'test-tag-id',
    name: 'test-tag-name'
};
exports.testAccountDomain = {
    id: exports.accountId,
    display_name: exports.accountName,
    domains: [exports.domain],
    state: 'active'
};
exports.testRevOrgDefaultNewer = {
    id: 'newer-but-default-revo',
    account: exports.testAccountDomain,
    created_date: exports.newerCreateDate,
    display_name: 'newer but default revo',
    external_ref_issuer: 'devrev:platform:revorg:account',
    state: 'active'
};
exports.testRevOrgNotDefaultOlder = {
    id: 'older-but-not-default-revo',
    account: exports.testAccountDomain,
    created_date: exports.olderCreateDate,
    display_name: 'older but not default revo',
    external_ref_issuer: 'devrev:platform',
    state: 'active'
};
exports.testRevUserNewer = {
    id: 'rev-user-newer',
    created_date: exports.newerCreateDate,
    display_name: exports.testUserFullName,
    email: exports.email,
    rev_org: exports.testRevOrgDefaultNewer
};
exports.testRevUserOlder = {
    id: 'rev-user-older',
    display_name: exports.testUserFullName,
    email: exports.email,
    rev_org: exports.testRevOrgNotDefaultOlder,
    created_date: exports.olderCreateDate
};
exports.tagsResponse = {
    data: {
        next_cursor: '',
        tags: [exports.testTag]
    }
};
exports.accountsListResponse = {
    data: {
        next_cursor: '',
        accounts: [exports.testAccountDomain]
    }
};
exports.revorgsListResponse = {
    data: {
        rev_orgs: [exports.testRevOrgDefaultNewer, exports.testRevOrgNotDefaultOlder]
    }
};
exports.revUsersListResponse = {
    data: {
        rev_users: [exports.testRevUserNewer, exports.testRevUserOlder]
    }
};
exports.revUsersSingleList = {
    data: {
        rev_users: [exports.testRevUserNewer]
    }
};
const revUsersCreateResponse = async (_, body) => {
    const resp = {
        rev_user: {
            id: exports.testRevUserNewer.id,
            created_date: exports.newerCreateDate,
            display_name: body.display_name,
            email: body.email
        }
    };
    if (body.org_id)
        resp.rev_user.rev_org = {
            id: body.org_id,
            display_name: 'test-org'
        };
    if (body.tags) {
        resp.rev_user.tags = body.tags.map((tag) => {
            return { tag };
        });
    }
    return resp;
};
exports.revUsersCreateResponse = revUsersCreateResponse;
const revUserUpdateTagsResponse = async (_, body) => {
    return {
        rev_user: {
            id: body.id,
            tags: body.tags.map((tagid) => {
                return { tag: tagid };
            })
        }
    };
};
exports.revUserUpdateTagsResponse = revUserUpdateTagsResponse;
const accountCreateResponse = async (_, body) => {
    return {
        account: {
            id: exports.accountId,
            created_date: exports.newerCreateDate,
            display_name: body.display_name,
            domains: body.domains,
            tags: body.tags,
            state: 'active',
            external_refs: body.external_refs
        }
    };
};
exports.accountCreateResponse = accountCreateResponse;
exports.timelineEntriesCreateResponse = {
    data: {
        timeline_entry: {
            id: 'test-timeline-entry-id'
        }
    }
};
exports.devUserSelfResponse = {
    data: {
        dev_user: {
            id: 'test-dev-user-id'
        }
    }
};
exports.settings = {
    apiKey: 'blank',
    blacklistedDomains: ''
};
//# sourceMappingURL=index.js.map