"use strict"; // Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. // See LICENSE.txt for license information. Object.defineProperty(exports, "__esModule", { value: true }); exports.isPostAction = isPostAction; const utilities_1 = require("./utilities"); function isPostAction(v) { if (typeof v !== 'object' || !v) { return false; } if (!('id' in v)) { return false; } if (typeof v.id !== 'string') { return false; } if (!('name' in v)) { return false; } if (typeof v.name !== 'string') { return false; } if ('type' in v && typeof v.type !== 'string') { return false; } if ('disabled' in v && typeof v.disabled !== 'boolean') { return false; } if ('style' in v && typeof v.style !== 'string') { return false; } if ('data_source' in v && typeof v.data_source !== 'string') { return false; } if ('options' in v && !(0, utilities_1.isArrayOf)(v.options, isPostActionOption)) { return false; } if ('default_option' in v && typeof v.default_option !== 'string') { return false; } if ('cookie' in v && typeof v.cookie !== 'string') { return false; } return true; } function isPostActionOption(v) { if (typeof v !== 'object' || !v) { return false; } if ('text' in v && typeof v.text !== 'string') { return false; } if ('value' in v && typeof v.value !== 'string') { return false; } return true; }