export { Action } from './Action.js';
import { CreateAction } from './CreateAction.js';
import { DeleteAction } from './DeleteAction.js';
import { ListAction } from './ListAction.js';
import { ReadAction } from './ReadAction.js';
import { SearchAction } from './SearchAction.js';
import { UpdateAction } from './UpdateAction.js';
import { Exception } from '../../exceptions/exception.js';
export { CreateAction, DeleteAction, ListAction, ReadAction, SearchAction, UpdateAction };
/**
 * Restores an action from a schema.
 *
 * It is a helper function to restore actions from schema.
 *
 * @param schema The schema to restore the action from.
 * @returns The restored action.
 */
export function restoreAction(schema) {
    switch (schema.kind) {
        case 'list':
            return new ListAction(schema);
        case 'read':
            return new ReadAction(schema);
        case 'create':
            return new CreateAction(schema);
        case 'update':
            return new UpdateAction(schema);
        case 'delete':
            return new DeleteAction(schema);
        case 'search':
            return new SearchAction(schema);
        default:
            throw new Exception('Unknown action kind', {
                code: 'E_UNKNOWN_ACTION_KIND',
                status: 422,
            });
    }
}
//# sourceMappingURL=index.js.map