59 lines
1.4 KiB
TypeScript
59 lines
1.4 KiB
TypeScript
export type ProductAccessibilityState =
|
|
| 'available'
|
|
| 'maintenance'
|
|
| 'product_disabled';
|
|
|
|
export type TradingBehaviorState =
|
|
| 'active'
|
|
| 'global_trade_halt'
|
|
| 'tenant_disabled'
|
|
| 'profile_disabled';
|
|
|
|
export interface ProductControlEnvelope {
|
|
accessibility: ProductAccessibilityState;
|
|
trading: TradingBehaviorState;
|
|
message?: string | null;
|
|
tenantId?: string | null;
|
|
profileId?: string | null;
|
|
updatedAt?: string;
|
|
}
|
|
|
|
export interface TradingRuntimeSummary {
|
|
loopRunning: boolean;
|
|
reconciliationRunning: boolean;
|
|
lastLoopAt: string | null;
|
|
lastReconciliationAt: string | null;
|
|
health: 'healthy' | 'degraded' | 'paused' | 'error';
|
|
}
|
|
|
|
export interface AuthorizedTradingAction {
|
|
id:
|
|
| 'pause_trading'
|
|
| 'resume_trading'
|
|
| 'disable_profile'
|
|
| 'enable_profile'
|
|
| 'close_position'
|
|
| 'acknowledge_alert';
|
|
platform: 'web' | 'mobile';
|
|
role: 'user' | 'operator' | 'admin';
|
|
}
|
|
|
|
export function canExecuteTradingAction(
|
|
action: AuthorizedTradingAction['id'],
|
|
platform: AuthorizedTradingAction['platform'],
|
|
role: AuthorizedTradingAction['role']
|
|
): boolean {
|
|
if (platform === 'mobile') {
|
|
return (
|
|
role === 'admin' ||
|
|
role === 'operator' ||
|
|
action === 'acknowledge_alert' ||
|
|
action === 'pause_trading' ||
|
|
action === 'resume_trading'
|
|
);
|
|
}
|
|
|
|
return role === 'admin' || role === 'operator' || action === 'acknowledge_alert';
|
|
}
|
|
|