"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.schemaRepairOOSAccountsReq = exports.schemaAccountRepairInstruction = exports.schemaSignedReceipt = exports.schemaProposal = exports.schemaAppliedVote = exports.schemaSign = void 0;
exports.initRepairOOSAccountReq = initRepairOOSAccountReq;
const SchemaHelpers_1 = require("../../utils/serialization/SchemaHelpers");
const AJVSchemaEnum_1 = require("../enum/AJVSchemaEnum");
const WrappedData_1 = require("./WrappedData");
exports.schemaSign = {
    type: 'object',
    properties: {
        owner: { type: 'string' },
        sig: { type: 'string' },
    },
    required: ['owner', 'sig'],
};
exports.schemaAppliedVote = {
    type: 'object',
    properties: {
        txid: { type: 'string' },
        transaction_result: { type: 'boolean' },
        account_id: {
            type: 'array',
            items: { type: 'string' },
        },
        account_state_hash_after: {
            type: 'array',
            items: { type: 'string' },
        },
        account_state_hash_before: {
            type: 'array',
            items: { type: 'string' },
        },
        cant_apply: { type: 'boolean' },
        node_id: { type: 'string' },
        sign: exports.schemaSign,
        app_data_hash: { type: 'string' },
    },
    required: [
        'txid',
        'transaction_result',
        'account_id',
        'account_state_hash_after',
        'account_state_hash_before',
        'cant_apply',
        'node_id',
    ],
};
exports.schemaProposal = {
    type: 'object',
    properties: {
        applied: { type: 'boolean' },
        cant_preApply: { type: 'boolean' },
        accountIDs: {
            type: 'array',
            items: { type: 'string' },
        },
        beforeStateHashes: {
            type: 'array',
            items: { type: 'string' },
        },
        afterStateHashes: {
            type: 'array',
            items: { type: 'string' },
        },
        appReceiptDataHash: { type: 'string' },
        txid: { type: 'string' },
    },
    required: ['applied', 'cant_preApply', 'accountIDs', 'beforeStateHashes', 'afterStateHashes', 'appReceiptDataHash'],
};
exports.schemaSignedReceipt = {
    type: 'object',
    properties: {
        proposal: exports.schemaProposal,
        proposalHash: { type: 'string' },
        signaturePack: {
            type: 'array',
            items: exports.schemaSign,
        },
        voteOffsets: {
            type: 'array',
            items: { type: 'number' },
        },
        sign: exports.schemaSign,
    },
    required: ['proposal', 'proposalHash', 'signaturePack', 'voteOffsets'],
};
exports.schemaAccountRepairInstruction = {
    type: 'object',
    properties: {
        accountID: { type: 'string' },
        hash: { type: 'string' },
        txId: { type: 'string' },
        accountData: WrappedData_1.schemaWrappedData,
        targetNodeId: { type: 'string' },
        signedReceipt: exports.schemaSignedReceipt,
    },
    required: ['accountID', 'hash', 'txId', 'accountData', 'targetNodeId', 'signedReceipt'],
};
exports.schemaRepairOOSAccountsReq = {
    type: 'object',
    properties: {
        repairInstructions: {
            type: 'array',
            items: exports.schemaAccountRepairInstruction,
        },
    },
    required: ['repairInstructions'],
};
function initRepairOOSAccountReq() {
    addSchemaDependencies();
    addSchemas();
}
function addSchemaDependencies() {
    // No dependencies
}
function addSchemas() {
    (0, SchemaHelpers_1.addSchema)(AJVSchemaEnum_1.AJVSchemaEnum.RepairOOSAccountsReq, exports.schemaRepairOOSAccountsReq);
}
//# sourceMappingURL=RepairOOSAccountsReq.js.map