function deepMerge(target, source) {
    const result = { ...target };
    for (const key in source) {
        const sourceValue = source[key];
        const targetValue = target[key];
        if (sourceValue !== undefined &&
            typeof sourceValue === 'object' &&
            sourceValue !== null &&
            !Array.isArray(sourceValue) &&
            typeof targetValue === 'object' &&
            targetValue !== null &&
            !Array.isArray(targetValue)) {
            result[key] = deepMerge(targetValue, sourceValue);
        }
        else if (sourceValue !== undefined) {
            result[key] = sourceValue;
        }
    }
    return result;
}
export class GitHubEventFactory {
    static createPullRequestEvent(overrides) {
        const base = {
            action: 'opened',
            number: 123,
            pull_request: {
                number: 123,
                title: 'Test PR',
                body: 'Test description',
                state: 'open',
                draft: false,
                html_url: 'https://github.com/test-owner/test-repo/pull/123',
                head: {
                    ref: 'feature/test',
                },
                base: {
                    ref: 'main',
                },
                requested_reviewers: [],
                assignees: [],
            },
            repository: {
                full_name: 'test-owner/test-repo',
                html_url: 'https://github.com/test-owner/test-repo',
                clone_url: 'https://github.com/test-owner/test-repo.git',
            },
            sender: {
                login: 'developer',
            },
        };
        return overrides ? deepMerge(base, overrides) : base;
    }
    static createReviewRequestedPr(reviewerLogin) {
        return this.createPullRequestEvent({
            action: 'review_requested',
            requested_reviewer: {
                login: reviewerLogin,
            },
            pull_request: {
                requested_reviewers: [{ login: reviewerLogin }],
            },
        });
    }
    static createDraftPr() {
        return this.createPullRequestEvent({
            pull_request: {
                draft: true,
            },
        });
    }
    static createClosedPr() {
        return this.createPullRequestEvent({
            action: 'closed',
            pull_request: {
                state: 'closed',
            },
        });
    }
    static createMergedPr() {
        return this.createPullRequestEvent({
            action: 'closed',
            pull_request: {
                state: 'closed',
            },
        });
    }
    static createLabeledPr(labelName) {
        const event = this.createPullRequestEvent({ action: 'labeled' });
        event.label = { name: labelName };
        return event;
    }
    static createSynchronizePr() {
        return this.createPullRequestEvent({
            action: 'synchronize',
            pull_request: {
                state: 'open',
                draft: false,
            },
        });
    }
}
//# sourceMappingURL=gitHubEvent.factory.js.map