import CSSClient from '../../lib/cssClient.js';
export default class ImageDestroyer {
    cssClient;
    imageName;
    constructor(imageName) {
        this.cssClient = new CSSClient();
        this.imageName = imageName;
    }
    async destroy() {
        const images = await this.cssClient.get('/images', { name: this.imageName });
        if (!images || images.length === 0 || images[0].name !== this.imageName) {
            throw new Error(`Image with name "${this.imageName}" not found.`);
        }
        const targetImage = images[0];
        await this.cssClient.delete(`/images/${targetImage.id}`);
    }
}
