import CSSClient from '../cssClient.js';
import OutputManager from '../outputManager.js';
import TablePrinter from '../tablePrinter.js';
export default class ImageListDisplayer {
    cssClient;
    constructor(client) {
        this.cssClient = client || new CSSClient();
    }
    async displayImages() {
        const images = await this.cssClient.get('/images');
        if (!images || images.length === 0) {
            OutputManager.info('No images found.');
            return;
        }
        const imageData = images.map((image) => ({
            name: image.name,
            public: image.isPublic ? 'Yes' : 'No',
            updatedAt: new Date(image.updatedAt).toLocaleString(),
            updatedAtDate: new Date(image.updatedAt)
        }));
        imageData.sort((a, b) => b.updatedAtDate.getTime() - a.updatedAtDate.getTime());
        new TablePrinter('Images', imageData, [
            { key: 'name', name: 'Name' },
            { key: 'public', name: 'Public' },
            { key: 'updatedAt', name: 'Last updated' }
        ]).print();
    }
}
