import { FieldSchema, Objects, StructureSchema } from '@ephox/boulder';
import { Fun } from '@ephox/katamari';
import * as CommonBehaviour from '../../behaviour/common/Behaviour';
import { NoState } from '../../behaviour/common/BehaviourState';
const derive = (capabilities) => Objects.wrapAll(capabilities);
const simpleSchema = StructureSchema.objOfOnly([
    FieldSchema.required('fields'),
    FieldSchema.required('name'),
    FieldSchema.defaulted('active', {}),
    FieldSchema.defaulted('apis', {}),
    FieldSchema.defaulted('state', NoState),
    FieldSchema.defaulted('extra', {})
]);
const create = (data) => {
    const value = StructureSchema.asRawOrDie('Creating behaviour: ' + data.name, simpleSchema, data);
    return CommonBehaviour.create(value.fields, value.name, value.active, value.apis, value.extra, value.state);
};
const modeSchema = StructureSchema.objOfOnly([
    FieldSchema.required('branchKey'),
    FieldSchema.required('branches'),
    FieldSchema.required('name'),
    FieldSchema.defaulted('active', {}),
    FieldSchema.defaulted('apis', {}),
    FieldSchema.defaulted('state', NoState),
    FieldSchema.defaulted('extra', {})
]);
const createModes = (data) => {
    const value = StructureSchema.asRawOrDie('Creating behaviour: ' + data.name, modeSchema, data);
    return CommonBehaviour.createModes(StructureSchema.choose(value.branchKey, value.branches), value.name, value.active, value.apis, value.extra, value.state);
};
const revoke = Fun.constant(undefined);
const noActive = Fun.constant({});
const noApis = Fun.constant({});
const noExtra = Fun.constant({});
export { derive, revoke, noActive, noApis, noExtra, create, createModes };
//# sourceMappingURL=Behaviour.js.map