from typing import Optional
from pojagi_dsp.channel import ASignal


class AccelerometerSynthesizer(ASignal):
    """
    Features/dimensions:
    - respiration
    - awake vs. asleep
    - activity level (while awake or asleep?)

    I think what's needed here is to identify activities in the raw data and
    then use those as wavetables for various activities. Walking, running, sitting,
    laying down, sleeping in various positions. Then, theoretically, these
    tables could be mixed together. But the problem with that is that we really
    need to extract the components from the signal so that we can recombine them.
    Perhaps do Fourier analysis on various segments you suspect to be wakefulness
    and sleep, and see if you can find any commonality between them in the frequency
    domain, that could be filtered out and reapplied synthetically.

    https://www.ncbi.nlm.nih.gov/pmc/articles/PMC3203837/

    The above link gives some insight into respiration divisions based on activity,
    and how to derive that data using bandpass filtering.
    """
    def __init__(self, srate: Optional[float] = None):
        super().__init__(srate)
        self.activity_level = 0.0
        # Normal range at rest: 12 - 20 (up to 25)
        # https://my.clevelandclinic.org/health/articles/10881-vital-signs
        # Normal range during exercise 40-60
        # https://www.ncbi.nlm.nih.gov/pmc/articles/PMC4818249/
        self.respiration_rate = 12  # bpm

    def samples(self):
        ...
