import { CertificateFileKind, DataFileKind, FolderKind, ProjectKind } from "@api-client/core/build/browser.js";
/**
 * Sorts files on the list.
 *
 * Folders are always on top.
 */
export function filesSortFunction(a, b) {
    if (a.kind !== b.kind) {
        if (a.kind === FolderKind) {
            return -1;
        }
        return 1;
    }
    if (a.kind === b.kind && a.kind === FolderKind) {
        return (a.info.name || '').localeCompare(b.info.name || '');
    }
    return b.lastModified.time - a.lastModified.time;
}
export function fileIcon(item) {
    let icon;
    switch (item.kind) {
        case DataFileKind:
            icon = 'schema';
            break;
        case FolderKind:
            icon = 'folder';
            break;
        case ProjectKind:
            icon = 'collectionsBookmark';
            break;
        case CertificateFileKind:
            icon = 'certificate';
            break;
        default:
    }
    return icon;
}
//# sourceMappingURL=FilesLib.js.map