#pragma once

#include "core/time.h"

namespace kku
{

/// BPMSection
///
/// Data to setup and distinguish
/// a section on beatmap timeline
struct BPMSection
{
    /// Amount of beats
    /// per minute in the section
    unsigned int bpm = 120; // Hi, osu

    /// Denominator in fraction of major
    /// beats. Like, 1/2, 1/3. etc...
    unsigned int fraction = 2;

    /// Timestamp respresenting when
    /// the section becomes active
    microsec offset_start = 0;

    /// Interval between beats
    microsec interval = 0;
};

/// BPMSectionComparator
///
/// Predicate to define
/// BPMSection sorting rule:
/// by timestamp of start
struct BPMSectionComparator
{
    bool operator()(const BPMSection& lhs, const BPMSection& rhs) const noexcept
    {
        return lhs.offset_start < rhs.offset_start;
    }
};

}
