/**
 * \file core/spoms/alignment.h
 * \date 18/02/2026
 * \author Aurélien Berthier, BENOIST Emile, TESSIER Dominique
 * \brief store alignment interpretations for precise alignment
 */


/*
 * PeptidOMS, Spectra to protein alignment tool
 * Copyright (C) 2026  Olivier Langella
 * <olivier.langella@cnrs.fr>
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program 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 General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 *
 */

#pragma once


#include <memory>
#include <vector>
#include "locationbackup.h"
#include "scenario.h"
#include "location.h"
#include "interpretationbackup.h"
#include "peptidemodel.h"
#include "transformedspectrum.h"

namespace pappso
{
namespace spoms
{
class Alignment;
class Alignment
{

  public:
  Alignment(const InterpretationBackup &interpretation_backup,
            std::shared_ptr<const TransformedSpectrum> transformed_spectrum_sp,
            const std::vector<std::vector<Scenario>> &scenarios_matrice,
            const LocationBackup &location_backup);
  Alignment(const Alignment &other);
  virtual ~Alignment();


  const std::vector<Scenario> &getScenarios() const;

  // public int[] getSequence() {return this.sequence;}

  const std::shared_ptr<const TransformedSpectrum> &
  getTransformedSpectrum() const;

  const std::shared_ptr<Location> &getLocation() const;

  const std::shared_ptr<LocationBackup> &getLocationBackup() const;

  int getScore() const;
  int getNBPeaksInCommon() const;

  // void clear();

  std::vector<double> computePossibleNonAlignedMasses();

  QStringList computeHitModifiedAndRealSequence() const;


  void computeNbPeaksInCommon();

  /** @brief tells if the current alignment is lesser than the other */
  bool compareTo(Alignment &other);

  /** @brief tells if the current alignment is lesser than the other for
   * post-processing return (i.e. score AND SPC) */
  bool compareToPostProcessing(Alignment &other);

  const std::shared_ptr<PeptideModel> getPeptideModel() const;

  double getNonAlignedMass() const;

  private:
  double m_ms2accuracy = 0.02;
  std::vector<Scenario> m_scenarioList;
  // private int[] sequence;
  std::shared_ptr<Location> msp_locationList;
  std::shared_ptr<LocationBackup> msp_locationBackupList;
  std::shared_ptr<const TransformedSpectrum> mcsp_transformedSpectrum;
  int m_score;
  int m_nbPeaksInCommon;
  std::vector<double> m_possibleNonAlignedMassNterList;
  std::vector<double> m_possibleNonAlignedMassCterList;
  std::vector<double> m_possibleNonAlignedMassList;
};

} // namespace spoms
} // namespace pappso
