/**
 * \file core/spoms/protein_list.h
 * \date 13/02/2026
 * \author Aurélien Berthier, BENOIST Emile, TESSIER Dominique
 * \brief Protein collection and Spectrum align
 */


/*
 * 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 "protein.h"
#include <cstddef>
#include <pappsomspp/core/amino_acid/aacode.h>
#include <pappsomspp/core/massspectrum/qualifiedmassspectrum.h>

namespace pappso
{
namespace spoms
{

/**
 * Collection of proteins to align against a Spectrum
 *
 */

class ProteinList
{

  public:
  ProteinList(const pappso::AaCode &aaCode);
  virtual ~ProteinList();

  void addProtein(pappso::ProteinSp protein_sp);

  struct Result
  {
    ProteinSp protein;
    std::shared_ptr<Alignment> alignment_sp;
    std::shared_ptr<Alignment> post_processed_alignment_sp;
  };

  struct Debug
  {
    std::vector<ProteinList::Result> intermediate_results;
  };
  /**
   * @brief Returns the result of the alignment process
   * @return A vector of Result objects. Each Result contains a protein and the
   * result of aligning the provided spectrum against the protein. Where
   * appropriate, the post-processed alignment is also returned (otherwise, a
   * nullptr is returned).
   */
  std::vector<ProteinList::Result>
  alignQualifiedSpectrum(QualifiedMassSpectrumCstSPtr qmsp) const;

  /** @brief possible debug info */
  std::vector<ProteinList::Result>
  alignQualifiedSpectrum(QualifiedMassSpectrumCstSPtr qmsp,
                         Debug &debug_info) const;

  const std::vector<std::shared_ptr<Protein>> &getProteinList() const;

  private:
  const pappso::AaCode &m_aaCode;
  std::vector<std::shared_ptr<Protein>> m_proteinList;
  std::size_t m_maximumProteinSequenceLength = 0;
};

} // namespace spoms
} // namespace pappso
