# AUTOGENERATED – DO NOT EDIT
from __future__ import annotations
from pydantic import BaseModel, Field
from typing import Optional, List, Union, Literal, Annotated, Any, Dict
from datetime import datetime

from .enums import *
from .types import *
from .runtime.url import AccountUrl

class LegacyED25519Signature(BaseModel):
    """LegacyED25519Signature — legacyed25519signature"""
    kind: Literal["legacyed25519signature"] = "legacyed25519signature"
    timestamp: int  # uint
    public_key: bytes  # bytes
    signature: bytes  # bytes
    signer: AccountUrl  # *url
    signer_version: int  # uint
    vote: VoteType | None = None  # VoteType
    transaction_hash: bytes | None = None  # hash

class RCD1Signature(BaseModel):
    """RCD1Signature — rcd1signature"""
    kind: Literal["rcd1signature"] = "rcd1signature"
    public_key: bytes  # bytes
    signature: bytes  # bytes
    signer: AccountUrl  # *url
    signer_version: int  # uint
    timestamp: int | None = None  # uint
    vote: VoteType | None = None  # VoteType
    transaction_hash: bytes | None = None  # hash
    memo: str | None = None  # string
    data: bytes | None = None  # bytes

class ED25519Signature(BaseModel):
    """ED25519Signature — ed25519signature"""
    kind: Literal["ed25519signature"] = "ed25519signature"
    public_key: bytes  # bytes
    signature: bytes  # bytes
    signer: AccountUrl  # *url
    signer_version: int  # uint
    timestamp: int | None = None  # uint
    vote: VoteType | None = None  # VoteType
    transaction_hash: bytes | None = None  # hash
    memo: str | None = None  # string
    data: bytes | None = None  # bytes

class BTCSignature(BaseModel):
    """BTCSignature — btcsignature"""
    kind: Literal["btcsignature"] = "btcsignature"
    public_key: bytes  # bytes
    signature: bytes  # bytes
    signer: AccountUrl  # *url
    signer_version: int  # uint
    timestamp: int | None = None  # uint
    vote: VoteType | None = None  # VoteType
    transaction_hash: bytes | None = None  # hash
    memo: str | None = None  # string
    data: bytes | None = None  # bytes

class BTCLegacySignature(BaseModel):
    """BTCLegacySignature — btclegacysignature"""
    kind: Literal["btclegacysignature"] = "btclegacysignature"
    public_key: bytes  # bytes
    signature: bytes  # bytes
    signer: AccountUrl  # *url
    signer_version: int  # uint
    timestamp: int | None = None  # uint
    vote: VoteType | None = None  # VoteType
    transaction_hash: bytes | None = None  # hash
    memo: str | None = None  # string
    data: bytes | None = None  # bytes

class ETHSignature(BaseModel):
    """ETHSignature — ethsignature"""
    kind: Literal["ethsignature"] = "ethsignature"
    public_key: bytes  # bytes
    signature: bytes  # bytes
    signer: AccountUrl  # *url
    signer_version: int  # uint
    timestamp: int | None = None  # uint
    vote: VoteType | None = None  # VoteType
    transaction_hash: bytes | None = None  # hash
    memo: str | None = None  # string
    data: bytes | None = None  # bytes

class RsaSha256Signature(BaseModel):
    """RsaSha256Signature — rsasha256signature"""
    kind: Literal["rsasha256signature"] = "rsasha256signature"
    public_key: bytes  # bytes
    signature: bytes  # bytes
    signer: AccountUrl  # *url
    signer_version: int  # uint
    timestamp: int | None = None  # uint
    vote: VoteType | None = None  # VoteType
    transaction_hash: bytes | None = None  # hash
    memo: str | None = None  # string
    data: bytes | None = None  # bytes

class EcdsaSha256Signature(BaseModel):
    """EcdsaSha256Signature — ecdsasha256signature"""
    kind: Literal["ecdsasha256signature"] = "ecdsasha256signature"
    public_key: bytes  # bytes
    signature: bytes  # bytes
    signer: AccountUrl  # *url
    signer_version: int  # uint
    timestamp: int | None = None  # uint
    vote: VoteType | None = None  # VoteType
    transaction_hash: bytes | None = None  # hash
    memo: str | None = None  # string
    data: bytes | None = None  # bytes

class TypedDataSignature(BaseModel):
    """TypedDataSignature — typeddatasignature"""
    kind: Literal["typeddatasignature"] = "typeddatasignature"
    public_key: bytes  # bytes
    signature: bytes  # bytes
    signer: AccountUrl  # *url
    signer_version: int  # uint
    timestamp: int | None = None  # uint
    vote: VoteType | None = None  # VoteType
    transaction_hash: bytes | None = None  # hash
    memo: str | None = None  # string
    data: bytes | None = None  # bytes
    chain_id: int  # *bigint

class ReceiptSignature(BaseModel):
    """ReceiptSignature — receiptsignature"""
    kind: Literal["receiptsignature"] = "receiptsignature"
    source_network: AccountUrl  # *url
    proof: Any  # merkle.Receipt
    transaction_hash: bytes | None = None  # hash

class PartitionSignature(BaseModel):
    """PartitionSignature — partitionsignature"""
    kind: Literal["partitionsignature"] = "partitionsignature"
    source_network: AccountUrl  # *url
    destination_network: AccountUrl  # *url
    sequence_number: int  # uint
    transaction_hash: bytes | None = None  # hash

class SignatureSet(BaseModel):
    """SignatureSet — signatureset"""
    kind: Literal["signatureset"] = "signatureset"
    vote: VoteType | None = None  # VoteType
    signer: AccountUrl  # *url
    transaction_hash: bytes | None = None  # hash
    signatures: List["Signature"]  # []Signature
    authority: AccountUrl  # *url

class RemoteSignature(BaseModel):
    """RemoteSignature — remotesignature"""
    kind: Literal["remotesignature"] = "remotesignature"
    destination: AccountUrl  # *url
    signature: "Signature"  # Signature
    cause: List[bytes]  # []hash

class DelegatedSignature(BaseModel):
    """DelegatedSignature — delegatedsignature"""
    kind: Literal["delegatedsignature"] = "delegatedsignature"
    signature: "Signature"  # Signature
    delegator: AccountUrl  # *url

class InternalSignature(BaseModel):
    """InternalSignature — internalsignature"""
    kind: Literal["internalsignature"] = "internalsignature"
    cause: bytes  # hash
    transaction_hash: bytes  # hash

class AuthoritySignature(BaseModel):
    """AuthoritySignature — authoritysignature"""
    kind: Literal["authoritysignature"] = "authoritysignature"
    origin: AccountUrl  # *url
    authority: AccountUrl  # *url
    vote: VoteType | None = None  # VoteType
    tx_id: str  # *txid
    cause: str  # *txid
    delegator: List[AccountUrl]  # []*url
    memo: str | None = None  # string

Signature = Annotated[Union[
    LegacyED25519Signature,
    RCD1Signature,
    ED25519Signature,
    BTCSignature,
    BTCLegacySignature,
    ETHSignature,
    RsaSha256Signature,
    EcdsaSha256Signature,
    TypedDataSignature,
    ReceiptSignature,
    PartitionSignature,
    SignatureSet,
    RemoteSignature,
    DelegatedSignature,
    InternalSignature,
    AuthoritySignature
], Field(discriminator="kind")]

# Rebuild models to resolve forward references
SignatureSet.model_rebuild()
RemoteSignature.model_rebuild()
DelegatedSignature.model_rebuild()

__all__ = ["Signature", "LegacyED25519Signature", "RCD1Signature", "ED25519Signature", "BTCSignature", "BTCLegacySignature", "ETHSignature", "RsaSha256Signature", "EcdsaSha256Signature", "TypedDataSignature", "ReceiptSignature", "PartitionSignature", "SignatureSet", "RemoteSignature", "DelegatedSignature", "InternalSignature", "AuthoritySignature"]