"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ISSUE_SHOW_PR_MODES = exports.ISSUE_SHOW_COMMENT_MODES = exports.ISSUE_SHOW_VIEWS = void 0;
exports.resolveIssueShowOptions = resolveIssueShowOptions;
exports.ISSUE_SHOW_VIEWS = {
    default: "default",
    followup: "followup",
    full: "full",
};
exports.ISSUE_SHOW_COMMENT_MODES = {
    none: "none",
    postCompletion: "post-completion",
    all: "all",
};
exports.ISSUE_SHOW_PR_MODES = {
    none: "none",
    summary: "summary",
    changes: "changes",
    commits: "commits",
    all: "all",
};
const DEFAULT_RELATED_LIMIT = 20;
function resolveIssueShowOptions(input) {
    const preset = resolvePreset(input.view ?? exports.ISSUE_SHOW_VIEWS.default);
    return {
        issueId: input.issueId,
        format: input.format,
        view: input.view ?? exports.ISSUE_SHOW_VIEWS.default,
        parentsDepth: input.parentsDepth === undefined
            ? preset.parentsDepth
            : input.parentsDepth,
        childrenDepth: input.childrenDepth === undefined
            ? preset.childrenDepth
            : input.childrenDepth,
        relatedLimit: input.relatedLimit === undefined
            ? preset.relatedLimit
            : input.relatedLimit,
        commentsMode: input.commentsMode ?? preset.commentsMode,
        prMode: input.prMode ?? preset.prMode,
    };
}
function resolvePreset(view) {
    switch (view) {
        case exports.ISSUE_SHOW_VIEWS.default:
            return {
                parentsDepth: 1,
                childrenDepth: 1,
                relatedLimit: DEFAULT_RELATED_LIMIT,
                commentsMode: exports.ISSUE_SHOW_COMMENT_MODES.all,
                prMode: exports.ISSUE_SHOW_PR_MODES.summary,
            };
        case exports.ISSUE_SHOW_VIEWS.followup:
            return {
                parentsDepth: null,
                childrenDepth: 1,
                relatedLimit: DEFAULT_RELATED_LIMIT,
                commentsMode: exports.ISSUE_SHOW_COMMENT_MODES.postCompletion,
                prMode: exports.ISSUE_SHOW_PR_MODES.changes,
            };
        case exports.ISSUE_SHOW_VIEWS.full:
            return {
                parentsDepth: null,
                childrenDepth: null,
                relatedLimit: DEFAULT_RELATED_LIMIT,
                commentsMode: exports.ISSUE_SHOW_COMMENT_MODES.all,
                prMode: exports.ISSUE_SHOW_PR_MODES.all,
            };
    }
}
