# generated by datamodel-codegen:
#   filename:  <stdin>
#   timestamp: 2023-02-17T08:33:20+00:00

from __future__ import annotations

import uuid
import datetime
from enum import Enum
from typing import Any, Literal

from pydantic import BaseModel, Extra, Field, confloat, conint, constr


class Read(Enum):
    read = 'read'
    unread = 'unread'
    accepted = 'accepted'
    denied = 'denied'
    deleted = 'deleted'


class FromEnum(Enum):
    admin = 'admin'


class InfoItem(BaseModel):
    id: uuid.UUID | None = None
    type: str | None = None
    name: str | None = None


class Type(Enum):
    admin = 'admin'
    installation = 'installation'
    installation_request = 'installation_request'
    installation_wallet = 'installation_wallet'
    permission = 'permission'
    shared = 'shared'
    wallet = 'wallet'
    generic = 'generic'


class Base(BaseModel):
    class Config:
        extra = Extra.forbid

    action: str | None = None
    code: int | None = None
    from_: uuid.UUID | FromEnum | None = Field(None, alias='from')
    to: uuid.UUID | None = None
    from_type: str | None = None
    from_name: str | None = None
    to_type: str | None = None
    type_ids: str | None = None
    prev_notification: str | None = None
    priority: conint(ge=0, multiple_of=1) | None = None
    ids: list[uuid.UUID] | None = None
    info: list[InfoItem] | None = None
    type:  Type | None = None


class Progress(BaseModel):
    total_steps: float | None = None
    done_steps: float | None = None
    percentage: confloat(ge=0.0, le=100.0) | None = None


class Assigned(Enum):
    unassigned = 'unassigned'
    admin = 'admin'


class WarningItem(BaseModel):
    message: str | None = None
    data: dict[str, Any] | None = None
    code: int | None = None


class Meta(BaseModel):
    class Config:
        extra = Extra.forbid

    id: uuid.UUID | None = None
    type: str | None = None
    version: constr(regex=r'(\d+)\.(\d+)') | None = None
    manufacturer: uuid.UUID | Assigned | None = None
    owner: uuid.UUID | Assigned | None = None
    created: datetime.datetime | Literal['not_available'] | None = None
    updated: datetime.datetime | Literal['not_available'] | None = None
    changed: datetime.datetime | Literal['not_available'] | None = None
    application: uuid.UUID | None = None
    revision: int | None = None
    trace: str | None = None
    oem: str | None = None
    deprecated: bool | None = None
    redirect: constr(regex=r'^[0-9a-zA-Z_-]+$', min_length=1, max_length=200) | None = None
    size: int | None = None
    path: str | None = None
    parent: uuid.UUID | None = None
    error: dict[str, Any] | None = None
    icon: str | None = None
    tag: list[constr(min_length=2, max_length=20)] | None = None
    tag_by_user: list[constr(min_length=2, max_length=20)] | None = None
    name_by_user: constr(max_length=100) | None = None
    warning: list[WarningItem] | None = None
    parent_name: dict[str, Any] | None = None
    read_only: bool | None = None
    original_id: uuid.UUID | None = None
    alert: list[uuid.UUID] | None = None
    contract: list[uuid.UUID] | None = None


class Notification(BaseModel):
    class Config:
        extra = Extra.forbid

    read: Read
    custom: dict[str, Any] | None = None
    base: Base
    progress:  Progress | None = None
    times: conint(ge=1, multiple_of=1)
    timestamp: str
    identifier: str
    url: str | None = None
    meta: Meta = Field(..., title='meta-2.1')
