'use server';
import { resolve } from '../../lib/server-container.js';
import { requireFeatureFlag } from '../../lib/feature-flags.js';
export async function configureSupervisor(input) {
    try {
        requireFeatureFlag('collaboration');
        const useCase = resolve('ConfigureSupervisorUseCase');
        const policy = await useCase.execute({
            ...input,
            scopeType: input.scopeType,
        });
        return { ok: true, policy };
    }
    catch (error) {
        const message = error instanceof Error ? error.message : 'Failed to configure supervisor';
        return { ok: false, error: message };
    }
}
export async function getSupervisorPolicy(input) {
    try {
        requireFeatureFlag('collaboration');
        const useCase = resolve('GetSupervisorPolicyUseCase');
        const policy = await useCase.execute(input);
        return { ok: true, policy };
    }
    catch (error) {
        const message = error instanceof Error ? error.message : 'Failed to load supervisor policy';
        return { ok: false, error: message };
    }
}
export async function enableSupervisor(input) {
    try {
        requireFeatureFlag('collaboration');
        const useCase = resolve('EnableSupervisorUseCase');
        const policy = await useCase.execute(input);
        return { ok: true, policy };
    }
    catch (error) {
        const message = error instanceof Error ? error.message : 'Failed to enable supervisor';
        return { ok: false, error: message };
    }
}
export async function disableSupervisor(input) {
    try {
        requireFeatureFlag('collaboration');
        const useCase = resolve('DisableSupervisorUseCase');
        const policy = await useCase.execute(input);
        return { ok: true, policy };
    }
    catch (error) {
        const message = error instanceof Error ? error.message : 'Failed to disable supervisor';
        return { ok: false, error: message };
    }
}
