import { ApiResourceVisibility } from "@stigmer/protos/ai/stigmer/commons/apiresource/enum_pb";
const PRIVATE_OPTION = {
    value: ApiResourceVisibility.visibility_private,
    label: "Private",
    description: "Only you can access",
    tone: "private",
};
const ORG_OPTION = {
    value: ApiResourceVisibility.visibility_org,
    label: "Organization",
    description: "All members of your organization",
    confirmPrompt: "Make visible to all org members?",
    tone: "org",
};
const PLATFORM_OPTION = {
    value: ApiResourceVisibility.visibility_platform,
    label: "Platform",
    description: "All organizations managed by your platform",
    confirmDialog: {
        title: "Share with your whole platform?",
        description: "Every organization managed by your platform will be able to view and use this resource. You can return it to a narrower visibility at any time.",
    },
    tone: "platform",
};
const PUBLIC_OPTION = {
    value: ApiResourceVisibility.visibility_public,
    label: "Public",
    description: "Anyone on Stigmer",
    confirmDialog: {
        title: "Make this public?",
        description: "Anyone signed in to Stigmer will be able to view and use this resource. You can return it to a narrower visibility at any time.",
    },
    tone: "public",
};
/**
 * The levels a blueprint (agent, skill, workflow, mcp_server) selector
 * offers, in escalation order.
 *
 * Cloud: Private / Organization [/ Platform] / Public — Organization is the
 * creation default (blueprints are shared org assets; Private is an explicit
 * opt-in). Local: Private / Public.
 */
export function blueprintVisibilityLevels(context) {
    if (context.deploymentMode === "local") {
        return [PRIVATE_OPTION, PUBLIC_OPTION];
    }
    return context.hasIdentityProvider
        ? [PRIVATE_OPTION, ORG_OPTION, PLATFORM_OPTION, PUBLIC_OPTION]
        : [PRIVATE_OPTION, ORG_OPTION, PUBLIC_OPTION];
}
/**
 * The levels an instance (agent_instance, workflow_instance) selector
 * offers, in escalation order: Private / Organization / Public.
 *
 * Platform is deliberately absent — instances are tenant-isolated by
 * design (each managed org instantiates shared blueprints inside its own
 * boundary). Descriptions are execution-oriented because org visibility on
 * an instance is about who can run it and see its executions.
 */
export const INSTANCE_VISIBILITY_LEVELS = [
    PRIVATE_OPTION,
    {
        ...ORG_OPTION,
        description: "All org members can view executions",
    },
    {
        ...PUBLIC_OPTION,
        description: "All authenticated users can view",
    },
];
/**
 * Canonical option for a visibility value, independent of any kind's offered
 * list. Used to render the current level even when it is not offerable in
 * the current context (e.g. a platform-shared blueprint whose org no longer
 * operates an IdentityProvider) — the state must stay legible.
 */
export function visibilityOption(visibility) {
    switch (visibility) {
        case ApiResourceVisibility.visibility_org:
            return ORG_OPTION;
        case ApiResourceVisibility.visibility_platform:
            return PLATFORM_OPTION;
        case ApiResourceVisibility.visibility_public:
            return PUBLIC_OPTION;
        default:
            return PRIVATE_OPTION;
    }
}
/**
 * Human label for a visibility value — the one place list rows, badges, and
 * detail panels resolve enum-to-text, so no surface ever falls through to
 * "Private" (or "unknown") for org/platform.
 */
export function visibilityLabel(visibility) {
    return visibilityOption(visibility).label;
}
//# sourceMappingURL=visibilityLevels.js.map