"""Transaction model — IndexedErgoTransaction from the Ergo Node API."""

from typing import List

from pydantic import BaseModel, Field

from boxtime.models.node.data_input import DataInput
from boxtime.models.node.ergo_box import ErgoBox


class Transaction(BaseModel):
    """``IndexedErgoTransaction`` in the spec."""

    id: str
    inputs: List[ErgoBox]
    data_inputs: List[DataInput] = Field(default_factory=list, alias="dataInputs")
    outputs: List[ErgoBox]
    inclusion_height: int = Field(alias="inclusionHeight")
    num_confirmations: int = Field(alias="numConfirmations")
    block_id: str = Field(alias="blockId")
    timestamp: int
    index: int
    global_index: int = Field(alias="globalIndex")
    size: int
