# Generated by the protocol buffer compiler.  DO NOT EDIT!
# sources: onos/config/v2/value.proto, onos/config/v2/object.proto, onos/config/v2/failure.proto, onos/config/v2/transaction.proto, onos/config/v2/configuration.proto, onos/config/v2/proposal.proto
# plugin: python-betterproto
from dataclasses import dataclass
from datetime import datetime
from typing import Dict, List

import betterproto


class ValueType(betterproto.Enum):
    """ValueType is the type for a value"""

    EMPTY = 0
    STRING = 1
    INT = 2
    UINT = 3
    BOOL = 4
    DECIMAL = 5
    FLOAT = 6
    BYTES = 7
    LEAFLIST_STRING = 8
    LEAFLIST_INT = 9
    LEAFLIST_UINT = 10
    LEAFLIST_BOOL = 11
    LEAFLIST_DECIMAL = 12
    LEAFLIST_FLOAT = 13
    LEAFLIST_BYTES = 14
    DOUBLE = 15
    LEAFLIST_DOUBLE = 16


class FailureType(betterproto.Enum):
    UNKNOWN = 0
    CANCELED = 1
    NOT_FOUND = 2
    ALREADY_EXISTS = 3
    UNAUTHORIZED = 4
    FORBIDDEN = 5
    CONFLICT = 6
    INVALID = 7
    UNAVAILABLE = 8
    NOT_SUPPORTED = 9
    TIMEOUT = 10
    INTERNAL = 11


class TransactionStrategySynchronicity(betterproto.Enum):
    ASYNCHRONOUS = 0
    SYNCHRONOUS = 1


class TransactionStrategyIsolation(betterproto.Enum):
    DEFAULT = 0
    SERIALIZABLE = 1


class TransactionStatusState(betterproto.Enum):
    PENDING = 0
    VALIDATED = 1
    COMMITTED = 2
    APPLIED = 3
    FAILED = 4


class TransactionInitializePhaseState(betterproto.Enum):
    INITIALIZING = 0
    INITIALIZED = 1
    FAILED = 2


class TransactionValidatePhaseState(betterproto.Enum):
    VALIDATING = 0
    VALIDATED = 1
    FAILED = 2


class TransactionCommitPhaseState(betterproto.Enum):
    COMMITTING = 0
    COMMITTED = 1


class TransactionApplyPhaseState(betterproto.Enum):
    APPLYING = 0
    APPLIED = 1
    FAILED = 2


class TransactionAbortPhaseState(betterproto.Enum):
    ABORTING = 0
    ABORTED = 1


class TransactionEventEventType(betterproto.Enum):
    UNKNOWN = 0
    CREATED = 1
    UPDATED = 2
    DELETED = 3
    REPLAYED = 4


class ConfigurationStatusState(betterproto.Enum):
    UNKNOWN = 0
    SYNCHRONIZING = 1
    SYNCHRONIZED = 2
    PERSISTED = 3


class ConfigurationEventEventType(betterproto.Enum):
    UNKNOWN = 0
    CREATED = 1
    UPDATED = 2
    DELETED = 3
    REPLAYED = 4


class ProposalInitializePhaseState(betterproto.Enum):
    INITIALIZING = 0
    INITIALIZED = 1


class ProposalValidatePhaseState(betterproto.Enum):
    VALIDATING = 0
    VALIDATED = 1
    FAILED = 2


class ProposalCommitPhaseState(betterproto.Enum):
    COMMITTING = 0
    COMMITTED = 1


class ProposalApplyPhaseState(betterproto.Enum):
    APPLYING = 0
    APPLIED = 1
    FAILED = 2


class ProposalAbortPhaseState(betterproto.Enum):
    ABORTING = 0
    ABORTED = 1


class ProposalEventEventType(betterproto.Enum):
    UNKNOWN = 0
    CREATED = 1
    UPDATED = 2
    DELETED = 3
    REPLAYED = 4


@dataclass(eq=False, repr=False)
class TypedValue(betterproto.Message):
    """TypedValue is a value represented as a byte array"""

    # 'bytes' is the bytes array
    bytes: bytes = betterproto.bytes_field(1)
    # 'type' is the value type
    type: "ValueType" = betterproto.enum_field(2)
    # 'type_opts' is a set of type options
    type_opts: List[int] = betterproto.int32_field(3)

    def __post_init__(self) -> None:
        super().__post_init__()


@dataclass(eq=False, repr=False)
class PathValues(betterproto.Message):
    """PathValues is a set of path/value pairs"""

    # 'values' is a set of change values to apply
    values: Dict[str, "PathValue"] = betterproto.map_field(
        4, betterproto.TYPE_STRING, betterproto.TYPE_MESSAGE
    )

    def __post_init__(self) -> None:
        super().__post_init__()


@dataclass(eq=False, repr=False)
class PathValue(betterproto.Message):
    """PathValue is the state of a path/value in the configuration tree"""

    # 'path' is the path to change
    path: str = betterproto.string_field(1)
    # 'value' is the change value
    value: "TypedValue" = betterproto.message_field(2)
    # 'deleted' indicates whether this is a delete
    deleted: bool = betterproto.bool_field(3)

    def __post_init__(self) -> None:
        super().__post_init__()


@dataclass(eq=False, repr=False)
class ObjectMeta(betterproto.Message):
    """TypedValue is a value represented as a byte array"""

    # 'bytes' is the bytes array
    key: str = betterproto.string_field(1)
    # 'type' is the value type
    version: int = betterproto.uint64_field(2)
    # 'type_opts' is a set of type options
    revision: int = betterproto.uint64_field(3)
    created: datetime = betterproto.message_field(4)
    updated: datetime = betterproto.message_field(5)
    deleted: datetime = betterproto.message_field(6)

    def __post_init__(self) -> None:
        super().__post_init__()


@dataclass(eq=False, repr=False)
class TargetTypeVersion(betterproto.Message):
    """PathValues is a set of path/value pairs"""

    # 'values' is a set of change values to apply
    target_type: str = betterproto.string_field(1)
    target_version: str = betterproto.string_field(2)

    def __post_init__(self) -> None:
        super().__post_init__()


@dataclass(eq=False, repr=False)
class Failure(betterproto.Message):
    """TypedValue is a value represented as a byte array"""

    # 'bytes' is the bytes array
    type: "FailureType" = betterproto.enum_field(1)
    # 'type' is the value type
    description: str = betterproto.string_field(2)

    def __post_init__(self) -> None:
        super().__post_init__()


@dataclass(eq=False, repr=False)
class TransactionInfo(betterproto.Message):
    """TypedValue is a value represented as a byte array"""

    # 'bytes' is the bytes array
    id: str = betterproto.string_field(1)
    # 'type' is the value type
    index: int = betterproto.uint64_field(2)

    def __post_init__(self) -> None:
        super().__post_init__()


@dataclass(eq=False, repr=False)
class Transaction(betterproto.Message):
    """PathValues is a set of path/value pairs"""

    # 'values' is a set of change values to apply
    meta: "ObjectMeta" = betterproto.message_field(1)
    id: str = betterproto.string_field(2)
    index: int = betterproto.uint64_field(3)
    username: str = betterproto.string_field(4)
    strategy: "TransactionStrategy" = betterproto.message_field(5)
    change: "ChangeTransaction" = betterproto.message_field(6, group="details")
    rollback: "RollbackTransaction" = betterproto.message_field(7, group="details")
    status: "TransactionStatus" = betterproto.message_field(8)
    version_overrides: "TargetVersionOverrides" = betterproto.message_field(9)

    def __post_init__(self) -> None:
        super().__post_init__()


@dataclass(eq=False, repr=False)
class TransactionStrategy(betterproto.Message):
    """PathValue is the state of a path/value in the configuration tree"""

    # 'path' is the path to change
    synchronicity: "TransactionStrategySynchronicity" = betterproto.enum_field(1)
    # 'value' is the change value
    isolation: "TransactionStrategyIsolation" = betterproto.enum_field(2)

    def __post_init__(self) -> None:
        super().__post_init__()


@dataclass(eq=False, repr=False)
class ChangeTransaction(betterproto.Message):
    values: Dict[str, "PathValues"] = betterproto.map_field(
        1, betterproto.TYPE_STRING, betterproto.TYPE_MESSAGE
    )

    def __post_init__(self) -> None:
        super().__post_init__()


@dataclass(eq=False, repr=False)
class RollbackTransaction(betterproto.Message):
    rollback_index: int = betterproto.uint64_field(1)

    def __post_init__(self) -> None:
        super().__post_init__()


@dataclass(eq=False, repr=False)
class TransactionStatus(betterproto.Message):
    phases: "TransactionPhases" = betterproto.message_field(1)
    proposals: List[str] = betterproto.string_field(2)
    state: "TransactionStatusState" = betterproto.enum_field(3)
    failure: "Failure" = betterproto.message_field(4)

    def __post_init__(self) -> None:
        super().__post_init__()


@dataclass(eq=False, repr=False)
class TransactionPhases(betterproto.Message):
    initialize: "TransactionInitializePhase" = betterproto.message_field(1)
    validate: "TransactionValidatePhase" = betterproto.message_field(2)
    commit: "TransactionCommitPhase" = betterproto.message_field(3)
    apply: "TransactionApplyPhase" = betterproto.message_field(4)
    abort: "TransactionAbortPhase" = betterproto.message_field(5)

    def __post_init__(self) -> None:
        super().__post_init__()


@dataclass(eq=False, repr=False)
class TransactionPhaseStatus(betterproto.Message):
    start: datetime = betterproto.message_field(1)
    end: datetime = betterproto.message_field(2)

    def __post_init__(self) -> None:
        super().__post_init__()


@dataclass(eq=False, repr=False)
class TransactionInitializePhase(betterproto.Message):
    status: "TransactionPhaseStatus" = betterproto.message_field(1)
    state: "TransactionInitializePhaseState" = betterproto.enum_field(2)
    failure: "Failure" = betterproto.message_field(3)

    def __post_init__(self) -> None:
        super().__post_init__()


@dataclass(eq=False, repr=False)
class TransactionValidatePhase(betterproto.Message):
    status: "TransactionPhaseStatus" = betterproto.message_field(1)
    state: "TransactionValidatePhaseState" = betterproto.enum_field(2)
    failure: "Failure" = betterproto.message_field(3)

    def __post_init__(self) -> None:
        super().__post_init__()


@dataclass(eq=False, repr=False)
class TransactionCommitPhase(betterproto.Message):
    status: "TransactionPhaseStatus" = betterproto.message_field(1)
    state: "TransactionCommitPhaseState" = betterproto.enum_field(2)

    def __post_init__(self) -> None:
        super().__post_init__()


@dataclass(eq=False, repr=False)
class TransactionApplyPhase(betterproto.Message):
    status: "TransactionPhaseStatus" = betterproto.message_field(1)
    state: "TransactionApplyPhaseState" = betterproto.enum_field(2)
    failure: "Failure" = betterproto.message_field(3)

    def __post_init__(self) -> None:
        super().__post_init__()


@dataclass(eq=False, repr=False)
class TransactionAbortPhase(betterproto.Message):
    status: "TransactionPhaseStatus" = betterproto.message_field(1)
    state: "TransactionAbortPhaseState" = betterproto.enum_field(2)

    def __post_init__(self) -> None:
        super().__post_init__()


@dataclass(eq=False, repr=False)
class TransactionEvent(betterproto.Message):
    type: "TransactionEventEventType" = betterproto.enum_field(1)
    transaction: "Transaction" = betterproto.message_field(2)

    def __post_init__(self) -> None:
        super().__post_init__()


@dataclass(eq=False, repr=False)
class TargetVersionOverrides(betterproto.Message):
    overrides: Dict[str, "TargetTypeVersion"] = betterproto.map_field(
        1, betterproto.TYPE_STRING, betterproto.TYPE_MESSAGE
    )

    def __post_init__(self) -> None:
        super().__post_init__()


@dataclass(eq=False, repr=False)
class Configuration(betterproto.Message):
    """TypedValue is a value represented as a byte array"""

    # 'bytes' is the bytes array
    meta: "ObjectMeta" = betterproto.message_field(1)
    # 'type' is the value type
    id: str = betterproto.string_field(2)
    # 'type_opts' is a set of type options
    target_id: str = betterproto.string_field(3)
    values: Dict[str, "PathValue"] = betterproto.map_field(
        4, betterproto.TYPE_STRING, betterproto.TYPE_MESSAGE
    )
    index: int = betterproto.uint64_field(5)
    status: "ConfigurationStatus" = betterproto.message_field(6)
    target_info: "TargetTypeVersion" = betterproto.message_field(7)

    def __post_init__(self) -> None:
        super().__post_init__()


@dataclass(eq=False, repr=False)
class ConfigurationStatus(betterproto.Message):
    """PathValues is a set of path/value pairs"""

    # 'values' is a set of change values to apply
    state: "ConfigurationStatusState" = betterproto.enum_field(1)
    mastership: "MastershipInfo" = betterproto.message_field(2)
    proposed: "ProposedConfigurationStatus" = betterproto.message_field(3)
    committed: "CommittedConfigurationStatus" = betterproto.message_field(4)
    applied: "AppliedConfigurationStatus" = betterproto.message_field(5)

    def __post_init__(self) -> None:
        super().__post_init__()


@dataclass(eq=False, repr=False)
class ProposedConfigurationStatus(betterproto.Message):
    """PathValue is the state of a path/value in the configuration tree"""

    # 'path' is the path to change
    index: int = betterproto.uint64_field(1)

    def __post_init__(self) -> None:
        super().__post_init__()


@dataclass(eq=False, repr=False)
class CommittedConfigurationStatus(betterproto.Message):
    index: int = betterproto.uint64_field(1)

    def __post_init__(self) -> None:
        super().__post_init__()


@dataclass(eq=False, repr=False)
class AppliedConfigurationStatus(betterproto.Message):
    index: int = betterproto.uint64_field(1)
    mastership: "MastershipInfo" = betterproto.message_field(2)
    values: Dict[str, "PathValue"] = betterproto.map_field(
        3, betterproto.TYPE_STRING, betterproto.TYPE_MESSAGE
    )

    def __post_init__(self) -> None:
        super().__post_init__()


@dataclass(eq=False, repr=False)
class MastershipInfo(betterproto.Message):
    master: str = betterproto.string_field(1)
    term: int = betterproto.uint64_field(2)

    def __post_init__(self) -> None:
        super().__post_init__()


@dataclass(eq=False, repr=False)
class ConfigurationEvent(betterproto.Message):
    type: "ConfigurationEventEventType" = betterproto.enum_field(1)
    configuration: "Configuration" = betterproto.message_field(2)

    def __post_init__(self) -> None:
        super().__post_init__()


@dataclass(eq=False, repr=False)
class Proposal(betterproto.Message):
    """TypedValue is a value represented as a byte array"""

    # 'bytes' is the bytes array
    meta: "ObjectMeta" = betterproto.message_field(1)
    # 'type' is the value type
    id: str = betterproto.string_field(2)
    # 'type_opts' is a set of type options
    target_id: str = betterproto.string_field(3)
    transaction_index: int = betterproto.uint64_field(4)
    change: "ChangeProposal" = betterproto.message_field(5, group="details")
    rollback: "RollbackProposal" = betterproto.message_field(6, group="details")
    status: "ProposalStatus" = betterproto.message_field(7)
    target_info: "TargetTypeVersion" = betterproto.message_field(8)

    def __post_init__(self) -> None:
        super().__post_init__()


@dataclass(eq=False, repr=False)
class ChangeProposal(betterproto.Message):
    """PathValues is a set of path/value pairs"""

    # 'values' is a set of change values to apply
    values: Dict[str, "PathValue"] = betterproto.map_field(
        1, betterproto.TYPE_STRING, betterproto.TYPE_MESSAGE
    )

    def __post_init__(self) -> None:
        super().__post_init__()


@dataclass(eq=False, repr=False)
class RollbackProposal(betterproto.Message):
    """PathValue is the state of a path/value in the configuration tree"""

    # 'path' is the path to change
    rollback_index: int = betterproto.uint64_field(1)

    def __post_init__(self) -> None:
        super().__post_init__()


@dataclass(eq=False, repr=False)
class ProposalStatus(betterproto.Message):
    phases: "ProposalPhases" = betterproto.message_field(1)
    prev_index: int = betterproto.uint64_field(2)
    next_index: int = betterproto.uint64_field(3)
    rollback_index: int = betterproto.uint64_field(4)
    rollback_values: Dict[str, "PathValue"] = betterproto.map_field(
        5, betterproto.TYPE_STRING, betterproto.TYPE_MESSAGE
    )

    def __post_init__(self) -> None:
        super().__post_init__()


@dataclass(eq=False, repr=False)
class ProposalPhases(betterproto.Message):
    initialize: "ProposalInitializePhase" = betterproto.message_field(1)
    validate: "ProposalValidatePhase" = betterproto.message_field(2)
    commit: "ProposalCommitPhase" = betterproto.message_field(3)
    apply: "ProposalApplyPhase" = betterproto.message_field(4)
    abort: "ProposalAbortPhase" = betterproto.message_field(5)

    def __post_init__(self) -> None:
        super().__post_init__()


@dataclass(eq=False, repr=False)
class ProposalPhaseStatus(betterproto.Message):
    start: datetime = betterproto.message_field(1)
    end: datetime = betterproto.message_field(2)

    def __post_init__(self) -> None:
        super().__post_init__()


@dataclass(eq=False, repr=False)
class ProposalInitializePhase(betterproto.Message):
    status: "ProposalPhaseStatus" = betterproto.message_field(1)
    state: "ProposalInitializePhaseState" = betterproto.enum_field(2)

    def __post_init__(self) -> None:
        super().__post_init__()


@dataclass(eq=False, repr=False)
class ProposalValidatePhase(betterproto.Message):
    status: "ProposalPhaseStatus" = betterproto.message_field(1)
    state: "ProposalValidatePhaseState" = betterproto.enum_field(2)
    failure: "Failure" = betterproto.message_field(3)

    def __post_init__(self) -> None:
        super().__post_init__()


@dataclass(eq=False, repr=False)
class ProposalCommitPhase(betterproto.Message):
    status: "ProposalPhaseStatus" = betterproto.message_field(1)
    state: "ProposalCommitPhaseState" = betterproto.enum_field(2)

    def __post_init__(self) -> None:
        super().__post_init__()


@dataclass(eq=False, repr=False)
class ProposalApplyPhase(betterproto.Message):
    status: "ProposalPhaseStatus" = betterproto.message_field(1)
    state: "ProposalApplyPhaseState" = betterproto.enum_field(2)
    term: int = betterproto.uint64_field(3)
    failure: "Failure" = betterproto.message_field(4)

    def __post_init__(self) -> None:
        super().__post_init__()


@dataclass(eq=False, repr=False)
class ProposalAbortPhase(betterproto.Message):
    status: "ProposalPhaseStatus" = betterproto.message_field(1)
    state: "ProposalAbortPhaseState" = betterproto.enum_field(2)

    def __post_init__(self) -> None:
        super().__post_init__()


@dataclass(eq=False, repr=False)
class ProposalEvent(betterproto.Message):
    type: "ProposalEventEventType" = betterproto.enum_field(1)
    proposal: "Proposal" = betterproto.message_field(2)

    def __post_init__(self) -> None:
        super().__post_init__()
