import type { AppErrorCode } from '@shared/errors.ts'; import type { CurrencyEdits, SaveDetails, SaveList } from '@shared/schemas/saves.ts'; interface Location { readonly gameFolder: string; readonly dataFolder: string; } export type SaveTask = Location & ( | { readonly operation: 'list' } | { readonly operation: 'details'; readonly userId: string } | { readonly operation: 'edit'; readonly userId: string; readonly values: CurrencyEdits } | { readonly operation: 'remove'; readonly userId: string } | { readonly operation: 'filter'; readonly profile: Uint8Array; readonly filter: boolean } | { readonly operation: 'create'; readonly login: string; readonly password: string; readonly nick: string } ); export type SaveResult = SaveList['saves'] | SaveDetails | { userId: string } | Uint8Array | null; export type SaveReply = { ok: true; result: SaveResult } | { ok: false; error: AppErrorCode };