# -*- coding: utf-8 -*-
# Copyright 2024 Google LLC
#
# 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.
#
from __future__ import annotations

from typing import MutableMapping, MutableSequence

from google.protobuf import any_pb2  # type: ignore
from google.protobuf import duration_pb2  # type: ignore
from google.protobuf import field_mask_pb2  # type: ignore
from google.protobuf import struct_pb2  # type: ignore
from google.protobuf import timestamp_pb2  # type: ignore
from google.rpc import status_pb2  # type: ignore
from google.type import datetime_pb2  # type: ignore
import proto  # type: ignore

__protobuf__ = proto.module(
    package="google.cloud.visionai.v1alpha1",
    manifest={
        "FacetBucketType",
        "CreateAssetRequest",
        "GetAssetRequest",
        "ListAssetsRequest",
        "ListAssetsResponse",
        "UpdateAssetRequest",
        "DeleteAssetRequest",
        "Asset",
        "CreateCorpusRequest",
        "CreateCorpusMetadata",
        "Corpus",
        "GetCorpusRequest",
        "UpdateCorpusRequest",
        "ListCorporaRequest",
        "ListCorporaResponse",
        "DeleteCorpusRequest",
        "CreateDataSchemaRequest",
        "DataSchema",
        "DataSchemaDetails",
        "UpdateDataSchemaRequest",
        "GetDataSchemaRequest",
        "DeleteDataSchemaRequest",
        "ListDataSchemasRequest",
        "ListDataSchemasResponse",
        "CreateAnnotationRequest",
        "Annotation",
        "UserSpecifiedAnnotation",
        "GeoCoordinate",
        "AnnotationValue",
        "ListAnnotationsRequest",
        "ListAnnotationsResponse",
        "GetAnnotationRequest",
        "UpdateAnnotationRequest",
        "DeleteAnnotationRequest",
        "CreateSearchConfigRequest",
        "UpdateSearchConfigRequest",
        "GetSearchConfigRequest",
        "DeleteSearchConfigRequest",
        "ListSearchConfigsRequest",
        "ListSearchConfigsResponse",
        "SearchConfig",
        "FacetProperty",
        "SearchCriteriaProperty",
        "FacetValue",
        "FacetBucket",
        "FacetGroup",
        "IngestAssetRequest",
        "IngestAssetResponse",
        "ClipAssetRequest",
        "ClipAssetResponse",
        "GenerateHlsUriRequest",
        "GenerateHlsUriResponse",
        "SearchAssetsRequest",
        "DeleteAssetMetadata",
        "AnnotationMatchingResult",
        "SearchResultItem",
        "SearchAssetsResponse",
        "IntRange",
        "FloatRange",
        "StringArray",
        "IntRangeArray",
        "FloatRangeArray",
        "DateTimeRange",
        "DateTimeRangeArray",
        "CircleArea",
        "GeoLocationArray",
        "BoolValue",
        "Criteria",
        "Partition",
    },
)


class FacetBucketType(proto.Enum):
    r"""Different types for a facet bucket.

    Values:
        FACET_BUCKET_TYPE_UNSPECIFIED (0):
            Unspecified type.
        FACET_BUCKET_TYPE_VALUE (1):
            Value type.
        FACET_BUCKET_TYPE_DATETIME (2):
            Datetime type.
        FACET_BUCKET_TYPE_FIXED_RANGE (3):
            Fixed Range type.
        FACET_BUCKET_TYPE_CUSTOM_RANGE (4):
            Custom Range type.
    """
    FACET_BUCKET_TYPE_UNSPECIFIED = 0
    FACET_BUCKET_TYPE_VALUE = 1
    FACET_BUCKET_TYPE_DATETIME = 2
    FACET_BUCKET_TYPE_FIXED_RANGE = 3
    FACET_BUCKET_TYPE_CUSTOM_RANGE = 4


class CreateAssetRequest(proto.Message):
    r"""Request message for CreateAssetRequest.

    .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields

    Attributes:
        parent (str):
            Required. The parent resource where this asset will be
            created. Format: projects/\ */locations/*/corpora/\*
        asset (google.cloud.visionai_v1alpha1.types.Asset):
            Required. The asset to create.
        asset_id (str):
            Optional. The ID to use for the asset, which will become the
            final component of the asset's resource name if user choose
            to specify. Otherwise, asset id will be generated by system.

            This value should be up to 63 characters, and valid
            characters are /[a-z][0-9]-/. The first character must be a
            letter, the last could be a letter or a number.

            This field is a member of `oneof`_ ``_asset_id``.
    """

    parent: str = proto.Field(
        proto.STRING,
        number=1,
    )
    asset: "Asset" = proto.Field(
        proto.MESSAGE,
        number=2,
        message="Asset",
    )
    asset_id: str = proto.Field(
        proto.STRING,
        number=3,
        optional=True,
    )


class GetAssetRequest(proto.Message):
    r"""Request message for GetAsset.

    Attributes:
        name (str):
            Required. The name of the asset to retrieve. Format:
            projects/{project_number}/locations/{location}/corpora/{corpus}/assets/{asset}
    """

    name: str = proto.Field(
        proto.STRING,
        number=1,
    )


class ListAssetsRequest(proto.Message):
    r"""Request message for ListAssets.

    Attributes:
        parent (str):
            Required. The parent, which owns this collection of assets.
            Format:
            projects/{project_number}/locations/{location}/corpora/{corpus}
        page_size (int):
            The maximum number of assets to return. The
            service may return fewer than this value.
            If unspecified, at most 50 assets will be
            returned. The maximum value is 1000; values
            above 1000 will be coerced to 1000.
        page_token (str):
            A page token, received from a previous ``ListAssets`` call.
            Provide this to retrieve the subsequent page.

            When paginating, all other parameters provided to
            ``ListAssets`` must match the call that provided the page
            token.
    """

    parent: str = proto.Field(
        proto.STRING,
        number=1,
    )
    page_size: int = proto.Field(
        proto.INT32,
        number=2,
    )
    page_token: str = proto.Field(
        proto.STRING,
        number=3,
    )


class ListAssetsResponse(proto.Message):
    r"""Response message for ListAssets.

    Attributes:
        assets (MutableSequence[google.cloud.visionai_v1alpha1.types.Asset]):
            The assets from the specified corpus.
        next_page_token (str):
            A token, which can be sent as ``page_token`` to retrieve the
            next page. If this field is omitted, there are no subsequent
            pages.
    """

    @property
    def raw_page(self):
        return self

    assets: MutableSequence["Asset"] = proto.RepeatedField(
        proto.MESSAGE,
        number=1,
        message="Asset",
    )
    next_page_token: str = proto.Field(
        proto.STRING,
        number=2,
    )


class UpdateAssetRequest(proto.Message):
    r"""Response message for UpdateAsset.

    Attributes:
        asset (google.cloud.visionai_v1alpha1.types.Asset):
            Required. The asset to update.

            The asset's ``name`` field is used to identify the asset to
            be updated. Format:
            projects/{project_number}/locations/{location}/corpora/{corpus}/assets/{asset}
        update_mask (google.protobuf.field_mask_pb2.FieldMask):
            The list of fields to be updated.
    """

    asset: "Asset" = proto.Field(
        proto.MESSAGE,
        number=1,
        message="Asset",
    )
    update_mask: field_mask_pb2.FieldMask = proto.Field(
        proto.MESSAGE,
        number=2,
        message=field_mask_pb2.FieldMask,
    )


class DeleteAssetRequest(proto.Message):
    r"""Request message for DeleteAsset.

    Attributes:
        name (str):
            Required. The name of the asset to delete. Format:
            projects/{project_number}/locations/{location}/corpora/{corpus}/assets/{asset}
    """

    name: str = proto.Field(
        proto.STRING,
        number=1,
    )


class Asset(proto.Message):
    r"""An asset is a resource in corpus. It represents a media
    object inside corpus, contains metadata and another resource
    annotation. Different feature could be applied to the asset to
    generate annotations. User could specified annotation related to
    the target asset.

    Attributes:
        name (str):
            Resource name of the asset. Form:
            ``projects/{project_number}/locations/{location_id}/corpora/{corpus_id}/assets/{asset_id}``
        ttl (google.protobuf.duration_pb2.Duration):
            The duration for which all media assets,
            associated metadata, and search documents can
            exist. If not set, then it will using the
            default ttl in the parent corpus resource.
    """

    name: str = proto.Field(
        proto.STRING,
        number=1,
    )
    ttl: duration_pb2.Duration = proto.Field(
        proto.MESSAGE,
        number=2,
        message=duration_pb2.Duration,
    )


class CreateCorpusRequest(proto.Message):
    r"""Request message of CreateCorpus API.

    Attributes:
        parent (str):
            Required. Form:
            ``projects/{project_number}/locations/{location_id}``
        corpus (google.cloud.visionai_v1alpha1.types.Corpus):
            Required. The corpus to be created.
    """

    parent: str = proto.Field(
        proto.STRING,
        number=1,
    )
    corpus: "Corpus" = proto.Field(
        proto.MESSAGE,
        number=2,
        message="Corpus",
    )


class CreateCorpusMetadata(proto.Message):
    r"""Metadata for CreateCorpus API."""


class Corpus(proto.Message):
    r"""Corpus is a set of video contents for management. Within a
    corpus, videos share the same data schema. Search is also
    restricted within a single corpus.

    Attributes:
        name (str):
            Resource name of the corpus. Form:
            ``projects/{project_number}/locations/{location_id}/corpora/{corpus_id}``
        display_name (str):
            Required. The corpus name to shown in the UI.
            The name can be up to 32 characters long.
        description (str):
            Optional. Description of the corpus. Can be
            up to 25000 characters long.
        default_ttl (google.protobuf.duration_pb2.Duration):
            Required. The default TTL value for all
            assets under the corpus without a asset level
            user-defined TTL with a maximum of 10 years.
            This is required for all corpora.
    """

    name: str = proto.Field(
        proto.STRING,
        number=1,
    )
    display_name: str = proto.Field(
        proto.STRING,
        number=2,
    )
    description: str = proto.Field(
        proto.STRING,
        number=3,
    )
    default_ttl: duration_pb2.Duration = proto.Field(
        proto.MESSAGE,
        number=5,
        message=duration_pb2.Duration,
    )


class GetCorpusRequest(proto.Message):
    r"""Request message for GetCorpus.

    Attributes:
        name (str):
            Required. The resource name of the corpus to
            retrieve.
    """

    name: str = proto.Field(
        proto.STRING,
        number=1,
    )


class UpdateCorpusRequest(proto.Message):
    r"""Request message for UpdateCorpus.

    Attributes:
        corpus (google.cloud.visionai_v1alpha1.types.Corpus):
            Required. The corpus which replaces the
            resource on the server.
        update_mask (google.protobuf.field_mask_pb2.FieldMask):
            The list of fields to be updated.
    """

    corpus: "Corpus" = proto.Field(
        proto.MESSAGE,
        number=1,
        message="Corpus",
    )
    update_mask: field_mask_pb2.FieldMask = proto.Field(
        proto.MESSAGE,
        number=2,
        message=field_mask_pb2.FieldMask,
    )


class ListCorporaRequest(proto.Message):
    r"""Request message for ListCorpora.

    Attributes:
        parent (str):
            Required. The resource name of the project
            from which to list corpora.
        page_size (int):
            Requested page size. API may return fewer results than
            requested. If negative, INVALID_ARGUMENT error will be
            returned. If unspecified or 0, API will pick a default size,
            which is 10. If the requested page size is larger than the
            maximum size, API will pick use the maximum size, which is
            20.
        page_token (str):
            A token identifying a page of results for the server to
            return. Typically obtained via
            [ListCorpora.next_page_token][] of the previous
            [Warehouse.ListCorpora][google.cloud.visionai.v1alpha1.Warehouse.ListCorpora]
            call.
    """

    parent: str = proto.Field(
        proto.STRING,
        number=1,
    )
    page_size: int = proto.Field(
        proto.INT32,
        number=2,
    )
    page_token: str = proto.Field(
        proto.STRING,
        number=3,
    )


class ListCorporaResponse(proto.Message):
    r"""Response message for ListCorpora.

    Attributes:
        corpora (MutableSequence[google.cloud.visionai_v1alpha1.types.Corpus]):
            The corpora in the project.
        next_page_token (str):
            A token to retrieve next page of results. Pass to
            [ListCorporaRequest.page_token][google.cloud.visionai.v1alpha1.ListCorporaRequest.page_token]
            to obtain that page.
    """

    @property
    def raw_page(self):
        return self

    corpora: MutableSequence["Corpus"] = proto.RepeatedField(
        proto.MESSAGE,
        number=1,
        message="Corpus",
    )
    next_page_token: str = proto.Field(
        proto.STRING,
        number=2,
    )


class DeleteCorpusRequest(proto.Message):
    r"""Request message for DeleteCorpus.

    Attributes:
        name (str):
            Required. The resource name of the corpus to
            delete.
    """

    name: str = proto.Field(
        proto.STRING,
        number=1,
    )


class CreateDataSchemaRequest(proto.Message):
    r"""Request message for CreateDataSchema.

    Attributes:
        parent (str):
            Required. The parent resource where this data schema will be
            created. Format: projects/\ */locations/*/corpora/\*
        data_schema (google.cloud.visionai_v1alpha1.types.DataSchema):
            Required. The data schema to create.
    """

    parent: str = proto.Field(
        proto.STRING,
        number=1,
    )
    data_schema: "DataSchema" = proto.Field(
        proto.MESSAGE,
        number=2,
        message="DataSchema",
    )


class DataSchema(proto.Message):
    r"""Data schema indicates how the user specified annotation is
    interpreted in the system.

    Attributes:
        name (str):
            Resource name of the data schema in the form of:
            ``projects/{project_number}/locations/{location}/corpora/{corpus}/dataSchemas/{data_schema}``
            where {data_schema} part should be the same as the ``key``
            field below.
        key (str):
            Required. The key of this data schema. This key should be
            matching the key of user specified annotation and unique
            inside corpus. This value can be up to 63 characters, and
            valid characters are /[a-z][0-9]-/. The first character must
            be a letter, the last could be a letter or a number.
        schema_details (google.cloud.visionai_v1alpha1.types.DataSchemaDetails):
            The schema details mapping to the key.
    """

    name: str = proto.Field(
        proto.STRING,
        number=1,
    )
    key: str = proto.Field(
        proto.STRING,
        number=2,
    )
    schema_details: "DataSchemaDetails" = proto.Field(
        proto.MESSAGE,
        number=3,
        message="DataSchemaDetails",
    )


class DataSchemaDetails(proto.Message):
    r"""Data schema details indicates the data type and the data
    struct corresponding to the key of user specified annotation.

    Attributes:
        type_ (google.cloud.visionai_v1alpha1.types.DataSchemaDetails.DataType):
            Type of the annotation.
        proto_any_config (google.cloud.visionai_v1alpha1.types.DataSchemaDetails.ProtoAnyConfig):
            Config for protobuf any type.
        granularity (google.cloud.visionai_v1alpha1.types.DataSchemaDetails.Granularity):
            The granularity associated with this
            DataSchema.
        search_strategy (google.cloud.visionai_v1alpha1.types.DataSchemaDetails.SearchStrategy):
            The search strategy to be applied on the ``key`` above.
    """

    class DataType(proto.Enum):
        r"""Data type of the annotation.

        Values:
            DATA_TYPE_UNSPECIFIED (0):
                Unspecified type.
            INTEGER (1):
                Integer type. Allowed search strategies:

                -  DataSchema.SearchStrategy.NO_SEARCH,
                -  DataSchema.SearchStrategy.EXACT_SEARCH. Supports query by
                   IntRangeArray.
            FLOAT (2):
                Float type. Allowed search strategies:

                -  DataSchema.SearchStrategy.NO_SEARCH,
                -  DataSchema.SearchStrategy.EXACT_SEARCH. Supports query by
                   FloatRangeArray.
            STRING (3):
                String type. Allowed search strategies:

                -  DataSchema.SearchStrategy.NO_SEARCH,
                -  DataSchema.SearchStrategy.EXACT_SEARCH,
                -  DataSchema.SearchStrategy.SMART_SEARCH.
            DATETIME (5):
                Supported formats: %Y-%m-%dT%H:%M:%E\ *S%E*\ z
                (absl::RFC3339_full) %Y-%m-%dT%H:%M:%E\ *S
                %Y-%m-%dT%H:%M%E*\ z %Y-%m-%dT%H:%M %Y-%m-%dT%H%E\ *z
                %Y-%m-%dT%H %Y-%m-%d%E*\ z %Y-%m-%d %Y-%m %Y Allowed search
                strategies:

                -  DataSchema.SearchStrategy.NO_SEARCH,
                -  DataSchema.SearchStrategy.EXACT_SEARCH. Supports query by
                   DateTimeRangeArray.
            GEO_COORDINATE (7):
                Geo coordinate type. Allowed search strategies:

                -  DataSchema.SearchStrategy.NO_SEARCH,
                -  DataSchema.SearchStrategy.EXACT_SEARCH. Supports query by
                   GeoLocationArray.
            PROTO_ANY (8):
                Type to pass any proto as available in annotations.proto.
                Only use internally. Available proto types and its
                corresponding search behavior:

                -  ImageObjectDetectionPredictionResult, allows SMART_SEARCH
                   on display_names and NO_SEARCH.
                -  ClassificationPredictionResult, allows SMART_SEARCH on
                   display_names and NO_SEARCH.
                -  ImageSegmentationPredictionResult, allows NO_SEARCH.
                -  VideoActionRecognitionPredictionResult, allows
                   SMART_SEARCH on display_name and NO_SEARCH.
                -  VideoObjectTrackingPredictionResult, allows SMART_SEARCH
                   on display_name and NO_SEARCH.
                -  VideoClassificationPredictionResult, allows SMART_SEARCH
                   on display_name and NO_SEARCH.
                -  OccupancyCountingPredictionResult, allows EXACT_SEARCH on
                   stats.full_frame_count.count and NO_SEARCH.
                -  ObjectDetectionPredictionResult, allows SMART_SEARCH on
                   identified_boxes.entity.label_string and NO_SEARCH.
            BOOLEAN (9):
                Boolean type. Allowed search strategies:

                -  DataSchema.SearchStrategy.NO_SEARCH,
                -  DataSchema.SearchStrategy.EXACT_SEARCH.
        """
        DATA_TYPE_UNSPECIFIED = 0
        INTEGER = 1
        FLOAT = 2
        STRING = 3
        DATETIME = 5
        GEO_COORDINATE = 7
        PROTO_ANY = 8
        BOOLEAN = 9

    class Granularity(proto.Enum):
        r"""The granularity of annotations under this DataSchema.

        Values:
            GRANULARITY_UNSPECIFIED (0):
                Unspecified granularity.
            GRANULARITY_ASSET_LEVEL (1):
                Asset-level granularity (annotations must not
                contain partition info).
            GRANULARITY_PARTITION_LEVEL (2):
                Partition-level granularity (annotations must
                contain partition info).
        """
        GRANULARITY_UNSPECIFIED = 0
        GRANULARITY_ASSET_LEVEL = 1
        GRANULARITY_PARTITION_LEVEL = 2

    class ProtoAnyConfig(proto.Message):
        r"""The configuration for ``PROTO_ANY`` data type.

        Attributes:
            type_uri (str):
                The type URI of the proto message.
        """

        type_uri: str = proto.Field(
            proto.STRING,
            number=1,
        )

    class SearchStrategy(proto.Message):
        r"""The search strategy for annotations value of the ``key``.

        Attributes:
            search_strategy_type (google.cloud.visionai_v1alpha1.types.DataSchemaDetails.SearchStrategy.SearchStrategyType):
                The type of search strategy to be applied on the ``key``
                above. The allowed ``search_strategy_type`` is different for
                different data types, which is documented in the
                DataSchemaDetails.DataType. Specifying unsupported
                ``search_strategy_type`` for data types will result in
                INVALID_ARGUMENT error.
        """

        class SearchStrategyType(proto.Enum):
            r"""The types of search strategies to be applied on the
            annotation key.

            Values:
                NO_SEARCH (0):
                    Annotatation values of the ``key`` above will not be
                    searchable.
                EXACT_SEARCH (1):
                    When searching with ``key``, the value must be exactly as
                    the annotation value that has been ingested.
                SMART_SEARCH (2):
                    When searching with ``key``, Warehouse will perform broad
                    search based on semantic of the annotation value.
            """
            NO_SEARCH = 0
            EXACT_SEARCH = 1
            SMART_SEARCH = 2

        search_strategy_type: "DataSchemaDetails.SearchStrategy.SearchStrategyType" = (
            proto.Field(
                proto.ENUM,
                number=1,
                enum="DataSchemaDetails.SearchStrategy.SearchStrategyType",
            )
        )

    type_: DataType = proto.Field(
        proto.ENUM,
        number=1,
        enum=DataType,
    )
    proto_any_config: ProtoAnyConfig = proto.Field(
        proto.MESSAGE,
        number=6,
        message=ProtoAnyConfig,
    )
    granularity: Granularity = proto.Field(
        proto.ENUM,
        number=5,
        enum=Granularity,
    )
    search_strategy: SearchStrategy = proto.Field(
        proto.MESSAGE,
        number=7,
        message=SearchStrategy,
    )


class UpdateDataSchemaRequest(proto.Message):
    r"""Request message for UpdateDataSchema.

    Attributes:
        data_schema (google.cloud.visionai_v1alpha1.types.DataSchema):
            Required. The data schema's ``name`` field is used to
            identify the data schema to be updated. Format:
            projects/{project_number}/locations/{location}/corpora/{corpus}/dataSchemas/{data_schema}
        update_mask (google.protobuf.field_mask_pb2.FieldMask):
            The list of fields to be updated.
    """

    data_schema: "DataSchema" = proto.Field(
        proto.MESSAGE,
        number=1,
        message="DataSchema",
    )
    update_mask: field_mask_pb2.FieldMask = proto.Field(
        proto.MESSAGE,
        number=2,
        message=field_mask_pb2.FieldMask,
    )


class GetDataSchemaRequest(proto.Message):
    r"""Request message for GetDataSchema.

    Attributes:
        name (str):
            Required. The name of the data schema to retrieve. Format:
            projects/{project_number}/locations/{location_id}/corpora/{corpus_id}/dataSchemas/{data_schema_id}
    """

    name: str = proto.Field(
        proto.STRING,
        number=1,
    )


class DeleteDataSchemaRequest(proto.Message):
    r"""Request message for DeleteDataSchema.

    Attributes:
        name (str):
            Required. The name of the data schema to delete. Format:
            projects/{project_number}/locations/{location_id}/corpora/{corpus_id}/dataSchemas/{data_schema_id}
    """

    name: str = proto.Field(
        proto.STRING,
        number=1,
    )


class ListDataSchemasRequest(proto.Message):
    r"""Request message for ListDataSchemas.

    Attributes:
        parent (str):
            Required. The parent, which owns this collection of data
            schemas. Format:
            projects/{project_number}/locations/{location_id}/corpora/{corpus_id}
        page_size (int):
            The maximum number of data schemas to return.
            The service may return fewer than this value. If
            unspecified, at most 50 data schemas will be
            returned. The maximum value is 1000; values
            above 1000 will be coerced to 1000.
        page_token (str):
            A page token, received from a previous ``ListDataSchemas``
            call. Provide this to retrieve the subsequent page.

            When paginating, all other parameters provided to
            ``ListDataSchemas`` must match the call that provided the
            page token.
    """

    parent: str = proto.Field(
        proto.STRING,
        number=1,
    )
    page_size: int = proto.Field(
        proto.INT32,
        number=2,
    )
    page_token: str = proto.Field(
        proto.STRING,
        number=3,
    )


class ListDataSchemasResponse(proto.Message):
    r"""Response message for ListDataSchemas.

    Attributes:
        data_schemas (MutableSequence[google.cloud.visionai_v1alpha1.types.DataSchema]):
            The data schemas from the specified corpus.
        next_page_token (str):
            A token, which can be sent as ``page_token`` to retrieve the
            next page. If this field is omitted, there are no subsequent
            pages.
    """

    @property
    def raw_page(self):
        return self

    data_schemas: MutableSequence["DataSchema"] = proto.RepeatedField(
        proto.MESSAGE,
        number=1,
        message="DataSchema",
    )
    next_page_token: str = proto.Field(
        proto.STRING,
        number=2,
    )


class CreateAnnotationRequest(proto.Message):
    r"""Request message for CreateAnnotation.

    .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields

    Attributes:
        parent (str):
            Required. The parent resource where this annotation will be
            created. Format: projects/\ */locations/*/corpora/*/assets/*
        annotation (google.cloud.visionai_v1alpha1.types.Annotation):
            Required. The annotation to create.
        annotation_id (str):
            Optional. The ID to use for the annotation, which will
            become the final component of the annotation's resource name
            if user choose to specify. Otherwise, annotation id will be
            generated by system.

            This value should be up to 63 characters, and valid
            characters are /[a-z][0-9]-/. The first character must be a
            letter, the last could be a letter or a number.

            This field is a member of `oneof`_ ``_annotation_id``.
    """

    parent: str = proto.Field(
        proto.STRING,
        number=1,
    )
    annotation: "Annotation" = proto.Field(
        proto.MESSAGE,
        number=2,
        message="Annotation",
    )
    annotation_id: str = proto.Field(
        proto.STRING,
        number=3,
        optional=True,
    )


class Annotation(proto.Message):
    r"""An annotation is a resource in asset. It represents a
    key-value mapping of content in asset.

    Attributes:
        name (str):
            Resource name of the annotation. Form:
            ``projects/{project_number}/locations/{location}/corpora/{corpus}/assets/{asset}/annotations/{annotation}``
        user_specified_annotation (google.cloud.visionai_v1alpha1.types.UserSpecifiedAnnotation):
            User provided annotation.
    """

    name: str = proto.Field(
        proto.STRING,
        number=1,
    )
    user_specified_annotation: "UserSpecifiedAnnotation" = proto.Field(
        proto.MESSAGE,
        number=2,
        message="UserSpecifiedAnnotation",
    )


class UserSpecifiedAnnotation(proto.Message):
    r"""Annotation provided by users.

    Attributes:
        key (str):
            Required. Key of the annotation. The key must
            be set with type by CreateDataSchema.
        value (google.cloud.visionai_v1alpha1.types.AnnotationValue):
            Value of the annotation. The value must be
            able to convert to the type according to the
            data schema.
        partition (google.cloud.visionai_v1alpha1.types.Partition):
            Partition information in time and space for
            the sub-asset level annotation.
    """

    key: str = proto.Field(
        proto.STRING,
        number=1,
    )
    value: "AnnotationValue" = proto.Field(
        proto.MESSAGE,
        number=2,
        message="AnnotationValue",
    )
    partition: "Partition" = proto.Field(
        proto.MESSAGE,
        number=3,
        message="Partition",
    )


class GeoCoordinate(proto.Message):
    r"""Location Coordinate Representation

    Attributes:
        latitude (float):
            Latitude Coordinate. Degrees [-90 .. 90]
        longitude (float):
            Longitude Coordinate. Degrees [-180 .. 180]
    """

    latitude: float = proto.Field(
        proto.DOUBLE,
        number=1,
    )
    longitude: float = proto.Field(
        proto.DOUBLE,
        number=2,
    )


class AnnotationValue(proto.Message):
    r"""Value of annotation, including all types available in data
    schema.

    This message has `oneof`_ fields (mutually exclusive fields).
    For each oneof, at most one member field can be set at the same time.
    Setting any member of the oneof automatically clears all other
    members.

    .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields

    Attributes:
        int_value (int):
            Value of int type annotation.

            This field is a member of `oneof`_ ``value``.
        float_value (float):
            Value of float type annotation.

            This field is a member of `oneof`_ ``value``.
        str_value (str):
            Value of string type annotation.

            This field is a member of `oneof`_ ``value``.
        datetime_value (str):
            Value of date time type annotation.

            This field is a member of `oneof`_ ``value``.
        geo_coordinate (google.cloud.visionai_v1alpha1.types.GeoCoordinate):
            Value of geo coordinate type annotation.

            This field is a member of `oneof`_ ``value``.
        proto_any_value (google.protobuf.any_pb2.Any):
            Value of any proto value.

            This field is a member of `oneof`_ ``value``.
        bool_value (bool):
            Value of boolean type annotation.

            This field is a member of `oneof`_ ``value``.
        customized_struct_data_value (google.protobuf.struct_pb2.Struct):
            Value of customized struct annotation.

            This field is a member of `oneof`_ ``value``.
    """

    int_value: int = proto.Field(
        proto.INT64,
        number=1,
        oneof="value",
    )
    float_value: float = proto.Field(
        proto.FLOAT,
        number=2,
        oneof="value",
    )
    str_value: str = proto.Field(
        proto.STRING,
        number=3,
        oneof="value",
    )
    datetime_value: str = proto.Field(
        proto.STRING,
        number=5,
        oneof="value",
    )
    geo_coordinate: "GeoCoordinate" = proto.Field(
        proto.MESSAGE,
        number=7,
        oneof="value",
        message="GeoCoordinate",
    )
    proto_any_value: any_pb2.Any = proto.Field(
        proto.MESSAGE,
        number=8,
        oneof="value",
        message=any_pb2.Any,
    )
    bool_value: bool = proto.Field(
        proto.BOOL,
        number=9,
        oneof="value",
    )
    customized_struct_data_value: struct_pb2.Struct = proto.Field(
        proto.MESSAGE,
        number=10,
        oneof="value",
        message=struct_pb2.Struct,
    )


class ListAnnotationsRequest(proto.Message):
    r"""Request message for GetAnnotation API.

    Attributes:
        parent (str):
            The parent, which owns this collection of annotations.
            Format:
            projects/{project_number}/locations/{location}/corpora/{corpus}/assets/{asset}
        page_size (int):
            The maximum number of annotations to return.
            The service may return fewer than this value. If
            unspecified, at most 50 annotations will be
            returned. The maximum value is 1000; values
            above 1000 will be coerced to 1000.
        page_token (str):
            A page token, received from a previous ``ListAnnotations``
            call. Provide this to retrieve the subsequent page.

            When paginating, all other parameters provided to
            ``ListAnnotations`` must match the call that provided the
            page token.
        filter (str):
            The filter applied to the returned list. We only support
            filtering for the following fields:
            ``partition.temporal_partition.start_time``,
            ``partition.temporal_partition.end_time``, and ``key``.
            Timestamps are specified in the RFC-3339 format, and only
            one restriction may be applied per field, joined by
            conjunctions. Format:
            "partition.temporal_partition.start_time >
            "2012-04-21T11:30:00-04:00" AND
            partition.temporal_partition.end_time <
            "2012-04-22T11:30:00-04:00" AND key = "example_key"".
    """

    parent: str = proto.Field(
        proto.STRING,
        number=1,
    )
    page_size: int = proto.Field(
        proto.INT32,
        number=2,
    )
    page_token: str = proto.Field(
        proto.STRING,
        number=3,
    )
    filter: str = proto.Field(
        proto.STRING,
        number=4,
    )


class ListAnnotationsResponse(proto.Message):
    r"""Request message for ListAnnotations API.

    Attributes:
        annotations (MutableSequence[google.cloud.visionai_v1alpha1.types.Annotation]):
            The annotations from the specified asset.
        next_page_token (str):
            A token, which can be sent as ``page_token`` to retrieve the
            next page. If this field is omitted, there are no subsequent
            pages.
    """

    @property
    def raw_page(self):
        return self

    annotations: MutableSequence["Annotation"] = proto.RepeatedField(
        proto.MESSAGE,
        number=1,
        message="Annotation",
    )
    next_page_token: str = proto.Field(
        proto.STRING,
        number=2,
    )


class GetAnnotationRequest(proto.Message):
    r"""Request message for GetAnnotation API.

    Attributes:
        name (str):
            Required. The name of the annotation to retrieve. Format:
            projects/{project_number}/locations/{location}/corpora/{corpus}/assets/{asset}/annotations/{annotation}
    """

    name: str = proto.Field(
        proto.STRING,
        number=1,
    )


class UpdateAnnotationRequest(proto.Message):
    r"""Request message for UpdateAnnotation API.

    Attributes:
        annotation (google.cloud.visionai_v1alpha1.types.Annotation):
            Required. The annotation to update. The annotation's
            ``name`` field is used to identify the annotation to be
            updated. Format:
            projects/{project_number}/locations/{location}/corpora/{corpus}/assets/{asset}/annotations/{annotation}
        update_mask (google.protobuf.field_mask_pb2.FieldMask):
            The list of fields to be updated.
    """

    annotation: "Annotation" = proto.Field(
        proto.MESSAGE,
        number=1,
        message="Annotation",
    )
    update_mask: field_mask_pb2.FieldMask = proto.Field(
        proto.MESSAGE,
        number=2,
        message=field_mask_pb2.FieldMask,
    )


class DeleteAnnotationRequest(proto.Message):
    r"""Request message for DeleteAnnotation API.

    Attributes:
        name (str):
            Required. The name of the annotation to delete. Format:
            projects/{project_number}/locations/{location}/corpora/{corpus}/assets/{asset}/annotations/{annotation}
    """

    name: str = proto.Field(
        proto.STRING,
        number=1,
    )


class CreateSearchConfigRequest(proto.Message):
    r"""Request message for CreateSearchConfig.

    Attributes:
        parent (str):
            Required. The parent resource where this search
            configuration will be created. Format:
            projects/\ */locations/*/corpora/\*
        search_config (google.cloud.visionai_v1alpha1.types.SearchConfig):
            Required. The search config to create.
        search_config_id (str):
            Required. ID to use for the new search config. Will become
            the final component of the SearchConfig's resource name.
            This value should be up to 63 characters, and valid
            characters are /[a-z][0-9]-_/. The first character must be a
            letter, the last could be a letter or a number.
    """

    parent: str = proto.Field(
        proto.STRING,
        number=1,
    )
    search_config: "SearchConfig" = proto.Field(
        proto.MESSAGE,
        number=2,
        message="SearchConfig",
    )
    search_config_id: str = proto.Field(
        proto.STRING,
        number=3,
    )


class UpdateSearchConfigRequest(proto.Message):
    r"""Request message for UpdateSearchConfig.

    Attributes:
        search_config (google.cloud.visionai_v1alpha1.types.SearchConfig):
            Required. The search configuration to update.

            The search configuration's ``name`` field is used to
            identify the resource to be updated. Format:
            projects/{project_number}/locations/{location}/corpora/{corpus}/searchConfigs/{search_config}
        update_mask (google.protobuf.field_mask_pb2.FieldMask):
            The list of fields to be updated. If left
            unset, all field paths will be
            updated/overwritten.
    """

    search_config: "SearchConfig" = proto.Field(
        proto.MESSAGE,
        number=1,
        message="SearchConfig",
    )
    update_mask: field_mask_pb2.FieldMask = proto.Field(
        proto.MESSAGE,
        number=2,
        message=field_mask_pb2.FieldMask,
    )


class GetSearchConfigRequest(proto.Message):
    r"""Request message for GetSearchConfig.

    Attributes:
        name (str):
            Required. The name of the search configuration to retrieve.
            Format:
            projects/{project_number}/locations/{location}/corpora/{corpus}/searchConfigs/{search_config}
    """

    name: str = proto.Field(
        proto.STRING,
        number=1,
    )


class DeleteSearchConfigRequest(proto.Message):
    r"""Request message for DeleteSearchConfig.

    Attributes:
        name (str):
            Required. The name of the search configuration to delete.
            Format:
            projects/{project_number}/locations/{location}/corpora/{corpus}/searchConfigs/{search_config}
    """

    name: str = proto.Field(
        proto.STRING,
        number=1,
    )


class ListSearchConfigsRequest(proto.Message):
    r"""Request message for ListSearchConfigs.

    Attributes:
        parent (str):
            Required. The parent, which owns this collection of search
            configurations. Format:
            projects/{project_number}/locations/{location}/corpora/{corpus}
        page_size (int):
            The maximum number of search configurations
            to return. The service may return fewer than
            this value. If unspecified, a page size of 50
            will be used. The maximum value is 1000; values
            above 1000 will be coerced to 1000.
        page_token (str):
            A page token, received from a previous ``ListSearchConfigs``
            call. Provide this to retrieve the subsequent page.

            When paginating, all other parameters provided to
            ``ListSearchConfigs`` must match the call that provided the
            page token.
    """

    parent: str = proto.Field(
        proto.STRING,
        number=1,
    )
    page_size: int = proto.Field(
        proto.INT32,
        number=2,
    )
    page_token: str = proto.Field(
        proto.STRING,
        number=3,
    )


class ListSearchConfigsResponse(proto.Message):
    r"""Response message for ListSearchConfigs.

    Attributes:
        search_configs (MutableSequence[google.cloud.visionai_v1alpha1.types.SearchConfig]):
            The search configurations from the specified
            corpus.
        next_page_token (str):
            A token, which can be sent as ``page_token`` to retrieve the
            next page. If this field is omitted, there are no subsequent
            pages.
    """

    @property
    def raw_page(self):
        return self

    search_configs: MutableSequence["SearchConfig"] = proto.RepeatedField(
        proto.MESSAGE,
        number=1,
        message="SearchConfig",
    )
    next_page_token: str = proto.Field(
        proto.STRING,
        number=2,
    )


class SearchConfig(proto.Message):
    r"""SearchConfig stores different properties that will affect
    search behaviors and search results.

    Attributes:
        name (str):
            Resource name of the search configuration. For
            CustomSearchCriteria, search_config would be the search
            operator name. For Facets, search_config would be the facet
            dimension name. Form:
            ``projects/{project_number}/locations/{location}/corpora/{corpus}/searchConfigs/{search_config}``
        facet_property (google.cloud.visionai_v1alpha1.types.FacetProperty):
            Establishes a FacetDimension and associated
            specifications.
        search_criteria_property (google.cloud.visionai_v1alpha1.types.SearchCriteriaProperty):
            Creates a mapping between a custom
            SearchCriteria and one or more UGA keys.
    """

    name: str = proto.Field(
        proto.STRING,
        number=1,
    )
    facet_property: "FacetProperty" = proto.Field(
        proto.MESSAGE,
        number=2,
        message="FacetProperty",
    )
    search_criteria_property: "SearchCriteriaProperty" = proto.Field(
        proto.MESSAGE,
        number=3,
        message="SearchCriteriaProperty",
    )


class FacetProperty(proto.Message):
    r"""Central configuration for a facet.

    This message has `oneof`_ fields (mutually exclusive fields).
    For each oneof, at most one member field can be set at the same time.
    Setting any member of the oneof automatically clears all other
    members.

    .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields

    Attributes:
        fixed_range_bucket_spec (google.cloud.visionai_v1alpha1.types.FacetProperty.FixedRangeBucketSpec):
            Fixed range facet bucket config.

            This field is a member of `oneof`_ ``range_facet_config``.
        custom_range_bucket_spec (google.cloud.visionai_v1alpha1.types.FacetProperty.CustomRangeBucketSpec):
            Custom range facet bucket config.

            This field is a member of `oneof`_ ``range_facet_config``.
        datetime_bucket_spec (google.cloud.visionai_v1alpha1.types.FacetProperty.DateTimeBucketSpec):
            Datetime range facet bucket config.

            This field is a member of `oneof`_ ``range_facet_config``.
        mapped_fields (MutableSequence[str]):
            Name of the facets, which are the dimensions users want to
            use to refine search results. ``mapped_fields`` will match
            UserSpecifiedDataSchema keys.

            For example, user can add a bunch of UGAs with the same key,
            such as player:adam, player:bob, player:charles. When
            multiple mapped_fields are specified, will merge their value
            together as final facet value. E.g. home_team: a,
            home_team:b, away_team:a, away_team:c, when facet_field =
            [home_team, away_team], facet_value will be [a, b, c].

            UNLESS this is a 1:1 facet dimension (mapped_fields.size()
            == 1) AND the mapped_field equals the parent
            SearchConfig.name, the parent must also contain a
            SearchCriteriaProperty that maps to the same fields.
            mapped_fields must not be empty.
        display_name (str):
            Display name of the facet. To be used by UI
            for facet rendering.
        result_size (int):
            Maximum number of unique bucket to return for one facet.
            Bucket number can be large for high-cardinality facet such
            as "player". We only return top-n most related ones to user.
            If it's <= 0, the server will decide the appropriate
            result_size.
        bucket_type (google.cloud.visionai_v1alpha1.types.FacetBucketType):
            Facet bucket type e.g. value, range.
    """

    class FixedRangeBucketSpec(proto.Message):
        r"""If bucket type is FIXED_RANGE, specify how values are bucketized.
        Use FixedRangeBucketSpec when you want to create multiple buckets
        with equal granularities. Using integer bucket value as an example,
        when bucket_start = 0, bucket_granularity = 10, bucket_count = 5,
        this facet will be aggregated via the following buckets: [-inf, 0),
        [0, 10), [10, 20), [20, 30), [30, inf). Notably, bucket_count <= 1
        is an invalid spec.

        Attributes:
            bucket_start (google.cloud.visionai_v1alpha1.types.FacetValue):
                Lower bound of the bucket. NOTE: Only integer
                type is currently supported for this field.
            bucket_granularity (google.cloud.visionai_v1alpha1.types.FacetValue):
                Bucket granularity. NOTE: Only integer type
                is currently supported for this field.
            bucket_count (int):
                Total number of buckets.
        """

        bucket_start: "FacetValue" = proto.Field(
            proto.MESSAGE,
            number=1,
            message="FacetValue",
        )
        bucket_granularity: "FacetValue" = proto.Field(
            proto.MESSAGE,
            number=2,
            message="FacetValue",
        )
        bucket_count: int = proto.Field(
            proto.INT32,
            number=3,
        )

    class CustomRangeBucketSpec(proto.Message):
        r"""If bucket type is CUSTOM_RANGE, specify how values are bucketized.
        Use integer bucket value as an example, when the endpoints are 0,
        10, 100, and 1000, we will generate the following facets: [-inf, 0),
        [0, 10), [10, 100), [100, 1000), [1000, inf). Notably:

        -  endpoints must be listed in ascending order. Otherwise, the
           SearchConfig API will reject the facet config.
        -  < 1 endpoints is an invalid spec.

        Attributes:
            endpoints (MutableSequence[google.cloud.visionai_v1alpha1.types.FacetValue]):
                Currently, only integer type is supported for
                this field.
        """

        endpoints: MutableSequence["FacetValue"] = proto.RepeatedField(
            proto.MESSAGE,
            number=1,
            message="FacetValue",
        )

    class DateTimeBucketSpec(proto.Message):
        r"""If bucket type is DATE, specify how date values are
        bucketized.

        Attributes:
            granularity (google.cloud.visionai_v1alpha1.types.FacetProperty.DateTimeBucketSpec.Granularity):
                Granularity of date type facet.
        """

        class Granularity(proto.Enum):
            r"""Granularity enum for the datetime bucket.

            Values:
                GRANULARITY_UNSPECIFIED (0):
                    Unspecified granularity.
                YEAR (1):
                    Granularity is year.
                MONTH (2):
                    Granularity is month.
                DAY (3):
                    Granularity is day.
            """
            GRANULARITY_UNSPECIFIED = 0
            YEAR = 1
            MONTH = 2
            DAY = 3

        granularity: "FacetProperty.DateTimeBucketSpec.Granularity" = proto.Field(
            proto.ENUM,
            number=1,
            enum="FacetProperty.DateTimeBucketSpec.Granularity",
        )

    fixed_range_bucket_spec: FixedRangeBucketSpec = proto.Field(
        proto.MESSAGE,
        number=5,
        oneof="range_facet_config",
        message=FixedRangeBucketSpec,
    )
    custom_range_bucket_spec: CustomRangeBucketSpec = proto.Field(
        proto.MESSAGE,
        number=6,
        oneof="range_facet_config",
        message=CustomRangeBucketSpec,
    )
    datetime_bucket_spec: DateTimeBucketSpec = proto.Field(
        proto.MESSAGE,
        number=7,
        oneof="range_facet_config",
        message=DateTimeBucketSpec,
    )
    mapped_fields: MutableSequence[str] = proto.RepeatedField(
        proto.STRING,
        number=1,
    )
    display_name: str = proto.Field(
        proto.STRING,
        number=2,
    )
    result_size: int = proto.Field(
        proto.INT64,
        number=3,
    )
    bucket_type: "FacetBucketType" = proto.Field(
        proto.ENUM,
        number=4,
        enum="FacetBucketType",
    )


class SearchCriteriaProperty(proto.Message):
    r"""Central configuration for custom search criteria.

    Attributes:
        mapped_fields (MutableSequence[str]):
            Each mapped_field corresponds to a UGA key. To understand
            how this property works, take the following example. In the
            SearchConfig table, the user adds this entry: search_config
            { name: "person" search_criteria_property { mapped_fields:
            "player" mapped_fields: "coach" } }

            Now, when a user issues a query like: criteria { field:
            "person" text_array { txt_values: "Tom Brady" txt_values:
            "Bill Belichick" } }

            MWH search will return search documents where (player=Tom
            Brady \|\| coach=Tom Brady \|\| player=Bill Belichick \|\|
            coach=Bill Belichick).
    """

    mapped_fields: MutableSequence[str] = proto.RepeatedField(
        proto.STRING,
        number=1,
    )


class FacetValue(proto.Message):
    r"""Definition of a single value with generic type.

    This message has `oneof`_ fields (mutually exclusive fields).
    For each oneof, at most one member field can be set at the same time.
    Setting any member of the oneof automatically clears all other
    members.

    .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields

    Attributes:
        string_value (str):
            String type value.

            This field is a member of `oneof`_ ``value``.
        integer_value (int):
            Integer type value.

            This field is a member of `oneof`_ ``value``.
        datetime_value (google.type.datetime_pb2.DateTime):
            Datetime type value.

            This field is a member of `oneof`_ ``value``.
    """

    string_value: str = proto.Field(
        proto.STRING,
        number=1,
        oneof="value",
    )
    integer_value: int = proto.Field(
        proto.INT64,
        number=2,
        oneof="value",
    )
    datetime_value: datetime_pb2.DateTime = proto.Field(
        proto.MESSAGE,
        number=3,
        oneof="value",
        message=datetime_pb2.DateTime,
    )


class FacetBucket(proto.Message):
    r"""Holds the facet value, selections state, and metadata.

    This message has `oneof`_ fields (mutually exclusive fields).
    For each oneof, at most one member field can be set at the same time.
    Setting any member of the oneof automatically clears all other
    members.

    .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields

    Attributes:
        value (google.cloud.visionai_v1alpha1.types.FacetValue):
            Singular value.

            This field is a member of `oneof`_ ``bucket_value``.
        range_ (google.cloud.visionai_v1alpha1.types.FacetBucket.Range):
            Range value.

            This field is a member of `oneof`_ ``bucket_value``.
        selected (bool):
            Whether one facet bucket is selected. This
            field represents user's facet selection. It is
            set by frontend in SearchVideosRequest.
    """

    class Range(proto.Message):
        r"""The range of values [start, end) for which faceting is applied.

        Attributes:
            start (google.cloud.visionai_v1alpha1.types.FacetValue):
                Start of the range. Non-existence indicates
                some bound (e.g. -inf).
            end (google.cloud.visionai_v1alpha1.types.FacetValue):
                End of the range. Non-existence indicates
                some bound (e.g. inf).
        """

        start: "FacetValue" = proto.Field(
            proto.MESSAGE,
            number=1,
            message="FacetValue",
        )
        end: "FacetValue" = proto.Field(
            proto.MESSAGE,
            number=2,
            message="FacetValue",
        )

    value: "FacetValue" = proto.Field(
        proto.MESSAGE,
        number=2,
        oneof="bucket_value",
        message="FacetValue",
    )
    range_: Range = proto.Field(
        proto.MESSAGE,
        number=4,
        oneof="bucket_value",
        message=Range,
    )
    selected: bool = proto.Field(
        proto.BOOL,
        number=3,
    )


class FacetGroup(proto.Message):
    r"""A group of facet buckets to be passed back and forth between
    backend & frontend.

    Attributes:
        facet_id (str):
            Unique id of the facet group.
        display_name (str):
            Display name of the facet. To be used by UI
            for facet rendering.
        buckets (MutableSequence[google.cloud.visionai_v1alpha1.types.FacetBucket]):
            Buckets associated with the facet. E.g. for
            "Team" facet, the bucket can be 49ers, patriots,
            etc.
        bucket_type (google.cloud.visionai_v1alpha1.types.FacetBucketType):
            Facet bucket type.
        fetch_matched_annotations (bool):
            If true, return query matched annotations for this facet
            group's selection. This option is only applicable for facets
            based on partition level annotations. It supports the
            following facet values:

            -  INTEGER
            -  STRING (DataSchema.SearchStrategy.EXACT_SEARCH only)
    """

    facet_id: str = proto.Field(
        proto.STRING,
        number=1,
    )
    display_name: str = proto.Field(
        proto.STRING,
        number=2,
    )
    buckets: MutableSequence["FacetBucket"] = proto.RepeatedField(
        proto.MESSAGE,
        number=3,
        message="FacetBucket",
    )
    bucket_type: "FacetBucketType" = proto.Field(
        proto.ENUM,
        number=4,
        enum="FacetBucketType",
    )
    fetch_matched_annotations: bool = proto.Field(
        proto.BOOL,
        number=5,
    )


class IngestAssetRequest(proto.Message):
    r"""Request message for IngestAsset API.

    This message has `oneof`_ fields (mutually exclusive fields).
    For each oneof, at most one member field can be set at the same time.
    Setting any member of the oneof automatically clears all other
    members.

    .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields

    Attributes:
        config (google.cloud.visionai_v1alpha1.types.IngestAssetRequest.Config):
            Provides information for the data and the asset resource
            name that the data belongs to. The first
            ``IngestAssetRequest`` message must only contain a
            ``Config`` message.

            This field is a member of `oneof`_ ``streaming_request``.
        time_indexed_data (google.cloud.visionai_v1alpha1.types.IngestAssetRequest.TimeIndexedData):
            Data to be ingested.

            This field is a member of `oneof`_ ``streaming_request``.
    """

    class Config(proto.Message):
        r"""Configuration for the data.

        .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields

        Attributes:
            video_type (google.cloud.visionai_v1alpha1.types.IngestAssetRequest.Config.VideoType):
                Type information for video data.

                This field is a member of `oneof`_ ``data_type``.
            asset (str):
                Required. The resource name of the asset that
                the ingested data belongs to.
        """

        class VideoType(proto.Message):
            r"""Type information for video data.

            Attributes:
                container_format (google.cloud.visionai_v1alpha1.types.IngestAssetRequest.Config.VideoType.ContainerFormat):
                    Container format of the video data.
            """

            class ContainerFormat(proto.Enum):
                r"""Container format of the video.

                Values:
                    CONTAINER_FORMAT_UNSPECIFIED (0):
                        The default type, not supposed to be used.
                    CONTAINER_FORMAT_MP4 (1):
                        Mp4 container format.
                """
                CONTAINER_FORMAT_UNSPECIFIED = 0
                CONTAINER_FORMAT_MP4 = 1

            container_format: "IngestAssetRequest.Config.VideoType.ContainerFormat" = (
                proto.Field(
                    proto.ENUM,
                    number=1,
                    enum="IngestAssetRequest.Config.VideoType.ContainerFormat",
                )
            )

        video_type: "IngestAssetRequest.Config.VideoType" = proto.Field(
            proto.MESSAGE,
            number=2,
            oneof="data_type",
            message="IngestAssetRequest.Config.VideoType",
        )
        asset: str = proto.Field(
            proto.STRING,
            number=1,
        )

    class TimeIndexedData(proto.Message):
        r"""Contains the data and the corresponding time range this data
        is for.

        Attributes:
            data (bytes):
                Data to be ingested.
            temporal_partition (google.cloud.visionai_v1alpha1.types.Partition.TemporalPartition):
                Time range of the data.
        """

        data: bytes = proto.Field(
            proto.BYTES,
            number=1,
        )
        temporal_partition: "Partition.TemporalPartition" = proto.Field(
            proto.MESSAGE,
            number=2,
            message="Partition.TemporalPartition",
        )

    config: Config = proto.Field(
        proto.MESSAGE,
        number=1,
        oneof="streaming_request",
        message=Config,
    )
    time_indexed_data: TimeIndexedData = proto.Field(
        proto.MESSAGE,
        number=2,
        oneof="streaming_request",
        message=TimeIndexedData,
    )


class IngestAssetResponse(proto.Message):
    r"""Response message for IngestAsset API.

    Attributes:
        successfully_ingested_partition (google.cloud.visionai_v1alpha1.types.Partition.TemporalPartition):
            Time range of the data that has been
            successfully ingested.
    """

    successfully_ingested_partition: "Partition.TemporalPartition" = proto.Field(
        proto.MESSAGE,
        number=1,
        message="Partition.TemporalPartition",
    )


class ClipAssetRequest(proto.Message):
    r"""Request message for ClipAsset API.

    Attributes:
        name (str):
            Required. The resource name of the asset to request clips
            for. Form:
            'projects/{project_number}/locations/{location_id}/corpora/{corpus_id}/assets/{asset_id}'
        temporal_partition (google.cloud.visionai_v1alpha1.types.Partition.TemporalPartition):
            Required. The time range to request clips
            for.
    """

    name: str = proto.Field(
        proto.STRING,
        number=1,
    )
    temporal_partition: "Partition.TemporalPartition" = proto.Field(
        proto.MESSAGE,
        number=2,
        message="Partition.TemporalPartition",
    )


class ClipAssetResponse(proto.Message):
    r"""Response message for ClipAsset API.

    Attributes:
        time_indexed_uris (MutableSequence[google.cloud.visionai_v1alpha1.types.ClipAssetResponse.TimeIndexedUri]):
            A list of signed uris to download the video
            clips that cover the requested time range
            ordered by time.
    """

    class TimeIndexedUri(proto.Message):
        r"""Signed uri with corresponding time range.

        Attributes:
            temporal_partition (google.cloud.visionai_v1alpha1.types.Partition.TemporalPartition):
                Time range of the video that the uri is for.
            uri (str):
                Signed uri to download the video clip.
        """

        temporal_partition: "Partition.TemporalPartition" = proto.Field(
            proto.MESSAGE,
            number=1,
            message="Partition.TemporalPartition",
        )
        uri: str = proto.Field(
            proto.STRING,
            number=2,
        )

    time_indexed_uris: MutableSequence[TimeIndexedUri] = proto.RepeatedField(
        proto.MESSAGE,
        number=1,
        message=TimeIndexedUri,
    )


class GenerateHlsUriRequest(proto.Message):
    r"""Request message for GenerateHlsUri API.

    Attributes:
        name (str):
            Required. The resource name of the asset to request clips
            for. Form:
            'projects/{project_number}/locations/{location_id}/corpora/{corpus_id}/assets/{asset_id}'
        temporal_partitions (MutableSequence[google.cloud.visionai_v1alpha1.types.Partition.TemporalPartition]):
            Required. The time range to request clips
            for.
    """

    name: str = proto.Field(
        proto.STRING,
        number=1,
    )
    temporal_partitions: MutableSequence[
        "Partition.TemporalPartition"
    ] = proto.RepeatedField(
        proto.MESSAGE,
        number=2,
        message="Partition.TemporalPartition",
    )


class GenerateHlsUriResponse(proto.Message):
    r"""Response message for GenerateHlsUri API.

    Attributes:
        uri (str):
            A signed uri to download the HLS manifest
            corresponding to the requested times.
        temporal_partitions (MutableSequence[google.cloud.visionai_v1alpha1.types.Partition.TemporalPartition]):
            A list of temporal partitions of the content
            returned in the order they appear in the stream.
    """

    uri: str = proto.Field(
        proto.STRING,
        number=1,
    )
    temporal_partitions: MutableSequence[
        "Partition.TemporalPartition"
    ] = proto.RepeatedField(
        proto.MESSAGE,
        number=2,
        message="Partition.TemporalPartition",
    )


class SearchAssetsRequest(proto.Message):
    r"""Request message for SearchAssets.

    Attributes:
        corpus (str):
            Required. The parent corpus to search. Form:
            \`projects/{project_id}/locations/{location_id}/corpora/{corpus_id}'
        page_size (int):
            The number of results to be returned in this page. If it's
            0, the server will decide the appropriate page_size.
        page_token (str):
            The continuation token to fetch the next
            page. If empty, it means it is fetching the
            first page.
        content_time_ranges (google.cloud.visionai_v1alpha1.types.DateTimeRangeArray):
            Time ranges that matching video content must fall within. If
            no ranges are provided, there will be no time restriction.
            This field is treated just like the criteria below, but
            defined separately for convenience as it is used frequently.
            Note that if the end_time is in the future, it will be
            clamped to the time the request was received.
        criteria (MutableSequence[google.cloud.visionai_v1alpha1.types.Criteria]):
            Criteria applied to search results.
        facet_selections (MutableSequence[google.cloud.visionai_v1alpha1.types.FacetGroup]):
            Stores most recent facet selection state.
            Only facet groups with user's selection will be
            presented here. Selection state is either
            selected or unselected. Only selected facet
            buckets will be used as search criteria.
        result_annotation_keys (MutableSequence[str]):
            A list of annotation keys to specify the annotations to be
            retrieved and returned with each search result. Annotation
            granularity must be GRANULARITY_ASSET_LEVEL and its search
            strategy must not be NO_SEARCH.
    """

    corpus: str = proto.Field(
        proto.STRING,
        number=1,
    )
    page_size: int = proto.Field(
        proto.INT32,
        number=2,
    )
    page_token: str = proto.Field(
        proto.STRING,
        number=3,
    )
    content_time_ranges: "DateTimeRangeArray" = proto.Field(
        proto.MESSAGE,
        number=5,
        message="DateTimeRangeArray",
    )
    criteria: MutableSequence["Criteria"] = proto.RepeatedField(
        proto.MESSAGE,
        number=4,
        message="Criteria",
    )
    facet_selections: MutableSequence["FacetGroup"] = proto.RepeatedField(
        proto.MESSAGE,
        number=6,
        message="FacetGroup",
    )
    result_annotation_keys: MutableSequence[str] = proto.RepeatedField(
        proto.STRING,
        number=8,
    )


class DeleteAssetMetadata(proto.Message):
    r"""The metadata for DeleteAsset API that embeds in
    [metadata][google.longrunning.Operation.metadata] field.

    """


class AnnotationMatchingResult(proto.Message):
    r"""Stores the criteria-annotation matching results for each
    search result item.

    Attributes:
        criteria (google.cloud.visionai_v1alpha1.types.Criteria):
            The criteria used for matching. It can be an
            input search criteria or a criteria converted
            from a facet selection.
        matched_annotations (MutableSequence[google.cloud.visionai_v1alpha1.types.Annotation]):
            Matched annotations for the criteria.
        status (google.rpc.status_pb2.Status):
            Status of the match result. Possible values:
            FAILED_PRECONDITION - the criteria is not eligible for
            match. OK - matching is performed.
    """

    criteria: "Criteria" = proto.Field(
        proto.MESSAGE,
        number=1,
        message="Criteria",
    )
    matched_annotations: MutableSequence["Annotation"] = proto.RepeatedField(
        proto.MESSAGE,
        number=2,
        message="Annotation",
    )
    status: status_pb2.Status = proto.Field(
        proto.MESSAGE,
        number=3,
        message=status_pb2.Status,
    )


class SearchResultItem(proto.Message):
    r"""Search result contains asset name and corresponding time
    ranges.

    Attributes:
        asset (str):
            The resource name of the asset. Form:
            'projects/{project_number}/locations/{location_id}/corpora/{corpus_id}/assets/{asset_id}'
        segments (MutableSequence[google.cloud.visionai_v1alpha1.types.Partition.TemporalPartition]):
            The matched asset segments. Deprecated: please use singular
            ``segment`` field.
        segment (google.cloud.visionai_v1alpha1.types.Partition.TemporalPartition):
            The matched asset segment.
        requested_annotations (MutableSequence[google.cloud.visionai_v1alpha1.types.Annotation]):
            Search result annotations specified by
            result_annotation_keys in search request.
        annotation_matching_results (MutableSequence[google.cloud.visionai_v1alpha1.types.AnnotationMatchingResult]):
            Criteria or facet-selection based annotation matching
            results associated to this search result item. Only contains
            results for criteria or facet_selections with
            fetch_matched_annotations=true.
    """

    asset: str = proto.Field(
        proto.STRING,
        number=1,
    )
    segments: MutableSequence["Partition.TemporalPartition"] = proto.RepeatedField(
        proto.MESSAGE,
        number=2,
        message="Partition.TemporalPartition",
    )
    segment: "Partition.TemporalPartition" = proto.Field(
        proto.MESSAGE,
        number=5,
        message="Partition.TemporalPartition",
    )
    requested_annotations: MutableSequence["Annotation"] = proto.RepeatedField(
        proto.MESSAGE,
        number=3,
        message="Annotation",
    )
    annotation_matching_results: MutableSequence[
        "AnnotationMatchingResult"
    ] = proto.RepeatedField(
        proto.MESSAGE,
        number=4,
        message="AnnotationMatchingResult",
    )


class SearchAssetsResponse(proto.Message):
    r"""Response message for SearchAssets.

    Attributes:
        search_result_items (MutableSequence[google.cloud.visionai_v1alpha1.types.SearchResultItem]):
            Returned search results.
        next_page_token (str):
            The next-page continuation token.
        facet_results (MutableSequence[google.cloud.visionai_v1alpha1.types.FacetGroup]):
            Facet search results of a given query, which
            contains user's already-selected facet values
            and updated facet search results.
    """

    @property
    def raw_page(self):
        return self

    search_result_items: MutableSequence["SearchResultItem"] = proto.RepeatedField(
        proto.MESSAGE,
        number=1,
        message="SearchResultItem",
    )
    next_page_token: str = proto.Field(
        proto.STRING,
        number=2,
    )
    facet_results: MutableSequence["FacetGroup"] = proto.RepeatedField(
        proto.MESSAGE,
        number=3,
        message="FacetGroup",
    )


class IntRange(proto.Message):
    r"""Integer range type.

    .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields

    Attributes:
        start (int):
            Start of the int range.

            This field is a member of `oneof`_ ``_start``.
        end (int):
            End of the int range.

            This field is a member of `oneof`_ ``_end``.
    """

    start: int = proto.Field(
        proto.INT64,
        number=1,
        optional=True,
    )
    end: int = proto.Field(
        proto.INT64,
        number=2,
        optional=True,
    )


class FloatRange(proto.Message):
    r"""Float range type.

    .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields

    Attributes:
        start (float):
            Start of the float range.

            This field is a member of `oneof`_ ``_start``.
        end (float):
            End of the float range.

            This field is a member of `oneof`_ ``_end``.
    """

    start: float = proto.Field(
        proto.FLOAT,
        number=1,
        optional=True,
    )
    end: float = proto.Field(
        proto.FLOAT,
        number=2,
        optional=True,
    )


class StringArray(proto.Message):
    r"""A list of string-type values.

    Attributes:
        txt_values (MutableSequence[str]):
            String type values.
    """

    txt_values: MutableSequence[str] = proto.RepeatedField(
        proto.STRING,
        number=1,
    )


class IntRangeArray(proto.Message):
    r"""A list of integer range values.

    Attributes:
        int_ranges (MutableSequence[google.cloud.visionai_v1alpha1.types.IntRange]):
            Int range values.
    """

    int_ranges: MutableSequence["IntRange"] = proto.RepeatedField(
        proto.MESSAGE,
        number=1,
        message="IntRange",
    )


class FloatRangeArray(proto.Message):
    r"""A list of float range values.

    Attributes:
        float_ranges (MutableSequence[google.cloud.visionai_v1alpha1.types.FloatRange]):
            Float range values.
    """

    float_ranges: MutableSequence["FloatRange"] = proto.RepeatedField(
        proto.MESSAGE,
        number=1,
        message="FloatRange",
    )


class DateTimeRange(proto.Message):
    r"""Datetime range type.

    Attributes:
        start (google.type.datetime_pb2.DateTime):
            Start date time.
        end (google.type.datetime_pb2.DateTime):
            End data time.
    """

    start: datetime_pb2.DateTime = proto.Field(
        proto.MESSAGE,
        number=1,
        message=datetime_pb2.DateTime,
    )
    end: datetime_pb2.DateTime = proto.Field(
        proto.MESSAGE,
        number=2,
        message=datetime_pb2.DateTime,
    )


class DateTimeRangeArray(proto.Message):
    r"""A list of datetime range values.

    Attributes:
        date_time_ranges (MutableSequence[google.cloud.visionai_v1alpha1.types.DateTimeRange]):
            Date time ranges.
    """

    date_time_ranges: MutableSequence["DateTimeRange"] = proto.RepeatedField(
        proto.MESSAGE,
        number=1,
        message="DateTimeRange",
    )


class CircleArea(proto.Message):
    r"""Representation of a circle area.

    Attributes:
        latitude (float):
            Latitude of circle area's center. Degrees [-90 .. 90]
        longitude (float):
            Longitude of circle area's center. Degrees [-180 .. 180]
        radius_meter (float):
            Radius of the circle area in meters.
    """

    latitude: float = proto.Field(
        proto.DOUBLE,
        number=1,
    )
    longitude: float = proto.Field(
        proto.DOUBLE,
        number=2,
    )
    radius_meter: float = proto.Field(
        proto.DOUBLE,
        number=3,
    )


class GeoLocationArray(proto.Message):
    r"""A list of locations.

    Attributes:
        circle_areas (MutableSequence[google.cloud.visionai_v1alpha1.types.CircleArea]):
            A list of circle areas.
    """

    circle_areas: MutableSequence["CircleArea"] = proto.RepeatedField(
        proto.MESSAGE,
        number=1,
        message="CircleArea",
    )


class BoolValue(proto.Message):
    r"""

    Attributes:
        value (bool):

    """

    value: bool = proto.Field(
        proto.BOOL,
        number=1,
    )


class Criteria(proto.Message):
    r"""Filter criteria applied to current search results.

    This message has `oneof`_ fields (mutually exclusive fields).
    For each oneof, at most one member field can be set at the same time.
    Setting any member of the oneof automatically clears all other
    members.

    .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields

    Attributes:
        text_array (google.cloud.visionai_v1alpha1.types.StringArray):
            The text values associated with the field.

            This field is a member of `oneof`_ ``value``.
        int_range_array (google.cloud.visionai_v1alpha1.types.IntRangeArray):
            The integer ranges associated with the field.

            This field is a member of `oneof`_ ``value``.
        float_range_array (google.cloud.visionai_v1alpha1.types.FloatRangeArray):
            The float ranges associated with the field.

            This field is a member of `oneof`_ ``value``.
        date_time_range_array (google.cloud.visionai_v1alpha1.types.DateTimeRangeArray):
            The datetime ranges associated with the
            field.

            This field is a member of `oneof`_ ``value``.
        geo_location_array (google.cloud.visionai_v1alpha1.types.GeoLocationArray):
            Geo Location array.

            This field is a member of `oneof`_ ``value``.
        bool_value (google.cloud.visionai_v1alpha1.types.BoolValue):
            A Boolean value.

            This field is a member of `oneof`_ ``value``.
        field (str):
            The UGA field or ML field to apply filtering
            criteria.
        fetch_matched_annotations (bool):
            If true, return query matched annotations for this criteria.
            This option is only applicable for partition level
            annotations and supports the following data types:

            -  INTEGER
            -  FLOAT
            -  STRING (DataSchema.SearchStrategy.EXACT_SEARCH only)
            -  BOOLEAN
    """

    text_array: "StringArray" = proto.Field(
        proto.MESSAGE,
        number=2,
        oneof="value",
        message="StringArray",
    )
    int_range_array: "IntRangeArray" = proto.Field(
        proto.MESSAGE,
        number=3,
        oneof="value",
        message="IntRangeArray",
    )
    float_range_array: "FloatRangeArray" = proto.Field(
        proto.MESSAGE,
        number=4,
        oneof="value",
        message="FloatRangeArray",
    )
    date_time_range_array: "DateTimeRangeArray" = proto.Field(
        proto.MESSAGE,
        number=5,
        oneof="value",
        message="DateTimeRangeArray",
    )
    geo_location_array: "GeoLocationArray" = proto.Field(
        proto.MESSAGE,
        number=6,
        oneof="value",
        message="GeoLocationArray",
    )
    bool_value: "BoolValue" = proto.Field(
        proto.MESSAGE,
        number=7,
        oneof="value",
        message="BoolValue",
    )
    field: str = proto.Field(
        proto.STRING,
        number=1,
    )
    fetch_matched_annotations: bool = proto.Field(
        proto.BOOL,
        number=8,
    )


class Partition(proto.Message):
    r"""Partition to specify the partition in time and space for
    sub-asset level annotation.

    Attributes:
        temporal_partition (google.cloud.visionai_v1alpha1.types.Partition.TemporalPartition):
            Partition of asset in time.
        spatial_partition (google.cloud.visionai_v1alpha1.types.Partition.SpatialPartition):
            Partition of asset in space.
    """

    class TemporalPartition(proto.Message):
        r"""Partition of asset in UTC Epoch time.

        Attributes:
            start_time (google.protobuf.timestamp_pb2.Timestamp):
                Start time of the partition.
            end_time (google.protobuf.timestamp_pb2.Timestamp):
                End time of the partition.
        """

        start_time: timestamp_pb2.Timestamp = proto.Field(
            proto.MESSAGE,
            number=1,
            message=timestamp_pb2.Timestamp,
        )
        end_time: timestamp_pb2.Timestamp = proto.Field(
            proto.MESSAGE,
            number=2,
            message=timestamp_pb2.Timestamp,
        )

    class SpatialPartition(proto.Message):
        r"""Partition of asset in space.

        .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields

        Attributes:
            x_min (int):
                The minimum x coordinate value.

                This field is a member of `oneof`_ ``_x_min``.
            y_min (int):
                The minimum y coordinate value.

                This field is a member of `oneof`_ ``_y_min``.
            x_max (int):
                The maximum x coordinate value.

                This field is a member of `oneof`_ ``_x_max``.
            y_max (int):
                The maximum y coordinate value.

                This field is a member of `oneof`_ ``_y_max``.
        """

        x_min: int = proto.Field(
            proto.INT64,
            number=1,
            optional=True,
        )
        y_min: int = proto.Field(
            proto.INT64,
            number=2,
            optional=True,
        )
        x_max: int = proto.Field(
            proto.INT64,
            number=3,
            optional=True,
        )
        y_max: int = proto.Field(
            proto.INT64,
            number=4,
            optional=True,
        )

    temporal_partition: TemporalPartition = proto.Field(
        proto.MESSAGE,
        number=1,
        message=TemporalPartition,
    )
    spatial_partition: SpatialPartition = proto.Field(
        proto.MESSAGE,
        number=2,
        message=SpatialPartition,
    )


__all__ = tuple(sorted(__protobuf__.manifest))
