/* 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';
import type { AppDomainTokenModelsRiskLevel } from './AppDomainTokenModelsRiskLevel';
import {
    AppDomainTokenModelsRiskLevelFromJSON,
    AppDomainTokenModelsRiskLevelFromJSONTyped,
    AppDomainTokenModelsRiskLevelToJSON,
    AppDomainTokenModelsRiskLevelToJSONTyped,
} from './AppDomainTokenModelsRiskLevel';

/**
 * Token risk assessment.
 * @export
 * @interface TokenRisk
 */
export interface TokenRisk {
    /**
     * 
     * @type {string}
     * @memberof TokenRisk
     */
    address: string;
    /**
     * 
     * @type {string}
     * @memberof TokenRisk
     */
    chain: string;
    /**
     * 
     * @type {number}
     * @memberof TokenRisk
     */
    riskScore?: number;
    /**
     * 
     * @type {AppDomainTokenModelsRiskLevel}
     * @memberof TokenRisk
     */
    riskLevel: AppDomainTokenModelsRiskLevel;
    /**
     * 
     * @type {Array<{ [key: string]: any; }>}
     * @memberof TokenRisk
     */
    flags?: Array<{ [key: string]: any; }>;
    /**
     * 
     * @type {boolean}
     * @memberof TokenRisk
     */
    honeypot?: boolean;
    /**
     * 
     * @type {boolean}
     * @memberof TokenRisk
     */
    canSell?: boolean;
    /**
     * 
     * @type {boolean}
     * @memberof TokenRisk
     */
    canBuy?: boolean;
    /**
     * 
     * @type {boolean}
     * @memberof TokenRisk
     */
    takeBack?: boolean;
    /**
     * 
     * @type {boolean}
     * @memberof TokenRisk
     */
    ownerChangeBalance?: boolean;
    /**
     * 
     * @type {boolean}
     * @memberof TokenRisk
     */
    transferPausable?: boolean;
    /**
     * 
     * @type {Date}
     * @memberof TokenRisk
     */
    analyzedAt?: Date;
}



/**
 * Check if a given object implements the TokenRisk interface.
 */
export function instanceOfTokenRisk(value: object): value is TokenRisk {
    if (!('address' in value) || value['address'] === undefined) return false;
    if (!('chain' in value) || value['chain'] === undefined) return false;
    if ((!('riskLevel' in value) && !('risk_level' in value)) || (value['riskLevel'] === undefined && value['risk_level'] === undefined)) return false;
    return true;
}

export function TokenRiskFromJSON(json: any): TokenRisk {
    return TokenRiskFromJSONTyped(json, false);
}

export function TokenRiskFromJSONTyped(json: any, ignoreDiscriminator: boolean): TokenRisk {
    if (json == null) {
        return json;
    }
    return {
        
        'address': json['address'],
        'chain': json['chain'],
        'riskScore': json['risk_score'] == null ? undefined : json['risk_score'],
        'riskLevel': AppDomainTokenModelsRiskLevelFromJSON(json['risk_level']),
        'flags': json['flags'] == null ? undefined : json['flags'],
        'honeypot': json['honeypot'] == null ? undefined : json['honeypot'],
        'canSell': json['can_sell'] == null ? undefined : json['can_sell'],
        'canBuy': json['can_buy'] == null ? undefined : json['can_buy'],
        'takeBack': json['take_back'] == null ? undefined : json['take_back'],
        'ownerChangeBalance': json['owner_change_balance'] == null ? undefined : json['owner_change_balance'],
        'transferPausable': json['transfer_pausable'] == null ? undefined : json['transfer_pausable'],
        'analyzedAt': json['analyzed_at'] == null ? undefined : (new Date(json['analyzed_at'])),
    };
}

export function TokenRiskToJSON(json: any): TokenRisk {
    return TokenRiskToJSONTyped(json, false);
}

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

    return {
        
        'address': value['address'],
        'chain': value['chain'],
        'risk_score': value['riskScore'],
        'risk_level': AppDomainTokenModelsRiskLevelToJSON(value['riskLevel']),
        'flags': value['flags'],
        'honeypot': value['honeypot'],
        'can_sell': value['canSell'],
        'can_buy': value['canBuy'],
        'take_back': value['takeBack'],
        'owner_change_balance': value['ownerChangeBalance'],
        'transfer_pausable': value['transferPausable'],
        'analyzed_at': value['analyzedAt'] == null ? value['analyzedAt'] : value['analyzedAt'].toISOString(),
    };
}

