# coding: utf-8
"""Waylay Broker query parameters.

This code was generated from the OpenAPI documentation of 'Waylay Broker'

Generated by OpenAPI Generator (https://openapi-generator.tech)

Do not edit the class manually.
"""

from __future__ import annotations  # for Python 3.7–3.9

from typing import Any

from pydantic import (
    ConfigDict,
    Field,
    StrictBool,
)
from typing_extensions import (
    Annotated,  # >=3.11
)
from waylay.sdk.api._models import BaseModel as WaylayBaseModel


def _post_series_query_alias_for(field_name: str) -> str:
    if field_name == "forward":
        return "forward"
    if field_name == "store":
        return "store"
    if field_name == "ttl":
        return "ttl"
    return field_name


class PostSeriesQuery(WaylayBaseModel):
    """Model for `post_series` query parameters."""

    forward: Annotated[
        StrictBool | None,
        Field(
            description="If payload is a single event, _Events_ are forwarded to the [Rule Engine](/#/api/rules/) unless `forward` is explicitly set to `false`. If payload has multiple events and each event is for a distinct resource, all _Events_ are forwarded to the [Rule Engine](/#/api/rules/) unless `forward` is explicitly set to `false` If payload has multiple events and there are multiple events for the same resource, an error will be returned if `forward` is explicitly set to `true`."
        ),
    ] = None
    store: Annotated[
        StrictBool | None,
        Field(
            description="Unless explicitly set to `false`, _Events_ are stored  into message cache, and their scalar attributes stored in the time series database."
        ),
    ] = None
    ttl: Annotated[
        Any | None,
        Field(
            description="Specifies how long data persists in both the message cache and time series database."
        ),
    ] = None

    model_config = ConfigDict(
        validate_assignment=True,
        protected_namespaces=(),
        extra="allow",
        alias_generator=_post_series_query_alias_for,
        populate_by_name=True,
    )


def _post_series_for_resource_query_alias_for(field_name: str) -> str:
    if field_name == "forward":
        return "forward"
    if field_name == "store":
        return "store"
    if field_name == "ttl":
        return "ttl"
    return field_name


class PostSeriesForResourceQuery(WaylayBaseModel):
    """Model for `post_series_for_resource` query parameters."""

    forward: Annotated[
        StrictBool | None,
        Field(
            description="If payload is a single event, _Events_ are forwarded to the [Rule Engine](/#/api/rules/) unless `forward` is explicitly set to `false`. If payload has multiple events, this parameter is ignored and _Events_ will only be stored into message cache and their scalar attributes in the timeseries database."
        ),
    ] = None
    store: Annotated[
        StrictBool | None,
        Field(
            description="Unless explicitly set to `false`, _Events_ are stored  into message cache, and their scalar attributes stored in the time series database."
        ),
    ] = None
    ttl: Annotated[
        Any | None,
        Field(
            description="Specifies how long data persists in both the message cache and time series database."
        ),
    ] = None

    model_config = ConfigDict(
        validate_assignment=True,
        protected_namespaces=(),
        extra="allow",
        alias_generator=_post_series_for_resource_query_alias_for,
        populate_by_name=True,
    )


def _remove_query_alias_for(field_name: str) -> str:
    if field_name == "var_from":
        return "from"
    if field_name == "until":
        return "until"
    if field_name == "onlytimeseries":
        return "onlytimeseries"
    return field_name


class RemoveQuery(WaylayBaseModel):
    """Model for `remove` query parameters."""

    var_from: Annotated[
        Any | None, Field(description="Specifies the lower bound of the time period")
    ] = None
    until: Annotated[
        Any | None, Field(description="Specifies the upper bound of the time period")
    ] = None
    onlytimeseries: Annotated[
        StrictBool | None,
        Field(description="if set to `true` will only delete timeseries data"),
    ] = None

    model_config = ConfigDict(
        validate_assignment=True,
        protected_namespaces=(),
        extra="allow",
        alias_generator=_remove_query_alias_for,
        populate_by_name=True,
    )


def _stream_events_query_alias_for(field_name: str) -> str:
    return field_name


class StreamEventsQuery(WaylayBaseModel):
    """Model for `stream_events` query parameters."""

    model_config = ConfigDict(
        validate_assignment=True,
        protected_namespaces=(),
        extra="allow",
        alias_generator=_stream_events_query_alias_for,
        populate_by_name=True,
    )
