# -*- coding: utf-8 -*-
# Copyright 2020 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.
#
import proto  # type: ignore

from google.protobuf import timestamp_pb2  # type: ignore


__protobuf__ = proto.module(
    package='google.cloud.dialogflow.cx.v3beta1',
    manifest={
        'ListChangelogsRequest',
        'ListChangelogsResponse',
        'GetChangelogRequest',
        'Changelog',
    },
)


class ListChangelogsRequest(proto.Message):
    r"""The request message for
    [Changelogs.ListChangelogs][google.cloud.dialogflow.cx.v3beta1.Changelogs.ListChangelogs].

    Attributes:
        parent (str):
            Required. The agent containing the changelogs. Format:
            ``projects/<Project ID>/locations/<Location ID>/agents/<Agent ID>``.
        filter (str):
            The filter string. Supports filter by user_email, resource,
            type and create_time. Some examples:

            1. By user email: user_email = "<EMAIL>"
            2. By resource name: resource =
               "projects/123/locations/global/agents/456/flows/789"
            3. By resource display name: display_name = "my agent"
            4. By action: action = "Create"
            5. By type: type = "flows"
            6. By create time. Currently predicates on ``create_time``
               and ``create_time_epoch_seconds`` are supported:
               create_time_epoch_seconds > 1551790877 AND create_time <=
               2017-01-15T01:30:15.01Z
            7. Combination of above filters: resource =
               "projects/123/locations/global/agents/456/flows/789" AND
               user_email = "<EMAIL>" AND create_time <=
               2017-01-15T01:30:15.01Z
        page_size (int):
            The maximum number of items to return in a
            single page. By default 100 and at most 1000.
        page_token (str):
            The next_page_token value returned from a previous list
            request.
    """

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


class ListChangelogsResponse(proto.Message):
    r"""The response message for
    [Changelogs.ListChangelogs][google.cloud.dialogflow.cx.v3beta1.Changelogs.ListChangelogs].

    Attributes:
        changelogs (Sequence[google.cloud.dialogflowcx_v3beta1.types.Changelog]):
            The list of changelogs. There will be a maximum number of
            items returned based on the page_size field in the request.
            The changelogs will be ordered by timestamp.
        next_page_token (str):
            Token to retrieve the next page of results,
            or empty if there are no more results in the
            list.
    """

    @property
    def raw_page(self):
        return self

    changelogs = proto.RepeatedField(
        proto.MESSAGE,
        number=1,
        message='Changelog',
    )
    next_page_token = proto.Field(
        proto.STRING,
        number=2,
    )


class GetChangelogRequest(proto.Message):
    r"""The request message for
    [Changelogs.GetChangelog][google.cloud.dialogflow.cx.v3beta1.Changelogs.GetChangelog].

    Attributes:
        name (str):
            Required. The name of the changelog to get. Format:
            ``projects/<Project ID>/locations/<Location ID>/agents/<Agent ID>/changelogs/<Changelog ID>``.
    """

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


class Changelog(proto.Message):
    r"""Changelogs represents a change made to a given agent.

    Attributes:
        name (str):
            The unique identifier of the changelog. Format:
            ``projects/<Project ID>/locations/<Location ID>/agents/<Agent ID>/changelogs/<Changelog ID>``.
        user_email (str):
            Email address of the authenticated user.
        display_name (str):
            The affected resource display name of the
            change.
        action (str):
            The action of the change.
        type_ (str):
            The affected resource type.
        resource (str):
            The affected resource name of the change.
        create_time (google.protobuf.timestamp_pb2.Timestamp):
            The timestamp of the change.
    """

    name = proto.Field(
        proto.STRING,
        number=1,
    )
    user_email = proto.Field(
        proto.STRING,
        number=2,
    )
    display_name = proto.Field(
        proto.STRING,
        number=7,
    )
    action = proto.Field(
        proto.STRING,
        number=11,
    )
    type_ = proto.Field(
        proto.STRING,
        number=8,
    )
    resource = proto.Field(
        proto.STRING,
        number=3,
    )
    create_time = proto.Field(
        proto.MESSAGE,
        number=4,
        message=timestamp_pb2.Timestamp,
    )


__all__ = tuple(sorted(__protobuf__.manifest))
