export type SuccessResponse = {
    /**
     * Status code for successful operations
     */
    status: 0;
    /**
     * Result payload for the operation
     */
    result: {
        [key: string]: unknown;
    };
};
export type ErrorResponse = {
    /**
     * Status code for error operations
     */
    status: 1;
    /**
     * Error details
     */
    error: {
        [key: string]: unknown;
    };
};
/**
 * Unique identifier for a shell
 */
export type ShellId = string;
export type ShellSize = {
    /**
     * Number of columns in the terminal
     */
    cols: number;
    /**
     * Number of rows in the terminal
     */
    rows: number;
};
/**
 * Type of shell process
 */
export type ShellProcessType = 'TERMINAL' | 'COMMAND';
/**
 * Current status of the shell process
 */
export type ShellProcessStatus = 'RUNNING' | 'FINISHED' | 'ERROR' | 'KILLED' | 'RESTARTING';
export type BaseShellDto = {
    shellId: ShellId;
    /**
     * Display name of the shell
     */
    name: string;
    status: ShellProcessStatus;
    /**
     * Exit code of the process if it has finished
     */
    exitCode?: number | null;
};
export type CommandShellDto = BaseShellDto & {
    /**
     * Indicates this is a command shell
     */
    shellType: 'COMMAND';
    /**
     * The command that was executed to start this shell
     */
    startCommand: string;
};
export type TerminalShellDto = BaseShellDto & {
    /**
     * Indicates this is a terminal shell
     */
    shellType: 'TERMINAL';
    /**
     * Username of the shell owner
     */
    ownerUsername: string;
    /**
     * Whether this is a system shell
     */
    isSystemShell: boolean;
};
export type ShellDto = ({
    shellType?: 'COMMAND';
} & CommandShellDto) | ({
    shellType?: 'TERMINAL';
} & TerminalShellDto);
export type OpenCommandShellDto = CommandShellDto & {
    /**
     * Content buffer of the shell
     */
    buffer: Array<string>;
};
export type OpenTerminalShellDto = TerminalShellDto & {
    /**
     * Content buffer of the shell
     */
    buffer: Array<string>;
};
export type OpenShellDto = ({
    shellType?: 'COMMAND';
} & OpenCommandShellDto) | ({
    shellType?: 'TERMINAL';
} & OpenTerminalShellDto);
export type CommonError = {
    /**
     * Error code indicating the shell is not accessible
     */
    code: 'SHELL_NOT_ACCESSIBLE';
    /**
     * Error message
     */
    message: string;
} | {
    /**
     * Protocol error code
     */
    code: string;
    /**
     * Error message
     */
    message: string;
};
export type ShellCreateData = {
    body: {
        /**
         * Command to execute in the shell
         */
        command?: string;
        /**
         * Working directory for the shell
         */
        cwd?: string;
        size?: ShellSize;
        type?: ShellProcessType;
        /**
         * Whether this shell is started by the editor itself to run a specific process
         */
        isSystemShell?: boolean;
    };
    path?: never;
    query?: never;
    url: '/shell/create';
};
export type ShellCreateErrors = {
    /**
     * Error creating shell
     */
    400: ErrorResponse & {
        error?: CommonError;
    };
};
export type ShellCreateError = ShellCreateErrors[keyof ShellCreateErrors];
export type ShellCreateResponses = {
    /**
     * Successful operation
     */
    200: SuccessResponse & {
        result?: OpenShellDto;
    };
};
export type ShellCreateResponse = ShellCreateResponses[keyof ShellCreateResponses];
export type ShellInData = {
    body: {
        shellId: ShellId;
        /**
         * Input to send to the shell
         */
        input: string;
        size: ShellSize;
    };
    path?: never;
    query?: never;
    url: '/shell/in';
};
export type ShellInErrors = {
    /**
     * Error sending input to shell
     */
    400: ErrorResponse & {
        error?: CommonError;
    };
};
export type ShellInError = ShellInErrors[keyof ShellInErrors];
export type ShellInResponses = {
    /**
     * Successful operation
     */
    200: SuccessResponse & {
        result?: unknown;
    };
};
export type ShellInResponse = ShellInResponses[keyof ShellInResponses];
export type ShellListData = {
    body: {
        [key: string]: unknown;
    };
    path?: never;
    query?: never;
    url: '/shell/list';
};
export type ShellListErrors = {
    /**
     * Error listing shells
     */
    400: ErrorResponse & {
        error?: CommonError;
    };
};
export type ShellListError = ShellListErrors[keyof ShellListErrors];
export type ShellListResponses = {
    /**
     * Successful operation
     */
    200: SuccessResponse & {
        result?: {
            shells: Array<ShellDto>;
        };
    };
};
export type ShellListResponse = ShellListResponses[keyof ShellListResponses];
export type ShellOpenData = {
    body: {
        shellId: ShellId;
        size: ShellSize;
    };
    path?: never;
    query?: never;
    url: '/shell/open';
};
export type ShellOpenErrors = {
    /**
     * Error opening shell
     */
    400: ErrorResponse & {
        error?: CommonError;
    };
};
export type ShellOpenError = ShellOpenErrors[keyof ShellOpenErrors];
export type ShellOpenResponses = {
    /**
     * Successful operation
     */
    200: SuccessResponse & {
        result?: OpenShellDto;
    };
};
export type ShellOpenResponse = ShellOpenResponses[keyof ShellOpenResponses];
export type ShellCloseData = {
    body: {
        shellId: ShellId;
    };
    path?: never;
    query?: never;
    url: '/shell/close';
};
export type ShellCloseErrors = {
    /**
     * Error closing shell
     */
    400: ErrorResponse & {
        error?: CommonError;
    };
};
export type ShellCloseError = ShellCloseErrors[keyof ShellCloseErrors];
export type ShellCloseResponses = {
    /**
     * Successful operation
     */
    200: SuccessResponse & {
        result?: unknown;
    };
};
export type ShellCloseResponse = ShellCloseResponses[keyof ShellCloseResponses];
export type ShellRestartData = {
    body: {
        shellId: ShellId;
    };
    path?: never;
    query?: never;
    url: '/shell/restart';
};
export type ShellRestartErrors = {
    /**
     * Error restarting shell
     */
    400: ErrorResponse & {
        error?: CommonError;
    };
};
export type ShellRestartError = ShellRestartErrors[keyof ShellRestartErrors];
export type ShellRestartResponses = {
    /**
     * Successful operation
     */
    200: SuccessResponse & {
        result?: unknown;
    };
};
export type ShellRestartResponse = ShellRestartResponses[keyof ShellRestartResponses];
export type ShellTerminateData = {
    body: {
        shellId: ShellId;
    };
    path?: never;
    query?: never;
    url: '/shell/terminate';
};
export type ShellTerminateErrors = {
    /**
     * Error terminating shell
     */
    400: ErrorResponse & {
        error?: CommonError;
    };
};
export type ShellTerminateError = ShellTerminateErrors[keyof ShellTerminateErrors];
export type ShellTerminateResponses = {
    /**
     * Successful operation
     */
    200: SuccessResponse & {
        result?: ShellDto;
    };
};
export type ShellTerminateResponse = ShellTerminateResponses[keyof ShellTerminateResponses];
export type ShellResizeData = {
    body: {
        shellId: ShellId;
        size: ShellSize;
    };
    path?: never;
    query?: never;
    url: '/shell/resize';
};
export type ShellResizeErrors = {
    /**
     * Error resizing shell
     */
    400: ErrorResponse & {
        error?: CommonError;
    };
};
export type ShellResizeError = ShellResizeErrors[keyof ShellResizeErrors];
export type ShellResizeResponses = {
    /**
     * Successful operation
     */
    200: SuccessResponse & {
        result?: unknown;
    };
};
export type ShellResizeResponse = ShellResizeResponses[keyof ShellResizeResponses];
export type ShellRenameData = {
    body: {
        shellId: ShellId;
        /**
         * New name for the shell
         */
        name: string;
    };
    path?: never;
    query?: never;
    url: '/shell/rename';
};
export type ShellRenameErrors = {
    /**
     * Error renaming shell
     */
    400: ErrorResponse & {
        error?: CommonError;
    };
};
export type ShellRenameError = ShellRenameErrors[keyof ShellRenameErrors];
export type ShellRenameResponses = {
    /**
     * Successful operation
     */
    200: SuccessResponse & {
        result?: unknown;
    };
};
export type ShellRenameResponse = ShellRenameResponses[keyof ShellRenameResponses];
