# generated by datamodel-codegen:
#   filename:  admin.yaml
#   timestamp: 2023-06-21T19:01:59+00:00

from __future__ import annotations

from datetime import datetime
from typing import List, Optional

from pydantic import BaseModel


class User(BaseModel):
    id: str
    """
    the unique id of the user
    """
    first_name: Optional[str] = None
    """
    The user's first name
    """
    last_name: Optional[str] = None
    """
    The user's last name
    """
    email: str
    """
    The user's email
    """
    username: Optional[str] = None
    """
    The username the user can use to login
    """
    roles: Optional[List[str]] = None
    """
    The user's roles in the current organization.
    """
    alert_notifications_enabled: Optional[bool] = None
    """
    Whether or not the user will receive email notifications when alerts are triggered,
    defaults to 'false'
    """
    show_intro_sequence: Optional[bool] = None
    """
    Used by the Arthur dashboard to determine whether or not to show the user an intro
    sequence upon login
    """
    help_mode_enabled: Optional[bool] = None
    """
    Used by the Arthur dashboard to determine whether or not to show dashboard tooltips
    """
    created_at: Optional[datetime] = None
    """
    UTC timestamp of when the user was created
    """


class UserContext(BaseModel):
    name: Optional[str] = None
    """
    Name of the context.
    """
    id: Optional[str] = None
    """
    UUID of the context.
    """


class LoginRequest(BaseModel):
    login: str
    """
    either an email or a username
    """
    password: str


class AuthenticationInfo(BaseModel):
    organization_ids: List[str]
    """
    A list of organization IDs.
    """
    issuer: str
    """
    The identifier of the IDP managing this user.
    """
    external_user_id: Optional[str] = None
    """
    An identifier for an external-IdP token bearer. Populated if this user's token came
    from an IDP and the IDP configuration specified an oidc.CustomClaimNames that mapped
    UserID to a claim.
    """
    internal_user_id: Optional[str] = None
    """
    An identifier for an Arthur-internal user. Populated for Arthur-authenticated users
    with user tokens.
    """
    service_account_id: Optional[str] = None
    """
    An identifier for an Arthur service account. Populated for Arthur-authenticated
    service account tokens.
    """
    username: str
    """
    Either the Arthur username or the username specified by an external IDP. This will
    be set to arthur.ServiceAccountName for service account tokens.
    """
    first_name: str
    """
    The first name of the Arthur authenticated user, or the first name claim if the
    external IDP is configured with one.
    """
    last_name: str
    """
    The last name of the Arthur authenticated user, or the last name claim if the
    external IDP is configured with one.
    """
    email: str
    """
    The email of the Arthur authenticated user or the email of the external IDP user if
     the IDP is configured with that claim. For Arthur service accounts, this will be
     empty.
    """
    roles: List[str]
    """
    The list of roles that this user has. For Arthur tokens, there will always be one
     role in this array; however, there can be more than one for external providers.
    """


class UserResponse(BaseModel):
    """
    Represents an application user, if the client is using a service token then only
      organization_id and roles will be populated in the object
    """

    id: Optional[str] = None
    """
    the unique id of the user
    """
    organization_id: str
    """
    The ID of the users current context
    """
    organization_name: Optional[str] = None
    """
    The name of the users current context
    """
    first_name: Optional[str] = None
    """
    The user's first name
    """
    last_name: Optional[str] = None
    """
    The user's last name
    """
    email: Optional[str] = None
    """
    The user's email
    """
    username: Optional[str] = None
    """
    The username the user can use to login
    """
    roles: Optional[List[str]]
    """
    The user's roles
    """
    alert_notifications_enabled: Optional[bool] = None
    """
    Whether or not the user will receive email notifications when alerts are triggered,
      defaults to 'false'
    """
    show_intro_sequence: Optional[bool] = None
    """
    used by the Arthur dashboard to determine whether the user should be shown the intro
      sequence upon login
    """
    help_mode_enabled: Optional[bool] = None
    """
    Used by the Arthur dashboard to determine whether or not to show dashboard tooltips
    """
    plan: Optional[str] = None
    """
    string representation of what plan the org of the returned user is associated with
      (ie. self-service or paidSaas)
    """
    created_at: Optional[datetime] = None
    """
    UTC timestamp of when the user was created
    """
    contexts: Optional[List[UserContext]] = None
    """
    Contexts that the user has permissions in.
    """
