import isObject from 'lodash/isObject';
import {} from './core';
/**
 * Check if a value is a variable instance and type guard the response
 *
 * @param variable the potential variable to check
 */
export function isVariable(variable) {
    return (variable &&
        typeof variable == 'object' &&
        variable.hasOwnProperty('uid') &&
        variable.hasOwnProperty('__typename') &&
        variable.__typename.includes('Variable'));
}
/**
 * Check if a value is a single variable instance and type guard the response
 *
 * @param variable the potential variable to check
 */
export function isSingleVariable(variable) {
    return isVariable(variable) && variable.__typename === 'Variable';
}
/**
 * Check if a value is a derived variable instance and type guard the response
 *
 * @param variable the potential derived variable to check
 */
export function isDerivedVariable(variable) {
    return isVariable(variable) && variable.__typename === 'DerivedVariable';
}
/** Check if a value is a server variable instance and type guard the response */
export function isServerVariable(variable) {
    return isVariable(variable) && variable.__typename === 'ServerVariable';
}
/**
 * Check if a value is a loop variable instance and type guard the response
 *
 * @param variable the potential variable to check
 */
export function isLoopVariable(variable) {
    return (variable &&
        typeof variable == 'object' &&
        variable.hasOwnProperty('uid') &&
        variable.hasOwnProperty('__typename') &&
        variable.__typename === 'LoopVariable');
}
/**
 * Check if a value is a switch variable instance and type guard the response
 *
 * @param variable the potential variable to check
 */
export function isSwitchVariable(variable) {
    return isVariable(variable) && variable.__typename === 'SwitchVariable';
}
/**
 * Check if a value is a state variable instance and type guard the response
 *
 * @param variable the potential variable to check
 */
export function isStateVariable(variable) {
    return isVariable(variable) && variable.__typename === 'StateVariable';
}
/**
 * Check if a value is a stream variable instance and type guard the response
 *
 * @param variable the potential variable to check
 */
export function isStreamVariable(variable) {
    return isVariable(variable) && variable.__typename === 'StreamVariable';
}
/**
 * Check if a value is a ResolvedDerivedVariable
 *
 * @param value value to check
 */
export function isResolvedDerivedVariable(value) {
    return (value &&
        typeof value === 'object' &&
        'values' in value &&
        'type' in value &&
        value.type === 'derived' &&
        'uid' in value);
}
export function isResolvedServerVariable(value) {
    return (value &&
        typeof value === 'object' &&
        'type' in value &&
        value.type === 'server' &&
        'uid' in value &&
        'sequence_number' in value);
}
export function isResolvedSwitchVariable(value) {
    return (value &&
        typeof value === 'object' &&
        'type' in value &&
        value.type === 'switch' &&
        'uid' in value &&
        'value_map' in value);
}
/**
 * Check if a value is an ActionImpl
 *
 * @param action value to check
 */
export function isActionImpl(action) {
    return action && typeof action === 'object' && action.__typename === 'ActionImpl';
}
export function isAnnotatedAction(action) {
    return action && isObject(action) && 'uid' in action && 'definition_uid' in action && 'dynamic_kwargs' in action;
}
export const isPyComponent = (value) => isObject(value) &&
    'props' in value &&
    isObject(value.props) &&
    'func_name' in value.props &&
    'dynamic_kwargs' in value.props;
export function isCondition(value) {
    return value && typeof value === 'object' && value.__typename === 'Condition';
}
//# sourceMappingURL=utils.js.map