import { computed, ref } from 'vue';
import QueryStateBoundary from '../../../shared/ui/QueryStateBoundary.vue';
import PolicyTracePanel from '../components/PolicyTracePanel.vue';
import { useEvaluateResearchSellPolicy } from '../queries';
const mutation = useEvaluateResearchSellPolicy();
const hardImpairmentApproved = ref(false);
const capitalFloorBreached = ref(false);
const gapBelowFloorAtr = ref(1.6);
const consecutiveCloseBreaches = ref(0);
const lastCommand = ref(null);
const isBusy = computed(() => mutation.isPending.value);
function createCommand() {
    const asOf = new Date().toISOString();
    return {
        idempotencyKey: crypto.randomUUID(),
        request: {
            positionLotId: '00000000-0000-0000-0000-000000000001',
            cycleId: '00000000-0000-0000-0000-000000000002',
            evidenceId: 'sample-evidence',
            datasetId: 'sample-dataset',
            modelVersion: 'research-v12.2',
            configVersion: 'proposal-v12.2',
            codeSha: 'sample-code-sha',
            asOf,
            publishedAtCutoff: asOf,
            currentSecurityPortfolioWeight: 0.6,
            currentLotPortfolioWeight: 0.2,
            strategicCoreFloorWeight: 0.3,
            hardImpairmentApproved: hardImpairmentApproved.value,
            capitalFloorBreached: capitalFloorBreached.value,
            survivalSellRatioOfLot: 0.5,
            gapBelowFloorAtr: gapBelowFloorAtr.value,
            consecutiveCloseBreaches: consecutiveCloseBreaches.value,
            cooldownSatisfied: true,
            concentrationSellRatioOfLot: 0,
            opportunityEdgeLowerBound: 0,
            opportunitySellRatioOfLot: 0
        }
    };
}
function run() {
    const command = createCommand();
    lastCommand.value = command;
    mutation.mutate(command);
}
function retry() {
    if (lastCommand.value)
        mutation.mutate(lastCommand.value);
}
const __VLS_ctx = {
    ...{},
    ...{},
};
let __VLS_components;
let __VLS_intrinsics;
let __VLS_directives;
__VLS_asFunctionalElement1(__VLS_intrinsics.main, __VLS_intrinsics.main)({});
__VLS_asFunctionalElement1(__VLS_intrinsics.header, __VLS_intrinsics.header)({});
__VLS_asFunctionalElement1(__VLS_intrinsics.h1, __VLS_intrinsics.h1)({});
__VLS_asFunctionalElement1(__VLS_intrinsics.p, __VLS_intrinsics.p)({});
__VLS_asFunctionalElement1(__VLS_intrinsics.strong, __VLS_intrinsics.strong)({});
__VLS_asFunctionalElement1(__VLS_intrinsics.form, __VLS_intrinsics.form)({
    ...{ onSubmit: (__VLS_ctx.run) },
});
__VLS_asFunctionalElement1(__VLS_intrinsics.fieldset, __VLS_intrinsics.fieldset)({
    disabled: (__VLS_ctx.isBusy),
});
__VLS_asFunctionalElement1(__VLS_intrinsics.legend, __VLS_intrinsics.legend)({});
__VLS_asFunctionalElement1(__VLS_intrinsics.label, __VLS_intrinsics.label)({});
__VLS_asFunctionalElement1(__VLS_intrinsics.input)({
    type: "checkbox",
});
(__VLS_ctx.hardImpairmentApproved);
__VLS_asFunctionalElement1(__VLS_intrinsics.label, __VLS_intrinsics.label)({});
__VLS_asFunctionalElement1(__VLS_intrinsics.input)({
    type: "checkbox",
});
(__VLS_ctx.capitalFloorBreached);
__VLS_asFunctionalElement1(__VLS_intrinsics.label, __VLS_intrinsics.label)({});
__VLS_asFunctionalElement1(__VLS_intrinsics.input)({
    type: "number",
    min: "0",
    step: "0.1",
});
(__VLS_ctx.gapBelowFloorAtr);
__VLS_asFunctionalElement1(__VLS_intrinsics.label, __VLS_intrinsics.label)({});
__VLS_asFunctionalElement1(__VLS_intrinsics.input)({
    type: "number",
    min: "0",
    step: "1",
});
(__VLS_ctx.consecutiveCloseBreaches);
__VLS_asFunctionalElement1(__VLS_intrinsics.button, __VLS_intrinsics.button)({
    type: "submit",
});
const __VLS_0 = QueryStateBoundary || QueryStateBoundary;
// @ts-ignore
const __VLS_1 = __VLS_asFunctionalComponent1(__VLS_0, new __VLS_0({
    ...{ 'onRetry': {} },
    loading: (__VLS_ctx.isBusy),
    error: __VLS_ctx.mutation.error.value,
    empty: (!__VLS_ctx.mutation.data.value),
}));
const __VLS_2 = __VLS_1({
    ...{ 'onRetry': {} },
    loading: (__VLS_ctx.isBusy),
    error: __VLS_ctx.mutation.error.value,
    empty: (!__VLS_ctx.mutation.data.value),
}, ...__VLS_functionalComponentArgsRest(__VLS_1));
let __VLS_5;
const __VLS_6 = {
    /** @type {typeof __VLS_5.retry} */
    onRetry: (__VLS_ctx.retry),
};
const { default: __VLS_7 } = __VLS_3.slots;
if (__VLS_ctx.mutation.data.value) {
    __VLS_asFunctionalElement1(__VLS_intrinsics.dl, __VLS_intrinsics.dl)({});
    __VLS_asFunctionalElement1(__VLS_intrinsics.dt, __VLS_intrinsics.dt)({});
    __VLS_asFunctionalElement1(__VLS_intrinsics.dd, __VLS_intrinsics.dd)({});
    (__VLS_ctx.mutation.data.value.action);
    __VLS_asFunctionalElement1(__VLS_intrinsics.dt, __VLS_intrinsics.dt)({});
    __VLS_asFunctionalElement1(__VLS_intrinsics.dd, __VLS_intrinsics.dd)({});
    (__VLS_ctx.mutation.data.value.policyId);
    __VLS_asFunctionalElement1(__VLS_intrinsics.dt, __VLS_intrinsics.dt)({});
    __VLS_asFunctionalElement1(__VLS_intrinsics.dd, __VLS_intrinsics.dd)({});
    (__VLS_ctx.mutation.data.value.reasonCode);
    __VLS_asFunctionalElement1(__VLS_intrinsics.dt, __VLS_intrinsics.dt)({});
    __VLS_asFunctionalElement1(__VLS_intrinsics.dd, __VLS_intrinsics.dd)({});
    (__VLS_ctx.mutation.data.value.sellRatioOfLot);
    __VLS_asFunctionalElement1(__VLS_intrinsics.dt, __VLS_intrinsics.dt)({});
    __VLS_asFunctionalElement1(__VLS_intrinsics.dd, __VLS_intrinsics.dd)({});
    (__VLS_ctx.mutation.data.value.targetSecurityPortfolioWeightAfter);
    __VLS_asFunctionalElement1(__VLS_intrinsics.dt, __VLS_intrinsics.dt)({});
    __VLS_asFunctionalElement1(__VLS_intrinsics.dd, __VLS_intrinsics.dd)({});
    (__VLS_ctx.mutation.data.value.reentryEligible);
    __VLS_asFunctionalElement1(__VLS_intrinsics.dt, __VLS_intrinsics.dt)({});
    __VLS_asFunctionalElement1(__VLS_intrinsics.dd, __VLS_intrinsics.dd)({});
    (__VLS_ctx.mutation.data.value.decisionContractVersion);
    __VLS_asFunctionalElement1(__VLS_intrinsics.dt, __VLS_intrinsics.dt)({});
    __VLS_asFunctionalElement1(__VLS_intrinsics.dd, __VLS_intrinsics.dd)({});
    (__VLS_ctx.mutation.data.value.policyTrace.length);
}
if (__VLS_ctx.mutation.data.value) {
    const __VLS_8 = PolicyTracePanel;
    // @ts-ignore
    const __VLS_9 = __VLS_asFunctionalComponent1(__VLS_8, new __VLS_8({
        entries: (__VLS_ctx.mutation.data.value.policyTrace),
        schemaVersion: (__VLS_ctx.mutation.data.value.policyTraceSchemaVersion),
    }));
    const __VLS_10 = __VLS_9({
        entries: (__VLS_ctx.mutation.data.value.policyTrace),
        schemaVersion: (__VLS_ctx.mutation.data.value.policyTraceSchemaVersion),
    }, ...__VLS_functionalComponentArgsRest(__VLS_9));
}
// @ts-ignore
[run, isBusy, isBusy, hardImpairmentApproved, capitalFloorBreached, gapBelowFloorAtr, consecutiveCloseBreaches, mutation, mutation, mutation, mutation, mutation, mutation, mutation, mutation, mutation, mutation, mutation, mutation, mutation, mutation, retry,];
var __VLS_3;
var __VLS_4;
// @ts-ignore
[];
const __VLS_export = (await import('vue')).defineComponent({});
export default {};
