"""
@generated by mypy-protobuf.  Do not edit manually!
isort:skip_file
Copyright 2024 Phonexia s.r.o.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

Phonexia Language Identification gRPC API.
"""

import builtins
import collections.abc
import google.protobuf.descriptor
import google.protobuf.duration_pb2
import google.protobuf.internal.containers
import google.protobuf.internal.enum_type_wrapper
import google.protobuf.message
import phonexia.grpc.common.core_pb2
import sys
import typing

if sys.version_info >= (3, 10):
    import typing as typing_extensions
else:
    import typing_extensions

DESCRIPTOR: google.protobuf.descriptor.FileDescriptor

@typing.final
class IdentifyRequest(google.protobuf.message.Message):
    """The top level message sent by the client for the <code>Identify</code> method."""

    DESCRIPTOR: google.protobuf.descriptor.Descriptor

    AUDIO_FIELD_NUMBER: builtins.int
    CONFIG_FIELD_NUMBER: builtins.int
    @property
    def audio(self) -> phonexia.grpc.common.core_pb2.Audio:
        """Audio data to be identified."""

    @property
    def config(self) -> global___IdentifyConfig:
        """Configuration for the language identification."""

    def __init__(
        self,
        *,
        audio: phonexia.grpc.common.core_pb2.Audio | None = ...,
        config: global___IdentifyConfig | None = ...,
    ) -> None: ...
    def HasField(self, field_name: typing.Literal["audio", b"audio", "config", b"config"]) -> builtins.bool: ...
    def ClearField(self, field_name: typing.Literal["audio", b"audio", "config", b"config"]) -> None: ...

global___IdentifyRequest = IdentifyRequest

@typing.final
class IdentifyResponse(google.protobuf.message.Message):
    """The top level message returned to the client by the <code>Identify</code> method."""

    DESCRIPTOR: google.protobuf.descriptor.Descriptor

    RESULT_FIELD_NUMBER: builtins.int
    PROCESSED_AUDIO_LENGTH_FIELD_NUMBER: builtins.int
    @property
    def result(self) -> global___LanguageIdentificationResult:
        """Result of language identification."""

    @property
    def processed_audio_length(self) -> google.protobuf.duration_pb2.Duration:
        """When available, total length of the processed audio.
        Set only if this is the last response in the stream.
        """

    def __init__(
        self,
        *,
        result: global___LanguageIdentificationResult | None = ...,
        processed_audio_length: google.protobuf.duration_pb2.Duration | None = ...,
    ) -> None: ...
    def HasField(self, field_name: typing.Literal["processed_audio_length", b"processed_audio_length", "result", b"result"]) -> builtins.bool: ...
    def ClearField(self, field_name: typing.Literal["processed_audio_length", b"processed_audio_length", "result", b"result"]) -> None: ...

global___IdentifyResponse = IdentifyResponse

@typing.final
class ListSupportedLanguagesRequest(google.protobuf.message.Message):
    """The top-level message sent by the client for the <code>ListSupportedLanguages</code> method."""

    DESCRIPTOR: google.protobuf.descriptor.Descriptor

    def __init__(
        self,
    ) -> None: ...

global___ListSupportedLanguagesRequest = ListSupportedLanguagesRequest

@typing.final
class ListSupportedLanguagesResponse(google.protobuf.message.Message):
    """The top-level message returned to the client by the <code>ListSupportedLanguages</code>."""

    DESCRIPTOR: google.protobuf.descriptor.Descriptor

    SUPPORTED_LANGUAGES_FIELD_NUMBER: builtins.int
    @property
    def supported_languages(self) -> google.protobuf.internal.containers.RepeatedScalarFieldContainer[builtins.str]:
        """List of supported languages."""

    def __init__(
        self,
        *,
        supported_languages: collections.abc.Iterable[builtins.str] | None = ...,
    ) -> None: ...
    def ClearField(self, field_name: typing.Literal["supported_languages", b"supported_languages"]) -> None: ...

global___ListSupportedLanguagesResponse = ListSupportedLanguagesResponse

@typing.final
class IdentifyConfig(google.protobuf.message.Message):
    DESCRIPTOR: google.protobuf.descriptor.Descriptor

    SPEECH_LENGTH_FIELD_NUMBER: builtins.int
    LANGUAGES_FIELD_NUMBER: builtins.int
    GROUPS_FIELD_NUMBER: builtins.int
    @property
    def speech_length(self) -> google.protobuf.duration_pb2.Duration:
        """Specifies the maximum speech length from which the languages will be
        identified. If there is less speech in the audio than the specified
        duration, the languages will be identified from the entire audio.
        """

    @property
    def languages(self) -> google.protobuf.internal.containers.RepeatedCompositeFieldContainer[global___Language]:
        """Specify which languages can be used for language identification.
        Choose only from list of supported languages, which can be retrieved at <code>ListSuportedlanguages</code>.
        Choosing desired languages redistributes the probabilities of excluded languages into the rest of languages relative
        to their scores. Excluding a dialect of a language may however result in inaccurate scores for other dialects in cases
        when the excluded dialect would have a probability score close to 1.
        Leaving this field empty is the same as selecting every supported language.
        """

    @property
    def groups(self) -> google.protobuf.internal.containers.RepeatedCompositeFieldContainer[global___LanguageGroup]:
        """Create custom groups of languages and assign them a common identifier.
        By defining a group a new entity that encapsulates the group languages is created. This group holds the scores of the
        individual languages as well as their sum.
        One of the use cases for using groups may be grouping individual language dialects into one encapsulating group.  
        Groups of languages mustn't intersect, that means a language can only be part of at most one group.
        """

    def __init__(
        self,
        *,
        speech_length: google.protobuf.duration_pb2.Duration | None = ...,
        languages: collections.abc.Iterable[global___Language] | None = ...,
        groups: collections.abc.Iterable[global___LanguageGroup] | None = ...,
    ) -> None: ...
    def HasField(self, field_name: typing.Literal["speech_length", b"speech_length"]) -> builtins.bool: ...
    def ClearField(self, field_name: typing.Literal["groups", b"groups", "languages", b"languages", "speech_length", b"speech_length"]) -> None: ...

global___IdentifyConfig = IdentifyConfig

@typing.final
class Language(google.protobuf.message.Message):
    """Message for selecting specific language."""

    DESCRIPTOR: google.protobuf.descriptor.Descriptor

    LANGUAGE_CODE_FIELD_NUMBER: builtins.int
    language_code: builtins.str
    """Language code in RFC 5646 format."""
    def __init__(
        self,
        *,
        language_code: builtins.str = ...,
    ) -> None: ...
    def ClearField(self, field_name: typing.Literal["language_code", b"language_code"]) -> None: ...

global___Language = Language

@typing.final
class LanguageGroup(google.protobuf.message.Message):
    """Message defining language group.
    Group several languages and assigns them common identifier.
    Defining group produces score for the individual languages as well as for the language groups.
    """

    DESCRIPTOR: google.protobuf.descriptor.Descriptor

    IDENTIFIER_FIELD_NUMBER: builtins.int
    LANGUAGE_CODES_FIELD_NUMBER: builtins.int
    identifier: builtins.str
    """Identifier of created group.
    This identifier will be used in <code>LanguageIdentificationScore</code>.
    Group identifier must be unique among all groups and languages.
    """
    @property
    def language_codes(self) -> google.protobuf.internal.containers.RepeatedScalarFieldContainer[builtins.str]:
        """Set of languages forming this group."""

    def __init__(
        self,
        *,
        identifier: builtins.str = ...,
        language_codes: collections.abc.Iterable[builtins.str] | None = ...,
    ) -> None: ...
    def ClearField(self, field_name: typing.Literal["identifier", b"identifier", "language_codes", b"language_codes"]) -> None: ...

global___LanguageGroup = LanguageGroup

@typing.final
class LanguageIdentificationResult(google.protobuf.message.Message):
    """Message representing the result of language identification."""

    DESCRIPTOR: google.protobuf.descriptor.Descriptor

    SPEECH_LENGTH_FIELD_NUMBER: builtins.int
    SCORES_FIELD_NUMBER: builtins.int
    @property
    def speech_length(self) -> google.protobuf.duration_pb2.Duration:
        """Speech length from which the languageprint was extracted."""

    @property
    def scores(self) -> google.protobuf.internal.containers.RepeatedCompositeFieldContainer[global___LanguageIdentificationScore]:
        """List of scores for each selected language and language group.
        This list holds N elements, where:
        N = (number of supported languages) + (number of groups) - (number of languages defined within groups).

        Example: For 140 supported langauges and 2 groups each containing 4 unique langueges
        this field holds: 140 + 2 - (2 * 4) = 134 elements including 132 languages and 2 groups.
        Scores of the individual languages from the groups are embeded within the groups.
        """

    def __init__(
        self,
        *,
        speech_length: google.protobuf.duration_pb2.Duration | None = ...,
        scores: collections.abc.Iterable[global___LanguageIdentificationScore] | None = ...,
    ) -> None: ...
    def HasField(self, field_name: typing.Literal["speech_length", b"speech_length"]) -> builtins.bool: ...
    def ClearField(self, field_name: typing.Literal["scores", b"scores", "speech_length", b"speech_length"]) -> None: ...

global___LanguageIdentificationResult = LanguageIdentificationResult

@typing.final
class LanguageIdentificationScore(google.protobuf.message.Message):
    """Score for a single language or language group."""

    DESCRIPTOR: google.protobuf.descriptor.Descriptor

    class _IdentifierType:
        ValueType = typing.NewType("ValueType", builtins.int)
        V: typing_extensions.TypeAlias = ValueType

    class _IdentifierTypeEnumTypeWrapper(google.protobuf.internal.enum_type_wrapper._EnumTypeWrapper[LanguageIdentificationScore._IdentifierType.ValueType], builtins.type):
        DESCRIPTOR: google.protobuf.descriptor.EnumDescriptor
        LANGUAGE: LanguageIdentificationScore._IdentifierType.ValueType  # 0
        """The identifier specifies a single built-in language."""
        GROUP: LanguageIdentificationScore._IdentifierType.ValueType  # 1
        """The identifier specifies a user-defined group of languages."""

    class IdentifierType(_IdentifierType, metaclass=_IdentifierTypeEnumTypeWrapper):
        """Enumeration of supported identifier types."""

    LANGUAGE: LanguageIdentificationScore.IdentifierType.ValueType  # 0
    """The identifier specifies a single built-in language."""
    GROUP: LanguageIdentificationScore.IdentifierType.ValueType  # 1
    """The identifier specifies a user-defined group of languages."""

    IDENTIFIER_FIELD_NUMBER: builtins.int
    PROBABILITY_FIELD_NUMBER: builtins.int
    LANGUAGES_FIELD_NUMBER: builtins.int
    IDENTIFIER_TYPE_FIELD_NUMBER: builtins.int
    identifier: builtins.str
    """This field contains either a language code (specified by RFC 5646) or a language
    group identifier.
    """
    probability: builtins.float
    """Score for this language or language group.
    The score represents the probability of the input belonging to a particular
    language/group.
    Language group probability is the sum of the probabilities of its languages.
    """
    identifier_type: global___LanguageIdentificationScore.IdentifierType.ValueType
    """This field explicitly identifies the score as belonging to either an individual
    language or a language group.
    """
    @property
    def languages(self) -> google.protobuf.internal.containers.RepeatedCompositeFieldContainer[global___LanguageIdentificationScore]:
        """This field is only set for language groups. 
        Scores for individual languages that this group is comprised of can be found in
        this field.
        """

    def __init__(
        self,
        *,
        identifier: builtins.str = ...,
        probability: builtins.float = ...,
        languages: collections.abc.Iterable[global___LanguageIdentificationScore] | None = ...,
        identifier_type: global___LanguageIdentificationScore.IdentifierType.ValueType = ...,
    ) -> None: ...
    def ClearField(self, field_name: typing.Literal["identifier", b"identifier", "identifier_type", b"identifier_type", "languages", b"languages", "probability", b"probability"]) -> None: ...

global___LanguageIdentificationScore = LanguageIdentificationScore
