from typing import Dict
from typing import Any
from typing import List


def waveFuncToSeq(waveForm: Dict[str, Any], maxDt: int, dt: float) -> List[float]:
    """
    Transform the callable waveform to sequences.

    :param waveForm: waveData.
    :param maxDt: duration in unit dt (arbitrary wave generator (AWG) sampling time interval).
    :param dt: sampling time step.
    :return: a list of pulse sequence.
    """
    sequenceList = []
    # Traverse all the time slices.
    for nowDt in range(0, maxDt):
        nowNs = nowDt * dt + dt / 2
        insertNs = waveForm["insert_ns"]
        endNs = waveForm["insert_ns"] + waveForm["duration_ns"]
        if insertNs <= nowNs < endNs:
            # Calculate the waveforms' amplitudes.
            waveFunc = waveForm["func"]
            amp = waveFunc(nowNs - waveForm["insert_ns"], waveForm["para"])
        else:
            amp = 0.0
        sequenceList.append(amp)
    return sequenceList