#ifndef FINSET_H
#define FINSET_H

#include <string>

/**
 * @brief Represents a set of aerodynamic fins attached to a rocket stage.
 *
 * The FinSet class models stability contributions, drag effects,
 * and center of pressure location based on fin geometry and number.
 */
class FinSet {
public:
    /**
     * @brief Constructs a new FinSet.
     * @param name Name of the fin set.
     * @param numberOfFins Number of fins in the set.
     * @param rootChord Root chord length (meters).
     * @param tipChord Tip chord length (meters).
     * @param span Fin span (meters).
     * @param sweepLength Sweep length of the fin (meters).
     * @param thickness Fin thickness (meters).
     * @param materialDensity Density of fin material (kg/m3).
     */
    FinSet(const std::string& name,
           int numberOfFins,
           double rootChord,
           double tipChord,
           double span,
           double sweepLength,
           double thickness,
           double materialDensity);

    /**
     * @brief Default destructor.
     */
    ~FinSet() = default;

    /**
     * @brief Calculates the normal force coefficient contribution of the fin set.
     * @return Normal force coefficient (Cn).
     */
    double calculateNormalForceCoefficient() const;

    /**
     * @brief Calculates the location of the center of pressure contribution of the fin set.
     * @return Distance from leading edge of root chord (meters).
     */
    double calculateCenterOfPressure() const;

    /**
     * @brief Calculates the drag area contribution of the fins.
     * @return Drag area (Cd x A) in square meters.
     */
    double calculateDragArea() const;

    /**
     * @brief Calculates the total mass of the fin set.
     * @return Mass in kilograms.
     */
    double calculateMass() const;

    /**
     * @brief Gets the name of the fin set.
     * @return Fin set name as a constant reference.
     */
    const std::string& getName() const;

private:
    std::string name_; ///< Name of the fin set.

    int numberOfFins_; ///< Number of fins in the set.

    double rootChord_; ///< Root chord length [m].
    double tipChord_; ///< Tip chord length [m].
    double span_; ///< Span (distance from airframe to tip) [m].
    double sweepLength_; ///< Sweep length (leading edge sweep) [m].
    double thickness_; ///< Thickness of fin [m].
    double materialDensity_; ///< Material density [kg/m3].

    /**
     * @brief Helper method to calculate the planform area of a single fin.
     * @return Planform area in square meters.
     */
    double calculateSingleFinArea() const;
};
#endif // FINSET_H