from typing import Self
from typing import TypeVar
from pyautd3.derive import builder
from pyautd3.derive import datagram
from pyautd3.derive import modulation
from pyautd3.derive.derive_datagram import datagram_with_segment
from pyautd3.driver.datagram.modulation import ModulationWithSamplingConfig
from pyautd3.driver.defined.freq import Freq
from pyautd3.driver.defined.freq import Hz
from pyautd3.driver.firmware.fpga.sampling_config import SamplingConfig
from pyautd3.modulation.sampling_mode import ISamplingMode
from pyautd3.modulation.sampling_mode import SamplingModeExact
from pyautd3.modulation.sampling_mode import SamplingModeExactFloat
from pyautd3.modulation.sampling_mode import SamplingModeNearest
from pyautd3.native_methods.autd3capi_driver import ModulationPtr
from pyautd3.modulation.cache import Cache
from pyautd3.modulation.fir import Fir
from collections.abc import Iterable
from pyautd3.modulation.radiation_pressure import RadiationPressure
from datetime import timedelta
from pyautd3.driver.datagram.with_timeout import DatagramWithTimeout
from pyautd3.driver.datagram.with_parallel_threshold import DatagramWithParallelThreshold
from pyautd3.native_methods.autd3capi_driver import Segment, TransitionModeWrap
from pyautd3.driver.datagram.with_segment import DatagramWithSegment

T = TypeVar("T", int, float)

class Square(ModulationWithSamplingConfig):
    _mode: ISamplingMode
    def __private__init__(self: Square, mode: ISamplingMode) -> None: ...
    def __init__(self: Square, freq: Freq[T]) -> None: ...
    def _modulation_ptr(self: Square, ) -> ModulationPtr: ...
    def with_low(self: Square, low: int) -> Square: ...
    def with_high(self: Square, high: int) -> Square: ...
    def with_duty(self: Square, duty: float) -> Square: ...
    def with_cache(self: Square, ) -> Cache[Square]: ...
    def with_fir(self: Square, iterable: Iterable[float]) -> Fir[Square]: ...
    def with_radiation_pressure(self: Square, ) -> RadiationPressure[Square]: ...
    def with_timeout(self: Square, timeout: timedelta | None) -> DatagramWithTimeout[Square]: ...
    def with_parallel_threshold(self: Square, threshold: int | None) -> DatagramWithParallelThreshold[Square]: ...
    def with_segment(self: Square, segment: Segment, transition_mode: TransitionModeWrap | None) -> DatagramWithSegment[Square]: ...
    @classmethod
    def nearest(cls, freq: Freq[float]) -> Square: ...
    @property
    def freq(self: Square) -> Freq[int] | Freq[float]: ...
    @property
    def low(self: Square) -> int: ...
    @property
    def high(self: Square) -> int: ...
    @property
    def duty(self: Square) -> float: ...
