# Generated by the protocol buffer compiler.  DO NOT EDIT!
# sources: qm/pb/inc_qua.proto
# plugin: python-betterproto
# This file has been @generated
import warnings
from dataclasses import dataclass
from typing import (
    List,
    Optional,
)

import betterproto
import betterproto.lib.google.protobuf as betterproto_lib_google_protobuf

from .. import qua_config as _qua_config__


class QuaProgramType(betterproto.Enum):
    INT = 0
    BOOL = 1
    REAL = 2


class QuaProgramChirpUnits(betterproto.Enum):
    HzPerNanoSec = 0
    mHzPerNanoSec = 1
    uHzPerNanoSec = 2
    nHzPerNanoSec = 3
    pHzPerNanoSec = 4


class QuaProgramUpdateFrequencyStatementUnits(betterproto.Enum):
    Hz = 0
    mHz = 1
    uHz = 2
    nHz = 3
    pHz = 4


class QuaProgramUpdateOscillatorFrequencyStatementUnits(betterproto.Enum):
    GHz = 0
    MHz = 1
    KHz = 2
    Hz = 3


class QuaProgramUpdateOscillatorFrequencyStatementUpdateComponentSelection(
    betterproto.Enum
):
    both = 0
    upconverter = 1
    downconverter = 2


class QuaProgramBinaryExpressionBinaryOperator(betterproto.Enum):
    ADD = 0
    SUB = 1
    MULT = 2
    DIV = 3
    AND = 4
    """binary operators"""

    OR = 5
    XOR = 6
    LT = 7
    """comparisons"""

    LET = 8
    GT = 9
    GET = 10
    EQ = 11
    SHL = 12
    """shifts"""

    SHR = 13


@dataclass(eq=False, repr=False)
class QuaProgram(betterproto.Message):
    config: "_qua_config__.QuaConfig" = betterproto.message_field(1)
    dyn_config: "QuaProgramDynamicConfig" = betterproto.message_field(2)
    script: "QuaProgramScript" = betterproto.message_field(5)
    compiler_options: "QuaProgramCompilerOptions" = betterproto.message_field(6)
    result_analysis: "QuaResultAnalysis" = betterproto.message_field(7)
    config_update: "_qua_config__.QuaConfig" = betterproto.message_field(8)


@dataclass(eq=False, repr=False)
class QuaProgramCompilerOptions(betterproto.Message):
    use_experimental_calculation_compiler: bool = betterproto.bool_field(1)
    optimize_merge_code_execution: bool = betterproto.bool_field(2)
    optimize_write_read_commands: bool = betterproto.bool_field(3)
    skip_optimizations: List[str] = betterproto.string_field(4)
    strict: bool = betterproto.bool_field(5)
    flags: List[str] = betterproto.string_field(6)

    def __post_init__(self) -> None:
        super().__post_init__()
        if self.is_set("use_experimental_calculation_compiler"):
            warnings.warn(
                "QuaProgramCompilerOptions.use_experimental_calculation_compiler is deprecated",
                DeprecationWarning,
            )
        if self.is_set("optimize_merge_code_execution"):
            warnings.warn(
                "QuaProgramCompilerOptions.optimize_merge_code_execution is deprecated",
                DeprecationWarning,
            )
        if self.is_set("optimize_write_read_commands"):
            warnings.warn(
                "QuaProgramCompilerOptions.optimize_write_read_commands is deprecated",
                DeprecationWarning,
            )
        if self.is_set("skip_optimizations"):
            warnings.warn(
                "QuaProgramCompilerOptions.skip_optimizations is deprecated",
                DeprecationWarning,
            )
        if self.is_set("strict"):
            warnings.warn(
                "QuaProgramCompilerOptions.strict is deprecated", DeprecationWarning
            )


@dataclass(eq=False, repr=False)
class QuaProgramScript(betterproto.Message):
    variables: List["QuaProgramVarDeclaration"] = betterproto.message_field(1)
    body: "QuaProgramStatementsCollection" = betterproto.message_field(10)


@dataclass(eq=False, repr=False)
class QuaProgramVarDeclaration(betterproto.Message):
    name: str = betterproto.string_field(1)
    type: "QuaProgramType" = betterproto.enum_field(2)
    size: int = betterproto.int32_field(3)
    value: List["QuaProgramLiteralExpression"] = betterproto.message_field(4)
    dim: int = betterproto.int32_field(5)
    is_input_stream: bool = betterproto.bool_field(6)


@dataclass(eq=False, repr=False)
class QuaProgramQuantumElementReference(betterproto.Message):
    loc: str = betterproto.string_field(100)
    name: str = betterproto.string_field(1)


@dataclass(eq=False, repr=False)
class QuaProgramPulseReference(betterproto.Message):
    loc: str = betterproto.string_field(100)
    name: str = betterproto.string_field(1)


@dataclass(eq=False, repr=False)
class QuaProgramIntegrationWeightReference(betterproto.Message):
    loc: str = betterproto.string_field(100)
    name: str = betterproto.string_field(1)


@dataclass(eq=False, repr=False)
class QuaProgramAnyStatement(betterproto.Message):
    play: "QuaProgramPlayStatement" = betterproto.message_field(
        1, group="statement_oneof"
    )
    measure: "QuaProgramMeasureStatement" = betterproto.message_field(
        2, group="statement_oneof"
    )
    wait: "QuaProgramWaitStatement" = betterproto.message_field(
        3, group="statement_oneof"
    )
    sync: "QuaProgramSyncStatement" = betterproto.message_field(
        4, group="statement_oneof"
    )
    if_: "QuaProgramIfStatement" = betterproto.message_field(5, group="statement_oneof")
    assign: "QuaProgramAssignmentStatement" = betterproto.message_field(
        6, group="statement_oneof"
    )
    for_: "QuaProgramForStatement" = betterproto.message_field(
        7, group="statement_oneof"
    )
    rus: "QuaProgramRusStatement" = betterproto.message_field(
        8, group="statement_oneof"
    )
    align: "QuaProgramAlignStatement" = betterproto.message_field(
        9, group="statement_oneof"
    )
    update_frequency: "QuaProgramUpdateFrequencyStatement" = betterproto.message_field(
        10, group="statement_oneof"
    )
    z_rotation: "QuaProgramZRotationStatement" = betterproto.message_field(
        11, group="statement_oneof"
    )
    pause: "QuaProgramPauseStatement" = betterproto.message_field(
        12, group="statement_oneof"
    )
    save: "QuaProgramSaveStatement" = betterproto.message_field(
        13, group="statement_oneof"
    )
    for_each: "QuaProgramForEachStatement" = betterproto.message_field(
        14, group="statement_oneof"
    )
    wait_for_trigger: "QuaProgramWaitForTriggerStatement" = betterproto.message_field(
        15, group="statement_oneof"
    )
    qrun: "QuaProgramQRunStatement" = betterproto.message_field(
        16, group="statement_oneof"
    )
    update_correction: "QuaProgramUpdateCorrectionStatement" = (
        betterproto.message_field(17, group="statement_oneof")
    )
    reset_phase: "QuaProgramResetPhaseStatement" = betterproto.message_field(
        18, group="statement_oneof"
    )
    ramp_to_zero: "QuaProgramRampToZeroStatement" = betterproto.message_field(
        19, group="statement_oneof"
    )
    reset_frame: "QuaProgramResetFrameStatement" = betterproto.message_field(
        20, group="statement_oneof"
    )
    set_dc_offset: "QuaProgramSetDcOffsetStatement" = betterproto.message_field(
        21, group="statement_oneof"
    )
    advance_input_stream: "QuaProgramAdvanceInputStreamStatement" = (
        betterproto.message_field(22, group="statement_oneof")
    )
    strict_timing: "QuaProgramStrictTimingStatement" = betterproto.message_field(
        23, group="statement_oneof"
    )
    fast_frame_rotation: "QuaProgramFastFrameRotationStatement" = (
        betterproto.message_field(24, group="statement_oneof")
    )
    update_oscillator_frequency: "QuaProgramUpdateOscillatorFrequencyStatement" = (
        betterproto.message_field(25, group="statement_oneof")
    )
    reset_global_phase: "QuaProgramResetGlobalPhaseStatement" = (
        betterproto.message_field(27, group="statement_oneof")
    )

    def __post_init__(self) -> None:
        super().__post_init__()
        if self.is_set("qrun"):
            warnings.warn(
                "QuaProgramAnyStatement.qrun is deprecated", DeprecationWarning
            )


@dataclass(eq=False, repr=False)
class QuaProgramAmpMultiplier(betterproto.Message):
    loc: str = betterproto.string_field(100)
    v0: "QuaProgramAnyScalarExpression" = betterproto.message_field(1)
    v1: "QuaProgramAnyScalarExpression" = betterproto.message_field(2)
    v2: "QuaProgramAnyScalarExpression" = betterproto.message_field(3)
    v3: "QuaProgramAnyScalarExpression" = betterproto.message_field(4)


@dataclass(eq=False, repr=False)
class QuaProgramRampToZeroStatement(betterproto.Message):
    loc: str = betterproto.string_field(100)
    qe: "QuaProgramQuantumElementReference" = betterproto.message_field(1)
    duration: Optional[int] = betterproto.message_field(
        2, wraps=betterproto.TYPE_UINT32
    )


@dataclass(eq=False, repr=False)
class QuaProgramRampPulse(betterproto.Message):
    loc: str = betterproto.string_field(100)
    value: "QuaProgramAnyScalarExpression" = betterproto.message_field(2)


@dataclass(eq=False, repr=False)
class QuaProgramChirp(betterproto.Message):
    loc: str = betterproto.string_field(100)
    scalar_rate: "QuaProgramAnyScalarExpression" = betterproto.message_field(
        1, group="rate"
    )
    array_rate: "QuaProgramArrayVarRefExpression" = betterproto.message_field(
        2, group="rate"
    )
    units: "QuaProgramChirpUnits" = betterproto.enum_field(3)
    times: List[int] = betterproto.uint32_field(4)
    continue_chirp: bool = betterproto.bool_field(5)


@dataclass(eq=False, repr=False)
class QuaProgramPlayStatement(betterproto.Message):
    loc: str = betterproto.string_field(100)
    qe: "QuaProgramQuantumElementReference" = betterproto.message_field(1)
    pulse: "QuaProgramPulseReference" = betterproto.message_field(2)
    named_pulse: "QuaProgramPulseReference" = betterproto.message_field(
        7, group="pulseType"
    )
    ramp_pulse: "QuaProgramRampPulse" = betterproto.message_field(8, group="pulseType")
    amp: "QuaProgramAmpMultiplier" = betterproto.message_field(3)
    duration: "QuaProgramAnyScalarExpression" = betterproto.message_field(4)
    condition: "QuaProgramAnyScalarExpression" = betterproto.message_field(5)
    port_condition: "QuaProgramAnyScalarExpression" = betterproto.message_field(12)
    target_input: str = betterproto.string_field(6)
    chirp: "QuaProgramChirp" = betterproto.message_field(9)
    truncate: "QuaProgramAnyScalarExpression" = betterproto.message_field(10)
    timestamp_label: str = betterproto.string_field(11)

    def __post_init__(self) -> None:
        super().__post_init__()
        if self.is_set("pulse"):
            warnings.warn(
                "QuaProgramPlayStatement.pulse is deprecated", DeprecationWarning
            )


@dataclass(eq=False, repr=False)
class QuaProgramUpdateFrequencyStatement(betterproto.Message):
    loc: str = betterproto.string_field(100)
    qe: "QuaProgramQuantumElementReference" = betterproto.message_field(1)
    value: "QuaProgramAnyScalarExpression" = betterproto.message_field(2)
    units: "QuaProgramUpdateFrequencyStatementUnits" = betterproto.enum_field(3)
    keep_phase: bool = betterproto.bool_field(4)


@dataclass(eq=False, repr=False)
class QuaProgramUpdateOscillatorFrequencyStatement(betterproto.Message):
    loc: str = betterproto.string_field(100)
    qe: "QuaProgramQuantumElementReference" = betterproto.message_field(1)
    value: "QuaProgramAnyScalarExpression" = betterproto.message_field(2)
    units: "QuaProgramUpdateOscillatorFrequencyStatementUnits" = betterproto.enum_field(
        3
    )
    keep_phase: bool = betterproto.bool_field(4)
    update_component: "QuaProgramUpdateOscillatorFrequencyStatementUpdateComponentSelection" = betterproto.enum_field(
        5
    )


@dataclass(eq=False, repr=False)
class QuaProgramSetDcOffsetStatement(betterproto.Message):
    loc: str = betterproto.string_field(100)
    qe: "QuaProgramQuantumElementReference" = betterproto.message_field(1)
    qe_input_reference: str = betterproto.string_field(2)
    offset: "QuaProgramAnyScalarExpression" = betterproto.message_field(3)


@dataclass(eq=False, repr=False)
class QuaProgramZRotationStatement(betterproto.Message):
    loc: str = betterproto.string_field(100)
    qe: "QuaProgramQuantumElementReference" = betterproto.message_field(3)
    value: "QuaProgramAnyScalarExpression" = betterproto.message_field(2)


@dataclass(eq=False, repr=False)
class QuaProgramResetFrameStatement(betterproto.Message):
    loc: str = betterproto.string_field(100)
    qe: "QuaProgramQuantumElementReference" = betterproto.message_field(2)


@dataclass(eq=False, repr=False)
class QuaProgramFastFrameRotationStatement(betterproto.Message):
    loc: str = betterproto.string_field(100)
    qe: "QuaProgramQuantumElementReference" = betterproto.message_field(1)
    cosine: "QuaProgramAnyScalarExpression" = betterproto.message_field(2)
    sine: "QuaProgramAnyScalarExpression" = betterproto.message_field(3)


@dataclass(eq=False, repr=False)
class QuaProgramAlignStatement(betterproto.Message):
    loc: str = betterproto.string_field(100)
    qe: List["QuaProgramQuantumElementReference"] = betterproto.message_field(1)


@dataclass(eq=False, repr=False)
class QuaProgramMeasureProcess(betterproto.Message):
    analog: "QuaProgramAnalogMeasureProcess" = betterproto.message_field(
        1, group="process"
    )
    digital: "QuaProgramDigitalMeasureProcess" = betterproto.message_field(
        2, group="process"
    )


@dataclass(eq=False, repr=False)
class QuaProgramAnalogMeasureProcess(betterproto.Message):
    loc: str = betterproto.string_field(100)
    bare_integration: "QuaProgramAnalogMeasureProcessBareIntegration" = (
        betterproto.message_field(1, group="process")
    )
    demod_integration: "QuaProgramAnalogMeasureProcessDemodIntegration" = (
        betterproto.message_field(2, group="process")
    )
    raw_time_tagging: "QuaProgramAnalogMeasureProcessRawTimeTagging" = (
        betterproto.message_field(3, group="process")
    )
    dual_bare_integration: "QuaProgramAnalogMeasureProcessDualBareIntegration" = (
        betterproto.message_field(4, group="process")
    )
    dual_demod_integration: "QuaProgramAnalogMeasureProcessDualDemodIntegration" = (
        betterproto.message_field(5, group="process")
    )
    high_res_time_tagging: "QuaProgramAnalogMeasureProcessHighResTimeTagging" = (
        betterproto.message_field(6, group="process")
    )


@dataclass(eq=False, repr=False)
class QuaProgramAnalogMeasureProcessBareIntegration(betterproto.Message):
    integration: "QuaProgramIntegrationWeightReference" = betterproto.message_field(1)
    target: "QuaProgramAnalogProcessTarget" = betterproto.message_field(2)
    element_output: str = betterproto.string_field(9)


@dataclass(eq=False, repr=False)
class QuaProgramAnalogMeasureProcessDualBareIntegration(betterproto.Message):
    integration1: "QuaProgramIntegrationWeightReference" = betterproto.message_field(1)
    integration2: "QuaProgramIntegrationWeightReference" = betterproto.message_field(2)
    target: "QuaProgramAnalogProcessTarget" = betterproto.message_field(3)
    element_output1: str = betterproto.string_field(9)
    element_output2: str = betterproto.string_field(10)


@dataclass(eq=False, repr=False)
class QuaProgramAnalogMeasureProcessDemodIntegration(betterproto.Message):
    integration: "QuaProgramIntegrationWeightReference" = betterproto.message_field(1)
    target: "QuaProgramAnalogProcessTarget" = betterproto.message_field(2)
    element_output: str = betterproto.string_field(9)


@dataclass(eq=False, repr=False)
class QuaProgramAnalogMeasureProcessDualDemodIntegration(betterproto.Message):
    integration1: "QuaProgramIntegrationWeightReference" = betterproto.message_field(1)
    integration2: "QuaProgramIntegrationWeightReference" = betterproto.message_field(2)
    target: "QuaProgramAnalogProcessTarget" = betterproto.message_field(3)
    element_output1: str = betterproto.string_field(9)
    element_output2: str = betterproto.string_field(10)


@dataclass(eq=False, repr=False)
class QuaProgramAnalogMeasureProcessRawTimeTagging(betterproto.Message):
    target: "QuaProgramArrayVarRefExpression" = betterproto.message_field(1)
    target_len: "QuaProgramVarRefExpression" = betterproto.message_field(2)
    max_time: int = betterproto.int32_field(3)
    element_output: str = betterproto.string_field(9)


@dataclass(eq=False, repr=False)
class QuaProgramAnalogMeasureProcessHighResTimeTagging(betterproto.Message):
    target: "QuaProgramArrayVarRefExpression" = betterproto.message_field(1)
    target_len: "QuaProgramVarRefExpression" = betterproto.message_field(2)
    max_time: int = betterproto.int32_field(3)
    element_output: str = betterproto.string_field(9)


@dataclass(eq=False, repr=False)
class QuaProgramDigitalMeasureProcess(betterproto.Message):
    loc: str = betterproto.string_field(100)
    raw_time_tagging: "QuaProgramDigitalMeasureProcessRawTimeTagging" = (
        betterproto.message_field(1, group="process")
    )
    counting: "QuaProgramDigitalMeasureProcessCounting" = betterproto.message_field(
        2, group="process"
    )


@dataclass(eq=False, repr=False)
class QuaProgramDigitalMeasureProcessRawTimeTagging(betterproto.Message):
    element_output: str = betterproto.string_field(1)
    target: "QuaProgramArrayVarRefExpression" = betterproto.message_field(2)
    target_len: "QuaProgramVarRefExpression" = betterproto.message_field(3)
    max_time: int = betterproto.int32_field(4)


@dataclass(eq=False, repr=False)
class QuaProgramDigitalMeasureProcessCounting(betterproto.Message):
    element_outputs: List[str] = betterproto.string_field(1)
    target: "QuaProgramVarRefExpression" = betterproto.message_field(2)
    max_time: int = betterproto.int32_field(3)


@dataclass(eq=False, repr=False)
class QuaProgramAnalogProcessTarget(betterproto.Message):
    loc: str = betterproto.string_field(100)
    scalar_process: "QuaProgramAnalogProcessTargetScalarProcessTarget" = (
        betterproto.message_field(1, group="processTarget")
    )
    vector_process: "QuaProgramAnalogProcessTargetVectorProcessTarget" = (
        betterproto.message_field(2, group="processTarget")
    )


@dataclass(eq=False, repr=False)
class QuaProgramAnalogProcessTargetScalarProcessTarget(betterproto.Message):
    variable: "QuaProgramVarRefExpression" = betterproto.message_field(
        1, group="target"
    )
    array_cell: "QuaProgramArrayCellRefExpression" = betterproto.message_field(
        2, group="target"
    )


@dataclass(eq=False, repr=False)
class QuaProgramAnalogProcessTargetVectorProcessTarget(betterproto.Message):
    array: "QuaProgramArrayVarRefExpression" = betterproto.message_field(1)
    time_division: "QuaProgramAnalogProcessTargetTimeDivision" = (
        betterproto.message_field(2)
    )


@dataclass(eq=False, repr=False)
class QuaProgramAnalogProcessTargetTimeDivision(betterproto.Message):
    sliced: "QuaProgramAnalogTimeDivisionSliced" = betterproto.message_field(
        2, group="timeDivision"
    )
    accumulated: "QuaProgramAnalogTimeDivisionAccumulated" = betterproto.message_field(
        3, group="timeDivision"
    )
    moving_window: "QuaProgramAnalogTimeDivisionMovingWindow" = (
        betterproto.message_field(4, group="timeDivision")
    )


@dataclass(eq=False, repr=False)
class QuaProgramAnalogTimeDivision(betterproto.Message):
    pass


@dataclass(eq=False, repr=False)
class QuaProgramAnalogTimeDivisionSliced(betterproto.Message):
    loc: str = betterproto.string_field(100)
    samples_per_chunk: int = betterproto.int32_field(1)


@dataclass(eq=False, repr=False)
class QuaProgramAnalogTimeDivisionAccumulated(betterproto.Message):
    loc: str = betterproto.string_field(100)
    samples_per_chunk: int = betterproto.int32_field(1)


@dataclass(eq=False, repr=False)
class QuaProgramAnalogTimeDivisionMovingWindow(betterproto.Message):
    loc: str = betterproto.string_field(100)
    samples_per_chunk: int = betterproto.int32_field(1)
    chunks_per_window: int = betterproto.int32_field(2)


@dataclass(eq=False, repr=False)
class QuaProgramMeasureOutput(betterproto.Message):
    loc: str = betterproto.string_field(100)
    integration: "QuaProgramIntegrationWeightReference" = betterproto.message_field(1)
    variable: "QuaProgramVarRefExpression" = betterproto.message_field(2)
    output: str = betterproto.string_field(3)
    target: "QuaProgramMeasureOutputTarget" = betterproto.message_field(4)

    def __post_init__(self) -> None:
        super().__post_init__()
        if self.is_set("variable"):
            warnings.warn(
                "QuaProgramMeasureOutput.variable is deprecated", DeprecationWarning
            )


@dataclass(eq=False, repr=False)
class QuaProgramMeasureOutputTarget(betterproto.Message):
    variable: "QuaProgramVarRefExpression" = betterproto.message_field(
        1, group="target"
    )
    array_cell: "QuaProgramArrayCellRefExpression" = betterproto.message_field(
        2, group="target"
    )


@dataclass(eq=False, repr=False)
class QuaProgramMeasureStatement(betterproto.Message):
    loc: str = betterproto.string_field(100)
    qe: "QuaProgramQuantumElementReference" = betterproto.message_field(1)
    pulse: "QuaProgramPulseReference" = betterproto.message_field(2)
    amp: "QuaProgramAmpMultiplier" = betterproto.message_field(3)
    outputs: List["QuaProgramMeasureOutput"] = betterproto.message_field(4)
    stream_as: str = betterproto.string_field(5)
    measure_processes: List["QuaProgramMeasureProcess"] = betterproto.message_field(7)
    timestamp_label: str = betterproto.string_field(8)

    def __post_init__(self) -> None:
        super().__post_init__()
        if self.is_set("outputs"):
            warnings.warn(
                "QuaProgramMeasureStatement.outputs is deprecated", DeprecationWarning
            )


@dataclass(eq=False, repr=False)
class QuaProgramWaitStatement(betterproto.Message):
    loc: str = betterproto.string_field(100)
    qe: List["QuaProgramQuantumElementReference"] = betterproto.message_field(1)
    time: "QuaProgramAnyScalarExpression" = betterproto.message_field(2)


@dataclass(eq=False, repr=False)
class QuaProgramWaitForTriggerStatement(betterproto.Message):
    loc: str = betterproto.string_field(100)
    qe: List["QuaProgramQuantumElementReference"] = betterproto.message_field(1)
    pulse_to_play: "QuaProgramPulseReference" = betterproto.message_field(2)
    global_trigger: "betterproto_lib_google_protobuf.Empty" = betterproto.message_field(
        3, group="source"
    )
    element_output: "QuaProgramWaitForTriggerStatementElementOutput" = (
        betterproto.message_field(4, group="source")
    )
    time_tag_target: "QuaProgramVarRefExpression" = betterproto.message_field(5)


@dataclass(eq=False, repr=False)
class QuaProgramWaitForTriggerStatementElementOutput(betterproto.Message):
    element: str = betterproto.string_field(1)
    output: str = betterproto.string_field(2)


@dataclass(eq=False, repr=False)
class QuaProgramUpdateCorrectionStatement(betterproto.Message):
    loc: str = betterproto.string_field(100)
    qe: "QuaProgramQuantumElementReference" = betterproto.message_field(1)
    correction: "QuaProgramCorrection" = betterproto.message_field(2)


@dataclass(eq=False, repr=False)
class QuaProgramResetPhaseStatement(betterproto.Message):
    loc: str = betterproto.string_field(100)
    qe: "QuaProgramQuantumElementReference" = betterproto.message_field(1)


@dataclass(eq=False, repr=False)
class QuaProgramResetGlobalPhaseStatement(betterproto.Message):
    loc: str = betterproto.string_field(100)


@dataclass(eq=False, repr=False)
class QuaProgramCorrection(betterproto.Message):
    loc: str = betterproto.string_field(100)
    c0: "QuaProgramAnyScalarExpression" = betterproto.message_field(1)
    c1: "QuaProgramAnyScalarExpression" = betterproto.message_field(2)
    c2: "QuaProgramAnyScalarExpression" = betterproto.message_field(3)
    c3: "QuaProgramAnyScalarExpression" = betterproto.message_field(4)


@dataclass(eq=False, repr=False)
class QuaProgramSyncStatement(betterproto.Message):
    loc: str = betterproto.string_field(100)


@dataclass(eq=False, repr=False)
class QuaProgramElseIf(betterproto.Message):
    condition: "QuaProgramAnyScalarExpression" = betterproto.message_field(1)
    body: "QuaProgramStatementsCollection" = betterproto.message_field(2)
    loc: str = betterproto.string_field(100)


@dataclass(eq=False, repr=False)
class QuaProgramIfStatement(betterproto.Message):
    condition: "QuaProgramAnyScalarExpression" = betterproto.message_field(1)
    body: "QuaProgramStatementsCollection" = betterproto.message_field(2)
    else_: "QuaProgramStatementsCollection" = betterproto.message_field(3)
    elseifs: List["QuaProgramElseIf"] = betterproto.message_field(4)
    unsafe: bool = betterproto.bool_field(5)
    loc: str = betterproto.string_field(100)


@dataclass(eq=False, repr=False)
class QuaProgramForStatement(betterproto.Message):
    init: "QuaProgramStatementsCollection" = betterproto.message_field(1)
    condition: "QuaProgramAnyScalarExpression" = betterproto.message_field(2)
    update: "QuaProgramStatementsCollection" = betterproto.message_field(3)
    body: "QuaProgramStatementsCollection" = betterproto.message_field(4)
    loc: str = betterproto.string_field(100)


@dataclass(eq=False, repr=False)
class QuaProgramQRunStatement(betterproto.Message):
    body: "QuaProgramStatementsCollection" = betterproto.message_field(1)
    loc: str = betterproto.string_field(100)


@dataclass(eq=False, repr=False)
class QuaProgramStrictTimingStatement(betterproto.Message):
    body: "QuaProgramStatementsCollection" = betterproto.message_field(1)
    loc: str = betterproto.string_field(100)


@dataclass(eq=False, repr=False)
class QuaProgramForEachStatement(betterproto.Message):
    iterator: List[
        "QuaProgramForEachStatementVariableWithValues"
    ] = betterproto.message_field(1)
    body: "QuaProgramStatementsCollection" = betterproto.message_field(2)
    loc: str = betterproto.string_field(100)


@dataclass(eq=False, repr=False)
class QuaProgramForEachStatementVariableWithValues(betterproto.Message):
    variable: "QuaProgramVarRefExpression" = betterproto.message_field(1)
    array: "QuaProgramArrayVarRefExpression" = betterproto.message_field(2)


@dataclass(eq=False, repr=False)
class QuaProgramRusStatement(betterproto.Message):
    do_block: "QuaProgramStatementsCollection" = betterproto.message_field(1)
    fail_block: "QuaProgramStatementsCollection" = betterproto.message_field(2)
    until: "QuaProgramAnyScalarExpression" = betterproto.message_field(3)
    loc: str = betterproto.string_field(100)


@dataclass(eq=False, repr=False)
class QuaProgramAssignmentStatement(betterproto.Message):
    variable: "QuaProgramVarRefExpression" = betterproto.message_field(1)
    expression: "QuaProgramAnyScalarExpression" = betterproto.message_field(2)
    save: bool = betterproto.bool_field(3)
    target: "QuaProgramAssignmentStatementTarget" = betterproto.message_field(4)
    loc: str = betterproto.string_field(100)

    def __post_init__(self) -> None:
        super().__post_init__()
        if self.is_set("variable"):
            warnings.warn(
                "QuaProgramAssignmentStatement.variable is deprecated",
                DeprecationWarning,
            )
        if self.is_set("save"):
            warnings.warn(
                "QuaProgramAssignmentStatement.save is deprecated", DeprecationWarning
            )


@dataclass(eq=False, repr=False)
class QuaProgramAssignmentStatementTarget(betterproto.Message):
    variable: "QuaProgramVarRefExpression" = betterproto.message_field(
        1, group="target"
    )
    array_cell: "QuaProgramArrayCellRefExpression" = betterproto.message_field(
        2, group="target"
    )


@dataclass(eq=False, repr=False)
class QuaProgramPauseStatement(betterproto.Message):
    qes: List["QuaProgramQuantumElementReference"] = betterproto.message_field(1)
    loc: str = betterproto.string_field(100)


@dataclass(eq=False, repr=False)
class QuaProgramSaveStatement(betterproto.Message):
    variable: "QuaProgramVarRefExpression" = betterproto.message_field(1)
    tag: str = betterproto.string_field(2)
    source: "QuaProgramSaveStatementSource" = betterproto.message_field(3)
    loc: str = betterproto.string_field(100)

    def __post_init__(self) -> None:
        super().__post_init__()
        if self.is_set("variable"):
            warnings.warn(
                "QuaProgramSaveStatement.variable is deprecated", DeprecationWarning
            )


@dataclass(eq=False, repr=False)
class QuaProgramSaveStatementSource(betterproto.Message):
    variable: "QuaProgramVarRefExpression" = betterproto.message_field(
        1, group="source"
    )
    array_cell: "QuaProgramArrayCellRefExpression" = betterproto.message_field(
        2, group="source"
    )
    literal: "QuaProgramLiteralExpression" = betterproto.message_field(
        3, group="source"
    )


@dataclass(eq=False, repr=False)
class QuaProgramStatementsCollection(betterproto.Message):
    statements: List["QuaProgramAnyStatement"] = betterproto.message_field(1)


@dataclass(eq=False, repr=False)
class QuaProgramAnyScalarExpression(betterproto.Message):
    variable: "QuaProgramVarRefExpression" = betterproto.message_field(
        1, group="expression_oneof"
    )
    literal: "QuaProgramLiteralExpression" = betterproto.message_field(
        2, group="expression_oneof"
    )
    binary_operation: "QuaProgramBinaryExpression" = betterproto.message_field(
        3, group="expression_oneof"
    )
    array_cell: "QuaProgramArrayCellRefExpression" = betterproto.message_field(
        4, group="expression_oneof"
    )
    array_length: "QuaProgramArrayLengthExpression" = betterproto.message_field(
        5, group="expression_oneof"
    )
    lib_function: "QuaProgramLibFunctionExpression" = betterproto.message_field(
        6, group="expression_oneof"
    )


@dataclass(eq=False, repr=False)
class QuaProgramLibFunctionExpression(betterproto.Message):
    function_name: str = betterproto.string_field(1)
    arguments: List[
        "QuaProgramLibFunctionExpressionArgument"
    ] = betterproto.message_field(2)
    library_name: str = betterproto.string_field(3)
    loc: str = betterproto.string_field(100)


@dataclass(eq=False, repr=False)
class QuaProgramLibFunctionExpressionArgument(betterproto.Message):
    scalar: "QuaProgramAnyScalarExpression" = betterproto.message_field(
        1, group="argument_oneof"
    )
    array: "QuaProgramArrayVarRefExpression" = betterproto.message_field(
        2, group="argument_oneof"
    )


@dataclass(eq=False, repr=False)
class QuaProgramAdvanceInputStreamStatement(betterproto.Message):
    stream_variable: "QuaProgramVarRefExpression" = betterproto.message_field(
        1, group="stream_oneof"
    )
    stream_array: "QuaProgramArrayVarRefExpression" = betterproto.message_field(
        2, group="stream_oneof"
    )
    loc: str = betterproto.string_field(100)


@dataclass(eq=False, repr=False)
class QuaProgramArrayLengthExpression(betterproto.Message):
    array: "QuaProgramArrayVarRefExpression" = betterproto.message_field(1)
    loc: str = betterproto.string_field(100)


@dataclass(eq=False, repr=False)
class QuaProgramVarRefExpression(betterproto.Message):
    name: str = betterproto.string_field(2, group="var_oneof")
    io_number: int = betterproto.int32_field(3, group="var_oneof")
    loc: str = betterproto.string_field(100)


@dataclass(eq=False, repr=False)
class QuaProgramArrayVarRefExpression(betterproto.Message):
    name: str = betterproto.string_field(2)
    loc: str = betterproto.string_field(100)


@dataclass(eq=False, repr=False)
class QuaProgramArrayCellRefExpression(betterproto.Message):
    array_var: "QuaProgramArrayVarRefExpression" = betterproto.message_field(2)
    index: "QuaProgramAnyScalarExpression" = betterproto.message_field(3)
    loc: str = betterproto.string_field(100)


@dataclass(eq=False, repr=False)
class QuaProgramLiteralExpression(betterproto.Message):
    value: str = betterproto.string_field(1)
    type: "QuaProgramType" = betterproto.enum_field(2)
    loc: str = betterproto.string_field(100)


@dataclass(eq=False, repr=False)
class QuaProgramBinaryExpression(betterproto.Message):
    op: "QuaProgramBinaryExpressionBinaryOperator" = betterproto.enum_field(1)
    left: "QuaProgramAnyScalarExpression" = betterproto.message_field(4)
    right: "QuaProgramAnyScalarExpression" = betterproto.message_field(5)
    loc: str = betterproto.string_field(100)


@dataclass(eq=False, repr=False)
class QuaProgramDynamicConfig(betterproto.Message):
    """
    A config that is similar to JSON in structure and can be converted to the real config
    It has support for versioning
    """

    version: int = betterproto.uint32_field(1)
    root: "betterproto_lib_google_protobuf.Struct" = betterproto.message_field(2)


@dataclass(eq=False, repr=False)
class QuaResultAnalysis(betterproto.Message):
    version: int = betterproto.uint32_field(1)
    model: List[
        "betterproto_lib_google_protobuf.ListValue"
    ] = betterproto.message_field(3)
