from near_jsonrpc_models.account_id import AccountId
from near_jsonrpc_models.crypto_hash import CryptoHash
from near_jsonrpc_models.execution_metadata_view import ExecutionMetadataView
from near_jsonrpc_models.execution_status_view import ExecutionStatusView
from near_jsonrpc_models.near_gas import NearGas
from near_jsonrpc_models.near_token import NearToken
from pydantic import BaseModel
from pydantic import Field
from typing import List


class ExecutionOutcomeView(BaseModel):
    # The id of the account on which the execution happens. For transaction this is signer_id,
    # for receipt this is receiver_id.
    executor_id: AccountId
    # The amount of the gas burnt by the given transaction or receipt.
    gas_burnt: NearGas
    # Logs from this transaction or receipt.
    logs: List[str]
    # Execution metadata, versioned
    metadata: ExecutionMetadataView = Field(default_factory=lambda: ExecutionMetadataView(**{'version': 1}))
    # Receipt IDs generated by this transaction or receipt.
    receipt_ids: List[CryptoHash]
    # Execution status. Contains the result in case of successful execution.
    status: ExecutionStatusView
    # The amount of tokens burnt corresponding to the burnt gas amount.
    # This value doesn't always equal to the `gas_burnt` multiplied by the gas price, because
    # the prepaid gas price might be lower than the actual gas price and it creates a deficit.
    # `tokens_burnt` also contains the penalty subtracted from refunds, while
    # `gas_burnt` only contains the gas that we actually burn for the execution.
    tokens_burnt: NearToken
