/* FichothequeLib_API - Copyright (c) 2018-2025 Vincent Calame - Exemole
 * Logiciel libre donné sous triple licence :
 * 1) selon les termes de la CeCILL V2
 * 2) selon les termes de l’EUPL V.1.1
 * 3) selon les termes de la GNU GPLv3
 * Voir le fichier licences.txt
 */


package net.fichotheque.json;

import java.io.IOException;
import net.fichotheque.album.Illustration;
import net.mapeadores.util.json.JSONWriter;
import net.mapeadores.util.json.PropertyEligibility;


/**
 *
 * @author Vincent Calame
 */
public final class IllustrationJson {

    private IllustrationJson() {

    }

    public static void properties(JSONWriter jw, Illustration illustration, PropertyEligibility propertyEligibility) throws IOException {
        if (propertyEligibility.includeProperty("type")) {
            jw.key("type")
                    .value("illustration");
        }
        if (propertyEligibility.includeProperty("album")) {
            jw.key("album")
                    .value(illustration.getSubsetName());
        }
        if (propertyEligibility.includeProperty("id")) {
            jw.key("id")
                    .value(illustration.getId());
        }
        if (propertyEligibility.includeProperty("format")) {
            jw.key("format")
                    .value(illustration.getFormatType());
        }
        if (propertyEligibility.includeProperty("filename")) {
            jw.key("filename")
                    .value(illustration.getFileName());
        }
    }

}
