"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""

from __future__ import annotations
from outpost_sdk.types import BaseModel, UNSET_SENTINEL
from pydantic import model_serializer
from typing import Optional
from typing_extensions import NotRequired, TypedDict


class Awss3ConfigTypedDict(TypedDict):
    bucket: str
    r"""The name of your AWS S3 bucket."""
    region: str
    r"""The AWS region where your bucket is located."""
    key_template: NotRequired[str]
    r"""JMESPath expression for generating S3 object keys. Default is join('', [time.rfc3339_nano, '_', metadata.\"event-id\", '.json'])."""
    storage_class: NotRequired[str]
    r"""The storage class for the S3 objects (e.g., STANDARD, INTELLIGENT_TIERING, GLACIER, etc.). Defaults to \"STANDARD\"."""


class Awss3Config(BaseModel):
    bucket: str
    r"""The name of your AWS S3 bucket."""

    region: str
    r"""The AWS region where your bucket is located."""

    key_template: Optional[str] = None
    r"""JMESPath expression for generating S3 object keys. Default is join('', [time.rfc3339_nano, '_', metadata.\"event-id\", '.json'])."""

    storage_class: Optional[str] = None
    r"""The storage class for the S3 objects (e.g., STANDARD, INTELLIGENT_TIERING, GLACIER, etc.). Defaults to \"STANDARD\"."""

    @model_serializer(mode="wrap")
    def serialize_model(self, handler):
        optional_fields = set(["key_template", "storage_class"])
        serialized = handler(self)
        m = {}

        for n, f in type(self).model_fields.items():
            k = f.alias or n
            val = serialized.get(k, serialized.get(n))

            if val != UNSET_SENTINEL:
                if val is not None or k not in optional_fields:
                    m[k] = val

        return m
