# Generated by ariadne-codegen
# Source: http://localhost:8042/graphql/

from datetime import date, datetime
from decimal import Decimal
from typing import Annotated, List, Optional

from pydantic import Field, PlainSerializer

from .base_model import BaseModel
from .bigint_scalar import serializer
from .date_scalar import serializer
from .datetime_scalar import serializer
from .decimal_scalar import serializer
from .enums import DividendPeriod, SecurityType


class SecurityInput(BaseModel):
    code: str
    type: Optional[SecurityType] = None
    name: Optional[str] = None
    exchange_code: str
    currency_iso_code: Optional[str] = None
    country_alpha_3: Optional[str] = Field(alias="country_alpha3", default=None)
    last_update: Annotated[datetime, PlainSerializer(serializer)]
    figi: Optional[str] = None
    isin: Optional[str] = None
    lei: Optional[str] = None
    wkn: Optional[str] = None
    cusip: Optional[str] = None
    cik: Optional[str] = None
    tws_con_id: Optional[Annotated[int, PlainSerializer(serializer)]] = None
    ipo_date: Optional[Annotated[date, PlainSerializer(serializer)]] = None
    is_delisted: Optional[bool] = None
    delisting_date: Optional[Annotated[date, PlainSerializer(serializer)]] = None
    description: Optional[str] = None
    marketcap: Optional[Annotated[int, PlainSerializer(serializer)]] = None
    beta: Optional[Annotated[Decimal, PlainSerializer(serializer)]] = None
    shares_outstanding: Optional[Annotated[int, PlainSerializer(serializer)]] = None
    shares_float: Optional[Annotated[int, PlainSerializer(serializer)]] = None
    shares_short: Optional[Annotated[int, PlainSerializer(serializer)]] = None
    short_ratio: Optional[Annotated[Decimal, PlainSerializer(serializer)]] = None
    short_percent_outstanding: Optional[
        Annotated[Decimal, PlainSerializer(serializer)]
    ] = None
    short_percent_float: Optional[
        Annotated[Decimal, PlainSerializer(serializer)]
    ] = None
    has_options: Optional[bool] = None
    url: Optional[str] = None
    gics_code: Optional[int] = None
    sector: Optional[str] = None
    industry: Optional[str] = None
    logo_url: Optional[str] = None
    logo_base_64: Optional[str] = Field(alias="logo_base64", default=None)
    ebitda: Optional[Annotated[int, PlainSerializer(serializer)]] = None
    pe_ratio: Optional[Annotated[Decimal, PlainSerializer(serializer)]] = None
    wallstreet_target_price: Optional[
        Annotated[Decimal, PlainSerializer(serializer)]
    ] = None
    book_value: Optional[Annotated[Decimal, PlainSerializer(serializer)]] = None
    dividend_share: Optional[Annotated[Decimal, PlainSerializer(serializer)]] = None
    dividend_yield: Optional[Annotated[Decimal, PlainSerializer(serializer)]] = None
    earnings_share: Optional[Annotated[Decimal, PlainSerializer(serializer)]] = None
    eps_estimate_current_year: Optional[
        Annotated[Decimal, PlainSerializer(serializer)]
    ] = None
    eps_estimate_next_year: Optional[
        Annotated[Decimal, PlainSerializer(serializer)]
    ] = None
    eps_estimate_next_quarter: Optional[
        Annotated[Decimal, PlainSerializer(serializer)]
    ] = None
    eps_estimate_current_quarter: Optional[
        Annotated[Decimal, PlainSerializer(serializer)]
    ] = None
    most_recent_quarter: Optional[Annotated[date, PlainSerializer(serializer)]] = None
    profit_margin: Optional[Annotated[Decimal, PlainSerializer(serializer)]] = None
    operating_margin_ttm: Optional[
        Annotated[Decimal, PlainSerializer(serializer)]
    ] = None
    return_on_assets_ttm: Optional[
        Annotated[Decimal, PlainSerializer(serializer)]
    ] = None
    return_on_equity_ttm: Optional[
        Annotated[Decimal, PlainSerializer(serializer)]
    ] = None
    revenue_ttm: Optional[Annotated[int, PlainSerializer(serializer)]] = None
    revenue_per_share_ttm: Optional[
        Annotated[Decimal, PlainSerializer(serializer)]
    ] = None
    quarterly_revenue_growth_yoy: Optional[
        Annotated[Decimal, PlainSerializer(serializer)]
    ] = None
    gross_profit_ttm: Optional[Annotated[int, PlainSerializer(serializer)]] = None
    diluted_eps_ttm: Optional[Annotated[Decimal, PlainSerializer(serializer)]] = None
    quarterly_earnings_growth_yoy: Optional[
        Annotated[Decimal, PlainSerializer(serializer)]
    ] = None
    forward_pe: Optional[Annotated[Decimal, PlainSerializer(serializer)]] = None
    price_sales_ttm: Optional[Annotated[Decimal, PlainSerializer(serializer)]] = None
    price_book_mrq: Optional[Annotated[Decimal, PlainSerializer(serializer)]] = None
    enterprise_value: Optional[Annotated[int, PlainSerializer(serializer)]] = None
    enterprise_value_revenue: Optional[
        Annotated[Decimal, PlainSerializer(serializer)]
    ] = None
    enterprise_value_ebitda: Optional[
        Annotated[Decimal, PlainSerializer(serializer)]
    ] = None


class SecurityQuoteData(BaseModel):
    date: Annotated[date, PlainSerializer(serializer)]
    open: Optional[Annotated[Decimal, PlainSerializer(serializer)]] = None
    high: Optional[Annotated[Decimal, PlainSerializer(serializer)]] = None
    low: Optional[Annotated[Decimal, PlainSerializer(serializer)]] = None
    close: Optional[Annotated[Decimal, PlainSerializer(serializer)]] = None
    split_adjusted_open: Optional[
        Annotated[Decimal, PlainSerializer(serializer)]
    ] = None
    split_adjusted_high: Optional[
        Annotated[Decimal, PlainSerializer(serializer)]
    ] = None
    split_adjusted_low: Optional[Annotated[Decimal, PlainSerializer(serializer)]] = None
    split_adjusted_close: Optional[
        Annotated[Decimal, PlainSerializer(serializer)]
    ] = None
    adjusted_close: Optional[Annotated[Decimal, PlainSerializer(serializer)]] = None
    volume: Optional[Annotated[Decimal, PlainSerializer(serializer)]] = None


class SecurityQuotesInput(BaseModel):
    code: str
    exchange_code: str
    quotes: List["SecurityQuoteData"]


class SplitData(BaseModel):
    date: Annotated[date, PlainSerializer(serializer)]
    old: Optional[Annotated[Decimal, PlainSerializer(serializer)]] = None
    new: Optional[Annotated[Decimal, PlainSerializer(serializer)]] = None


class SplitsInput(BaseModel):
    code: str
    exchange_code: str
    splits: List["SplitData"]


class DividendData(BaseModel):
    date: Annotated[date, PlainSerializer(serializer)]
    declaration_date: Optional[Annotated[date, PlainSerializer(serializer)]] = None
    record_date: Optional[Annotated[date, PlainSerializer(serializer)]] = None
    payment_date: Optional[Annotated[date, PlainSerializer(serializer)]] = None
    period: Optional[DividendPeriod] = None
    adjusted_value: Optional[Annotated[Decimal, PlainSerializer(serializer)]] = None
    value: Optional[Annotated[Decimal, PlainSerializer(serializer)]] = None


class DividendsInput(BaseModel):
    code: str
    exchange_code: str
    dividends: List["DividendData"]


class AnalystRatingsData(BaseModel):
    date_added: Optional[Annotated[date, PlainSerializer(serializer)]] = None
    rating: Optional[Annotated[Decimal, PlainSerializer(serializer)]] = None
    target_price: Optional[Annotated[Decimal, PlainSerializer(serializer)]] = None
    strong_buy: Optional[int] = None
    buy: Optional[int] = None
    hold: Optional[int] = None
    sell: Optional[int] = None
    strong_sell: Optional[int] = None


class AnalystRatingsInput(BaseModel):
    code: str
    exchange_code: str
    analyst_ratings: List["AnalystRatingsData"]


class InsiderTransactionsData(BaseModel):
    date: Annotated[date, PlainSerializer(serializer)]
    report_date: Optional[Annotated[date, PlainSerializer(serializer)]] = None
    owner_cik: Optional[str] = None
    owner_name: str
    owner_relationship: Optional[str] = None
    owner_title: Optional[str] = None
    transaction_date: Annotated[date, PlainSerializer(serializer)]
    transaction_code: str
    transaction_amount: Annotated[int, PlainSerializer(serializer)]
    transaction_price: Annotated[Decimal, PlainSerializer(serializer)]
    transaction_acquired_disposed: Optional[str] = None
    post_transaction_amount: Optional[
        Annotated[int, PlainSerializer(serializer)]
    ] = None
    sec_link: Optional[str] = None


class InsiderTransactionsInput(BaseModel):
    code: str
    exchange_code: str
    insider_transactions: List["InsiderTransactionsData"]


class OutstandingShareData(BaseModel):
    date: Annotated[date, PlainSerializer(serializer)]
    outstanding_shares: Optional[Annotated[int, PlainSerializer(serializer)]] = None


class OutstandingSharesInput(BaseModel):
    code: str
    exchange_code: str
    outstanding_shares: List["OutstandingShareData"]
