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

from __future__ import annotations
import pydantic
from typing import List
from typing_extensions import Annotated, TypedDict
from unkey.py.types import BaseModel


class V2KeysSetRolesRequestBodyTypedDict(TypedDict):
    key_id: str
    r"""Specifies which key gets the complete role replacement using the database identifier returned from createKey.
    Do not confuse this with the actual API key string that users include in requests.
    This is a wholesale replacement operation that removes all existing roles not included in the request.
    Role changes take effect immediately but may take up to 30 seconds to propagate across all regions.

    """
    roles: List[str]
    r"""Replaces all existing role assignments with this complete list of roles.
    This is a wholesale replacement operation, not an incremental update like add/remove operations.

    Providing an empty array removes all direct role assignments from the key.
    All roles must already exist in the workspace - roles cannot be created automatically.
    Invalid role references cause the entire operation to fail atomically, ensuring consistent state.

    """


class V2KeysSetRolesRequestBody(BaseModel):
    key_id: Annotated[str, pydantic.Field(alias="keyId")]
    r"""Specifies which key gets the complete role replacement using the database identifier returned from createKey.
    Do not confuse this with the actual API key string that users include in requests.
    This is a wholesale replacement operation that removes all existing roles not included in the request.
    Role changes take effect immediately but may take up to 30 seconds to propagate across all regions.

    """

    roles: List[str]
    r"""Replaces all existing role assignments with this complete list of roles.
    This is a wholesale replacement operation, not an incremental update like add/remove operations.

    Providing an empty array removes all direct role assignments from the key.
    All roles must already exist in the workspace - roles cannot be created automatically.
    Invalid role references cause the entire operation to fail atomically, ensuring consistent state.

    """
