/*
 * SPDX-FileCopyrightText: NVIDIA CORPORATION & AFFILIATES
 * Copyright (c) 2024-2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
 * SPDX-License-Identifier: LicenseRef-NvidiaProprietary
 *
 * This software is available to you under a choice of one of two
 * licenses.  You may choose to be licensed under the terms of the GNU
 * General Public License (GPL) Version 2, available from the file
 * COPYING in the main directory of this source tree, or the
 * OpenIB.org BSD license below:
 *
 *     Redistribution and use in source and binary forms, with or
 *     without modification, are permitted provided that the following
 *     conditions are met:
 *
 *      - Redistributions of source code must retain the above
 *        copyright notice, this list of conditions and the following
 *        disclaimer.
 *
 *      - Redistributions in binary form must reproduce the above
 *        copyright notice, this list of conditions and the following
 *        disclaimer in the documentation and/or other materials
 *        provided with the distribution.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
 * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
 * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 * SOFTWARE.
 *
 */

#pragma once

#include "fabric_graph_data.h"
#include "file_parser_fabric_abs.h"

class FileParserSmdb : public FileParserFabricAbs
{
    SectionParser<SmRecord> sm_section_parser;
    SectionParser<NodeRecord> node_section_parser;
    SectionParser<PortRecord> port_section_parser;
    SectionParser<LinkRecord> link_section_parser;
    SectionParser<SwitchRecord> switch_section_parser;
    SectionParser<AnToAnRecord> an_to_an_section_parser;
    SectionParser<SmPortsRecord> sm_ports_section_parser;
    SectionParser<SmsRecord> sms_section_parser;
    SectionParser<PortPkeyRecord> pkeys_section_parser;

   public:
    FileParserSmdb(const string& file_name,
                   TopologyType topology_type,
                   ExitOnError exit_on_error,
                   update_func_ptr update_start,
                   update_func_ptr update_end,
                   update_func_ptr update_failed,
                   CsvParser* csv_parser,
                   FabricGraph* fabric_graph)
        : FileParserFabricAbs(file_name,
                              topology_type,
                              exit_on_error,
                              std::move(update_start),
                              std::move(update_end),
                              std::move(update_failed),
                              csv_parser,
                              fabric_graph)
    {}

    int Load() override;
    virtual int Init() override;
};
