/*
 * Copyright (c) 2026 University of Insubria <https://www.uninsubria.it>
 *
 * This library is free software; you can redistribute it and/or modify it
 * under the terms of the GNU Lesser General Public License as published by
 * the Free Software Foundation; either version 2.1 of the License, or (at
 * your option) any later version. All we ask is that proper credit is given
 * for our work, which includes - but is not limited to - adding the above
 * copyright notice to the beginning of your source code files, and to any
 * copyright notice that you may distribute with programs based on this work.
 *
 * This library is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
 * License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public License
 * along with this program; if not, write to the Free Software Foundation, Inc.
 * <https://fsf.org/>
 */

package qsardes.molecule;

import org.openscience.cdk.aromaticity.Aromaticity;
import org.openscience.cdk.exception.CDKException;
import org.openscience.cdk.graph.Cycles;

/**
 * This class builds a QSAR-WB Descriptors compliant molecular representation.
 *
 * @author Nicola Chirico
 */
public class MoleculeBuilderQsarWB extends AbstractMoleculeBuilder
{
    /**
     * Constructs a molecular representation QSAR-WB Descriptors compliant.
     *
     * @param smiles Molecular SMILES.
     *
     * @throws Exception
     */
    public MoleculeBuilderQsarWB(String smiles) throws Exception
    {
        super(smiles);

        detect_aromaticity();
        configure_atoms();
        build_graph();
    }

    private void detect_aromaticity() throws CDKException
    {
        /*
           From CDK documentation: A model similar to what Daylight used for
           SMILES/SMARTS. If you are using SMILES/SMARTS then this is
           a good model to use.
        */
        new Aromaticity(Aromaticity.Model.Daylight, Cycles.all())
                .apply(get_atom_container());
    }
}
