# Generated by the protocol buffer compiler.  DO NOT EDIT!
# sources: temporal/api/common/v1/message.proto
# plugin: python-betterproto
from dataclasses import dataclass
from datetime import timedelta
from typing import Dict, List

import betterproto

from temporal.api.enums import v1 as v1enums


@dataclass
class DataBlob(betterproto.Message):
    encoding_type: v1enums.EncodingType = betterproto.enum_field(1)
    data: bytes = betterproto.bytes_field(2)


@dataclass
class Payloads(betterproto.Message):
    payloads: List["Payload"] = betterproto.message_field(1)


@dataclass
class Payload(betterproto.Message):
    metadata: Dict[str, bytes] = betterproto.map_field(
        1, betterproto.TYPE_STRING, betterproto.TYPE_BYTES
    )
    data: bytes = betterproto.bytes_field(2)


@dataclass
class SearchAttributes(betterproto.Message):
    indexed_fields: Dict[str, "Payload"] = betterproto.map_field(
        1, betterproto.TYPE_STRING, betterproto.TYPE_MESSAGE
    )


@dataclass
class Memo(betterproto.Message):
    fields: Dict[str, "Payload"] = betterproto.map_field(
        1, betterproto.TYPE_STRING, betterproto.TYPE_MESSAGE
    )


@dataclass
class Header(betterproto.Message):
    fields: Dict[str, "Payload"] = betterproto.map_field(
        1, betterproto.TYPE_STRING, betterproto.TYPE_MESSAGE
    )


@dataclass
class WorkflowExecution(betterproto.Message):
    workflow_id: str = betterproto.string_field(1)
    run_id: str = betterproto.string_field(2)


@dataclass
class WorkflowType(betterproto.Message):
    name: str = betterproto.string_field(1)


@dataclass
class ActivityType(betterproto.Message):
    name: str = betterproto.string_field(1)


@dataclass
class RetryPolicy(betterproto.Message):
    # Interval of the first retry. If retryBackoffCoefficient is 1.0 then it is
    # used for all retries.
    initial_interval: timedelta = betterproto.message_field(1)
    # Coefficient used to calculate the next retry interval. The next retry
    # interval is previous interval multiplied by the coefficient. Must be 1 or
    # larger.
    backoff_coefficient: float = betterproto.double_field(2)
    # Maximum interval between retries. Exponential backoff leads to interval
    # increase. This value is the cap of the increase. Default is 100x of the
    # initial interval.
    maximum_interval: timedelta = betterproto.message_field(3)
    # Maximum number of attempts. When exceeded the retries stop even if not
    # expired yet. 1 disables retries. 0 means unlimited (up to the timeouts)
    maximum_attempts: int = betterproto.int32_field(4)
    # Non-Retryable errors types. Will stop retrying if error type matches this
    # list.
    non_retryable_error_types: List[str] = betterproto.string_field(5)
