/* tslint:disable */
/* eslint-disable */
/**
 * Rosetta
 * Build Once. Integrate Your Blockchain Everywhere.
 *
 * The version of the OpenAPI document: 1.4.10
 *
 *
 * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
 * https://openapi-generator.tech
 * Do not edit the class manually.
 */

import { exists } from '../runtime';
import {
    AccountIdentifier,
    AccountIdentifierFromJSON,
    AccountIdentifierToJSON,
    SignatureType,
    SignatureTypeFromJSON,
    SignatureTypeToJSON,
} from './';

/**
 * SigningPayload is signed by the client with the keypair associated with an AccountIdentifier using the specified SignatureType. SignatureType can be optionally populated if there is a restriction on the signature scheme that can be used to sign the payload.
 * @export
 * @interface SigningPayload
 */
export interface SigningPayload {
    /**
     * [DEPRECATED by `account_identifier` in `v1.4.4`] The network-specific address of the account that should sign the payload.
     * @type {string}
     * @memberof SigningPayload
     */
    address?: string;
    /**
     *
     * @type {AccountIdentifier}
     * @memberof SigningPayload
     */
    account_identifier?: AccountIdentifier;
    /**
     *
     * @type {string}
     * @memberof SigningPayload
     */
    hex_bytes: string;
    /**
     *
     * @type {SignatureType}
     * @memberof SigningPayload
     */
    signature_type?: SignatureType;
}

export function SigningPayloadFromJSON(json: any): SigningPayload {
    return SigningPayloadFromJSONTyped(json, false);
}

export function SigningPayloadFromJSONTyped(json: any, ignoreDiscriminator: boolean): SigningPayload {
    if (json === undefined || json === null) {
        return json;
    }
    return {
        address: !exists(json, 'address') ? undefined : json['address'],
        account_identifier: !exists(json, 'account_identifier') ? undefined : AccountIdentifierFromJSON(json['account_identifier']),
        hex_bytes: json['hex_bytes'],
        signature_type: !exists(json, 'signature_type') ? undefined : SignatureTypeFromJSON(json['signature_type']),
    };
}

export function SigningPayloadToJSON(value?: SigningPayload | null): any {
    if (value === undefined) {
        return undefined;
    }
    if (value === null) {
        return null;
    }
    return {
        address: value.address,
        account_identifier: AccountIdentifierToJSON(value.account_identifier),
        hex_bytes: value.hex_bytes,
        signature_type: SignatureTypeToJSON(value.signature_type),
    };
}
