import { AKAPIException } from '../../exceptions/api_exception.js';
export const AKModelServiceDelete = (superclass) => {
    return class extends superclass {
        async preDelete(_item) { }
        async delete(id) {
            const item = await this.findBy('id', id);
            if (!item)
                throw AKAPIException.doesNotExist;
            await this.preDelete(item);
            await item.delete();
            await this.postDelete(item);
        }
        async deleteMany(query) {
            const items = await this.baseList(query);
            for (const item of items)
                await this.preDelete(item);
            for (const item of items)
                await item.delete();
            for (const item of items)
                await this.postDelete(item);
        }
        async postDelete(_item) { }
    };
};
//# sourceMappingURL=delete.js.map