# Copyright (c) 2025-2026 Buf Technologies, Inc.
#
# 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.

# Generated from google/protobuf/go_features.proto. DO NOT EDIT.
# Generated by protoc-gen-py v0.1.1 with parameter "no_fmt_off".
# ruff: noqa: PGH004
# ruff: noqa

from __future__ import annotations

from typing import Final, Literal, NoReturn, TYPE_CHECKING, TypeAlias

from protobuf import Enum, Extension, Message
from protobuf._codegen import file_desc

from . import descriptor_pb
from .descriptor_pb import FeatureSet

if TYPE_CHECKING:
    from protobuf import DescFile


_GoFeaturesFields: TypeAlias = Literal[
    "legacy_unmarshal_json_enum", "api_level", "strip_enum_prefix", "optimize_mode"
]


class GoFeatures(Message[_GoFeaturesFields]):
    """
    ```proto
    message pb.GoFeatures
    ```

    Attributes:
        legacy_unmarshal_json_enum:
            Whether or not to generate the deprecated UnmarshalJSON method for enums.
            Can only be true for proto using the Open Struct api.

            ```proto
            optional bool legacy_unmarshal_json_enum = 1;
            ```
        api_level:
            One of OPEN, HYBRID or OPAQUE.

            ```proto
            optional pb.GoFeatures.APILevel api_level = 2;
            ```
        strip_enum_prefix:
            ```proto
            optional pb.GoFeatures.StripEnumPrefix strip_enum_prefix = 3;
            ```
        optimize_mode:
            ```proto
            optional pb.GoFeatures.OptimizeModeFeature.OptimizeMode optimize_mode = 4;
            ```
    """

    __slots__ = (
        "legacy_unmarshal_json_enum",
        "api_level",
        "strip_enum_prefix",
        "optimize_mode",
    )

    if TYPE_CHECKING:

        def __init__(
            self,
            *,
            legacy_unmarshal_json_enum: bool | None = None,
            api_level: GoFeatures.APILevel | None = None,
            strip_enum_prefix: GoFeatures.StripEnumPrefix | None = None,
            optimize_mode: GoFeatures.OptimizeModeFeature.OptimizeMode | None = None,
        ) -> None:
            pass

        legacy_unmarshal_json_enum: bool
        api_level: GoFeatures.APILevel
        strip_enum_prefix: GoFeatures.StripEnumPrefix
        optimize_mode: GoFeatures.OptimizeModeFeature.OptimizeMode

    _OptimizeModeFeatureFields: TypeAlias = NoReturn

    class OptimizeModeFeature(Message[_OptimizeModeFeatureFields]):
        """
        Wrap the OptimizeMode enum in a message for scoping:
        This way, users can type shorter names (SPEED, CODE_SIZE).

        ```proto
        message pb.GoFeatures.OptimizeModeFeature
        ```
        """

        __slots__ = ()

        if TYPE_CHECKING:

            def __init__(self) -> None:
                pass

        class OptimizeMode(Enum):
            """
            The name of this enum matches OptimizeMode in descriptor.proto.

            ```proto
            enum pb.GoFeatures.OptimizeModeFeature.OptimizeMode
            ```

            Attributes:
                UNSPECIFIED:
                    OPTIMIZE_MODE_UNSPECIFIED results in falling back to the default
                    (optimize for code size), but needs to be a separate value to distinguish
                    between an explicitly set optimize mode or a missing optimize mode.

                    ```proto
                    OPTIMIZE_MODE_UNSPECIFIED = 0
                    ```
                SPEED:
                    ```proto
                    SPEED = 1
                    ```
                CODE_SIZE:
                    There is no enum entry for LITE_RUNTIME (descriptor.proto),
                    because Go Protobuf does not have the concept of a lite runtime.

                    ```proto
                    CODE_SIZE = 2
                    ```
            """

            UNSPECIFIED = 0
            SPEED = 1
            CODE_SIZE = 2

    class APILevel(Enum):
        """
        ```proto
        enum pb.GoFeatures.APILevel
        ```

        Attributes:
            UNSPECIFIED:
                API_LEVEL_UNSPECIFIED results in selecting the OPEN API,
                but needs to be a separate value to distinguish between
                an explicitly set api level or a missing api level.

                ```proto
                API_LEVEL_UNSPECIFIED = 0
                ```
            API_OPEN:
                ```proto
                API_OPEN = 1
                ```
            API_HYBRID:
                ```proto
                API_HYBRID = 2
                ```
            API_OPAQUE:
                ```proto
                API_OPAQUE = 3
                ```
        """

        UNSPECIFIED = 0
        API_OPEN = 1
        API_HYBRID = 2
        API_OPAQUE = 3

    class StripEnumPrefix(Enum):
        """
        ```proto
        enum pb.GoFeatures.StripEnumPrefix
        ```

        Attributes:
            UNSPECIFIED:
                ```proto
                STRIP_ENUM_PREFIX_UNSPECIFIED = 0
                ```
            KEEP:
                ```proto
                STRIP_ENUM_PREFIX_KEEP = 1
                ```
            GENERATE_BOTH:
                ```proto
                STRIP_ENUM_PREFIX_GENERATE_BOTH = 2
                ```
            STRIP:
                ```proto
                STRIP_ENUM_PREFIX_STRIP = 3
                ```
        """

        UNSPECIFIED = 0
        KEEP = 1
        GENERATE_BOTH = 2
        STRIP = 3


ext_go: Final[Extension[FeatureSet, GoFeatures]] = Extension()
"""
```proto
extend google.protobuf.FeatureSet { optional pb.GoFeatures go = 1002 [json_name = "[pb.go]"] }
```
"""


_DESC = file_desc(
    b'\n!google/protobuf/go_features.proto\x12\x02pb\x1a google/protobuf/descriptor.proto"\x94\x07\n\nGoFeatures\x12\xbe\x01\n\x1alegacy_unmarshal_json_enum\x18\x01 \x01(\x08R\x17legacyUnmarshalJsonEnumB\x80\x01\x88\x01\x01\x98\x01\x06\x98\x01\x01\xa2\x01\t\x18\x84\x07\x12\x04true\xa2\x01\n\x18\xe7\x07\x12\x05false\xb2\x01[\x08\xe8\x07\x10\xe8\x07\x1aSThe legacy UnmarshalJSON API is deprecated and will be removed in a future edition.\x12t\n\tapi_level\x18\x02 \x01(\x0e2\x17.pb.GoFeatures.APILevelR\x08apiLevelB>\x88\x01\x01\x98\x01\x03\x98\x01\x01\xa2\x01\x1a\x18\x84\x07\x12\x15API_LEVEL_UNSPECIFIED\xa2\x01\x0f\x18\xe9\x07\x12\nAPI_OPAQUE\xb2\x01\x03\x08\xe8\x07\x12|\n\x11strip_enum_prefix\x18\x03 \x01(\x0e2\x1e.pb.GoFeatures.StripEnumPrefixR\x0fstripEnumPrefixB0\x88\x01\x01\x98\x01\x06\x98\x01\x07\x98\x01\x01\xa2\x01\x1b\x18\x84\x07\x12\x16STRIP_ENUM_PREFIX_KEEP\xb2\x01\x03\x08\xe9\x07\x12\x86\x01\n\roptimize_mode\x18\x04 \x01(\x0e2/.pb.GoFeatures.OptimizeModeFeature.OptimizeModeR\x0coptimizeModeB0\x88\x01\x01\x98\x01\x03\x98\x01\x01\xa2\x01\x1e\x18\x84\x07\x12\x19OPTIMIZE_MODE_UNSPECIFIED\xb2\x01\x03\x08\xe9\x07\x1a^\n\x13OptimizeModeFeature"G\n\x0cOptimizeMode\x12\x1d\n\x19OPTIMIZE_MODE_UNSPECIFIED\x10\x00\x12\t\n\x05SPEED\x10\x01\x12\r\n\tCODE_SIZE\x10\x02"S\n\x08APILevel\x12\x19\n\x15API_LEVEL_UNSPECIFIED\x10\x00\x12\x0c\n\x08API_OPEN\x10\x01\x12\x0e\n\nAPI_HYBRID\x10\x02\x12\x0e\n\nAPI_OPAQUE\x10\x03"\x92\x01\n\x0fStripEnumPrefix\x12!\n\x1dSTRIP_ENUM_PREFIX_UNSPECIFIED\x10\x00\x12\x1a\n\x16STRIP_ENUM_PREFIX_KEEP\x10\x01\x12#\n\x1fSTRIP_ENUM_PREFIX_GENERATE_BOTH\x10\x02\x12\x1b\n\x17STRIP_ENUM_PREFIX_STRIP\x10\x03:<\n\x02go\x18\xea\x07 \x01(\x0b2\x0e.pb.GoFeatures\x12\x1b.google.protobuf.FeatureSetR\x02goB/Z-google.golang.org/protobuf/types/gofeaturespb',
    [descriptor_pb.desc()],
    {
        "GoFeatures": GoFeatures,
        "GoFeatures.OptimizeModeFeature": GoFeatures.OptimizeModeFeature,
        "GoFeatures.OptimizeModeFeature.OptimizeMode": GoFeatures.OptimizeModeFeature.OptimizeMode,
        "GoFeatures.APILevel": GoFeatures.APILevel,
        "GoFeatures.StripEnumPrefix": GoFeatures.StripEnumPrefix,
        "go": ext_go,
    },
)


def desc() -> DescFile:
    """Returns the descriptor for the file `google/protobuf/go_features.proto`."""
    return _DESC
