"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const types_1 = __importDefault(require("../types"));
const entry_component_1 = require("../datalayer/entry-component");
exports.IDENTITY_ENTRY_INSTANCE_TYPE = "IdentityEntryComponent";
;
/**
 * an entry specifies a kind of data that can be stored in a line of the table
 */
exports.default = (props) => {
    // the component must have the properties of IComponent
    const componentProps = {
        infrastructureType: types_1.default.INFRASTRUCTURE_TYPE_COMPONENT,
        instanceType: exports.IDENTITY_ENTRY_INSTANCE_TYPE,
        instanceId: props.id
    };
    // set our storeData-Property
    const identityEntryProps = {
        setIdentityKey: (identityKey) => {
            identityEntryProps.rangeKey = identityKey;
            // now that we have the rangeKey in place, we convert to a normal entity
            componentProps.instanceType = entry_component_1.ENTRY_INSTANCE_TYPE;
        }
    };
    return Object.assign({}, props, componentProps, identityEntryProps);
};
exports.isIdentityEntry = (component) => {
    return component !== undefined && component.instanceType === exports.IDENTITY_ENTRY_INSTANCE_TYPE;
};
//# sourceMappingURL=identity-entry-component.js.map