/* tslint:disable */
/* eslint-disable */
/**
 * RMI Backend
 * Rug Munch Intelligence — institutional-grade crypto intelligence API. 13+ chains, 96 data providers, 8 MCP tools, x402 paid tier, sovereign-first FOSS.
 *
 * The version of the OpenAPI document: 2026.06.21
 * 
 *
 * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
 * https://openapi-generator.tech
 * Do not edit the class manually.
 */

import { mapValues } from '../runtime';
/**
 * A wallet transaction summary.
 * @export
 * @interface Transaction
 */
export interface Transaction {
    /**
     * 
     * @type {string}
     * @memberof Transaction
     */
    hash: string;
    /**
     * 
     * @type {string}
     * @memberof Transaction
     */
    type?: string;
    /**
     * 
     * @type {number}
     * @memberof Transaction
     */
    amountUsd?: number;
    /**
     * 
     * @type {number}
     * @memberof Transaction
     */
    timestamp?: number;
    /**
     * 
     * @type {Date}
     * @memberof Transaction
     */
    blockTime?: Date | null;
    /**
     * in | out | self
     * @type {string}
     * @memberof Transaction
     */
    direction?: string | null;
}

/**
 * Check if a given object implements the Transaction interface.
 */
export function instanceOfTransaction(value: object): value is Transaction {
    if (!('hash' in value) || value['hash'] === undefined) return false;
    return true;
}

export function TransactionFromJSON(json: any): Transaction {
    return TransactionFromJSONTyped(json, false);
}

export function TransactionFromJSONTyped(json: any, ignoreDiscriminator: boolean): Transaction {
    if (json == null) {
        return json;
    }
    return {
        
        'hash': json['hash'],
        'type': json['type'] == null ? undefined : json['type'],
        'amountUsd': json['amount_usd'] == null ? undefined : json['amount_usd'],
        'timestamp': json['timestamp'] == null ? undefined : json['timestamp'],
        'blockTime': json['block_time'] == null ? undefined : (new Date(json['block_time'])),
        'direction': json['direction'] == null ? undefined : json['direction'],
    };
}

export function TransactionToJSON(json: any): Transaction {
    return TransactionToJSONTyped(json, false);
}

export function TransactionToJSONTyped(value?: Transaction | null, ignoreDiscriminator: boolean = false): any {
    if (value == null) {
        return value;
    }

    return {
        
        'hash': value['hash'],
        'type': value['type'],
        'amount_usd': value['amountUsd'],
        'timestamp': value['timestamp'],
        'block_time': value['blockTime'] == null ? value['blockTime'] : value['blockTime'].toISOString(),
        'direction': value['direction'],
    };
}

