package io.synor.privacy

import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable

// ==================== Confidential Transactions ====================

@Serializable
data class ConfidentialTxInput(
    val commitment: String,
    @SerialName("blinding_factor") val blindingFactor: String,
    val value: String,
    @SerialName("key_image") val keyImage: String? = null
)

@Serializable
data class ConfidentialTxOutput(
    val commitment: String,
    @SerialName("blinding_factor") val blindingFactor: String,
    val value: String,
    @SerialName("recipient_public_key") val recipientPublicKey: String,
    @SerialName("range_proof") val rangeProof: String? = null
)

@Serializable
data class ConfidentialTransaction(
    val id: String,
    val inputs: List<ConfidentialTxInput>,
    val outputs: List<ConfidentialTxOutput>,
    val fee: String,
    val excess: String,
    @SerialName("excess_sig") val excessSig: String,
    @SerialName("kernel_offset") val kernelOffset: String? = null
)

// ==================== Commitments ====================

@Serializable
data class Commitment(
    val commitment: String,
    @SerialName("blinding_factor") val blindingFactor: String
)

@Serializable
data class RangeProof(
    val proof: String,
    val commitment: String,
    @SerialName("min_value") val minValue: Long,
    @SerialName("max_value") val maxValue: Long
)

// ==================== Ring Signatures ====================

@Serializable
data class RingSignature(
    val c0: String,
    val s: List<String>,
    @SerialName("key_image") val keyImage: String,
    val ring: List<String>
)

// ==================== Stealth Addresses ====================

@Serializable
data class StealthKeyPair(
    @SerialName("spend_public_key") val spendPublicKey: String,
    @SerialName("spend_private_key") val spendPrivateKey: String,
    @SerialName("view_public_key") val viewPublicKey: String,
    @SerialName("view_private_key") val viewPrivateKey: String
)

@Serializable
data class StealthAddress(
    val address: String,
    @SerialName("ephemeral_public_key") val ephemeralPublicKey: String,
    @SerialName("tx_public_key") val txPublicKey: String? = null
)

@Serializable
data class StealthOutput(
    @SerialName("tx_hash") val txHash: String,
    @SerialName("output_index") val outputIndex: Int,
    @SerialName("stealth_address") val stealthAddress: String,
    val amount: String,
    @SerialName("block_height") val blockHeight: Long
)
