var __assign = (this && this.__assign) || function () {
    __assign = Object.assign || function(t) {
        for (var s, i = 1, n = arguments.length; i < n; i++) {
            s = arguments[i];
            for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
                t[p] = s[p];
        }
        return t;
    };
    return __assign.apply(this, arguments);
};
import { ParticipationStatus } from '@reltio/mdm-sdk';
export var createEntity = function (_a) {
    var _b = _a === void 0 ? {} : _a, _c = _b.withAppliedSurvivorshipRules, withAppliedSurvivorshipRules = _c === void 0 ? false : _c;
    return {
        uri: 'entities/01L2n5z',
        type: 'configuration/entityTypes/HCP',
        label: 'entity label',
        attributes: {
            Boolean: [
                __assign({ ov: true, type: 'configuration/entityTypes/HCP/attributes/Boolean', uri: 'entities/01L2n5z/attributes/Boolean/5nmc3Cp', value: 'true' }, (withAppliedSurvivorshipRules && {
                    ovDetails: {
                        participationStatus: ParticipationStatus.Strategy,
                        appliedSurvivorshipRules: 'Frequency'
                    }
                }))
            ],
            TextField: [
                __assign({ ov: true, type: 'configuration/entityTypes/HCP/attributes/TextField', uri: 'entities/01L2n5z/attributes/TextField/5noU1aB', value: 'text field value' }, (withAppliedSurvivorshipRules && {
                    ovDetails: {
                        participationStatus: ParticipationStatus.Strategy,
                        appliedSurvivorshipRules: { SRC_SYS: [{ SRC_SYS: ['SRC_SYS', 'Aggregation'] }, 'Frequency'] }
                    }
                })),
                __assign({ ov: false, type: 'configuration/entityTypes/HCP/attributes/TextField', uri: 'entities/01L2n5z/attributes/TextField/5noU1aB', value: 'another text value', ignored: true }, (withAppliedSurvivorshipRules && {
                    ovDetails: {
                        participationStatus: ParticipationStatus.Strategy,
                        appliedSurvivorshipRules: {
                            SRC_SYS: [{ SRC_SYS: ['SRC_SYS', 'SRC_SYS'] }, { SRC_SYS: ['SRC_SYS'] }, 'LUD']
                        }
                    }
                }))
            ],
            DeepNested: [
                __assign({ label: 'Nested Label', value: {
                        FirstLevelNestedSub1: [
                            __assign({ type: 'configuration/entityTypes/HCP/attributes/DeepNested/attributes/FirstLevelNestedSub1', ov: true, value: '123', uri: 'entities/01L2n5z/attributes/DeepNested/1ZAtO4T6/FirstLevelNestedSub1/1ZAtO8jM' }, (withAppliedSurvivorshipRules && {
                                ovDetails: {
                                    participationStatus: ParticipationStatus.Strategy,
                                    appliedSurvivorshipRules: {
                                        LUD: [{ LUD: ['LUD', 'Frequency'] }, 'LUD']
                                    }
                                }
                            }))
                        ]
                    }, ov: true, uri: 'entities/01L2n5z/attributes/DeepNested/1ZAtO4T6' }, (withAppliedSurvivorshipRules && {
                    ovDetails: {
                        participationStatus: ParticipationStatus.Strategy,
                        appliedSurvivorshipRules: {
                            SRC_SYS: [{ SRC_SYS: ['Aggregation', 'LUD'] }, 'SRC_SYS']
                        }
                    }
                }))
            ],
            Address: [
                __assign({ label: 'Reference Address', relationshipLabel: 'new address', refEntity: {
                        objectURI: 'entities/2EpaVt0k',
                        type: 'configuration/entityTypes/Location',
                        crosswalks: []
                    }, refRelation: {
                        objectURI: 'relations/1GrMXM4O',
                        type: 'configuration/relationTypes/HasAddress',
                        crosswalks: []
                    }, uri: 'entities/2Vek4DnE/attributes/Address/1GrMXM4O', value: {
                        AddressLine1: [
                            __assign({ ov: true, type: 'configuration/entityTypes/Location/attributes/AddressLine1', uri: 'entities/2Vek4DnE/attributes/Address/1GrMXM4O/AddressLine1/2GcBL4K00', value: 'address line 1 value' }, (withAppliedSurvivorshipRules && {
                                ovDetails: {
                                    participationStatus: ParticipationStatus.Strategy,
                                    appliedSurvivorshipRules: {
                                        Frequency: [{ Frequency: ['MinValue', 'LUD'] }, 'Frequency']
                                    }
                                }
                            }))
                        ]
                    }, startObjectCrosswalks: [] }, (withAppliedSurvivorshipRules && {
                    ovDetails: {
                        participationStatus: ParticipationStatus.Strategy,
                        appliedSurvivorshipRules: {
                            MinValue: [{ LUD: ['Frequency'] }, 'MinValue']
                        }
                    }
                }))
            ],
            ImageGallery: [
                {
                    label: '',
                    value: {
                        UrlThumbnail: [
                            {
                                type: 'configuration/entityTypes/HCP/attributes/ImageGallery/attributes/UrlThumbnail',
                                ov: true,
                                value: 'https://s3.amazonaws.com/reltio.qa.ih/thumbnailInew/5iWrjreLxiT2avDKoX3fQmqCu.png',
                                uri: 'entities/01L2n5z/attributes/ImageGallery/1IozCV9I/UrlThumbnail/1IozCdfo'
                            }
                        ]
                    },
                    ov: true,
                    uri: 'entities/01L2n5z/attributes/ImageGallery/1IozCV9I'
                }
            ]
        },
        crosswalks: [
            {
                attributes: [
                    'entities/01L2n5z/attributes/TextField/5noU1aB',
                    'entities/01L2n5z/attributes/Boolean/5nmc3Cp'
                ],
                type: 'configuration/sources/Reltio',
                uri: 'entities/01L2n5z/crosswalks/7F10sMx',
                value: '01L2n5z'
            }
        ]
    };
};
export var createEntityWithAllParticipationStatuses = function () {
    var entity = createEntity({ withAppliedSurvivorshipRules: true });
    return __assign(__assign({}, entity), { attributes: __assign(__assign({}, entity.attributes), { Boolean: [
                {
                    ov: true,
                    type: 'configuration/entityTypes/HCP/attributes/Boolean',
                    uri: 'entities/01L2n5z/attributes/Boolean/5nmc3CpPinned',
                    value: 'false',
                    ovDetails: {
                        participationStatus: ParticipationStatus.Pinned,
                        appliedSurvivorshipRules: 'N/A'
                    }
                },
                {
                    ov: true,
                    type: 'configuration/entityTypes/HCP/attributes/Boolean',
                    uri: 'entities/01L2n5z/attributes/Boolean/Ignored',
                    value: 'false',
                    ovDetails: {
                        participationStatus: ParticipationStatus.Ignored,
                        appliedSurvivorshipRules: 'N/A'
                    }
                },
                {
                    ov: true,
                    type: 'configuration/entityTypes/HCP/attributes/Boolean',
                    uri: 'entities/01L2n5z/attributes/Boolean/EndDatedCrosswalk',
                    value: 'true',
                    ovDetails: {
                        participationStatus: ParticipationStatus.EndDatedCrosswalk,
                        appliedSurvivorshipRules: 'N/A'
                    }
                },
                {
                    ov: true,
                    type: 'configuration/entityTypes/HCP/attributes/Boolean',
                    uri: 'entities/01L2n5z/attributes/Boolean/NotParticipating',
                    value: 'false',
                    ovDetails: {
                        participationStatus: ParticipationStatus.NotParticipating,
                        appliedSurvivorshipRules: 'N/A'
                    }
                }
            ] }) });
};
export var createMetadata = function () {
    return {
        entityTypes: [
            {
                uri: 'configuration/entityTypes/HCP',
                label: 'HCP',
                attributes: [
                    {
                        label: 'Boolean',
                        name: 'Boolean',
                        type: 'Boolean',
                        uri: 'configuration/entityTypes/HCP/attributes/Boolean'
                    },
                    {
                        label: 'String Label',
                        name: 'TextField',
                        type: 'String',
                        uri: 'configuration/entityTypes/HCP/attributes/TextField'
                    },
                    {
                        label: 'Affiliated with',
                        name: 'affiliatedwith',
                        type: 'String',
                        uri: 'configuration/entityTypes/HCP/attributes/affiliatedwith',
                        hidden: true
                    },
                    {
                        label: 'String Label 2',
                        name: 'TextField 2',
                        type: 'String',
                        uri: 'configuration/entityTypes/HCP/attributes/TextField2'
                    },
                    {
                        label: 'Hidden',
                        name: 'Hidden',
                        type: 'String',
                        uri: 'configuration/entityTypes/HCP/attributes/Hidden',
                        hidden: true
                    },
                    {
                        label: 'Nested',
                        name: 'Nested',
                        type: 'Nested',
                        uri: 'configuration/entityTypes/HCP/attributes/Nested'
                    },
                    {
                        label: 'Nested attribute',
                        name: 'DeepNested',
                        type: 'Nested',
                        uri: 'configuration/entityTypes/HCP/attributes/DeepNested'
                    },
                    {
                        label: 'Reference',
                        name: 'Reference',
                        type: 'Reference',
                        uri: 'configuration/entityTypes/HCP/attributes/Reference'
                    },
                    {
                        label: 'Image',
                        name: 'Image',
                        type: 'Image',
                        uri: 'configuration/entityTypes/HCP/attributes/Image'
                    }
                ],
                survivorshipGroups: [
                    {
                        uri: 'configuration/entityTypes/HCP/survivorshipGroups/default',
                        default: true,
                        mapping: [
                            {
                                attribute: 'configuration/entityTypes/HCP/attributes/TextField',
                                survivorshipStrategy: 'LUD'
                            },
                            {
                                attribute: 'configuration/entityTypes/HCP/attributes/Boolean',
                                survivorshipStrategy: 'Frequency'
                            },
                            {
                                attribute: 'configuration/entityTypes/HCP/attributes/DeepNested',
                                survivorshipStrategy: 'SRC_SYS'
                            },
                            {
                                attribute: 'configuration/entityTypes/HCP/attributes/ImageGallery',
                                primaryAttributeUri: 'configuration/entityTypes/HCP/attributes/OtherAttributeWinner',
                                survivorshipStrategy: 'OtherAttributeWinnerCrosswalk'
                            },
                            {
                                attribute: 'configuration/entityTypes/Location/attributes/Address',
                                comparisonAttributeUri: 'configuration/relationTypes/HasAddress/attributes/Status',
                                survivorshipStrategy: 'MinValue'
                            }
                        ]
                    }
                ]
            },
            {
                uri: 'configuration/entityTypes/Location',
                label: 'Location',
                attributes: [
                    {
                        label: 'Address Line 1',
                        name: 'AddressLine1',
                        type: 'String',
                        uri: 'configuration/entityTypes/Location/attributes/AddressLine1'
                    }
                ],
                survivorshipGroups: [
                    {
                        uri: 'configuration/entityTypes/Location/survivorshipGroups/default',
                        default: true,
                        mapping: [
                            {
                                attribute: 'configuration/entityTypes/Location/attributes/AddressLine1',
                                survivorshipStrategy: 'Frequency'
                            }
                        ]
                    }
                ]
            }
        ],
        relationTypes: [
            {
                uri: 'configuration/relationTypes/HasAddress',
                label: 'Has Address',
                attributes: [
                    {
                        label: 'Address Line 1',
                        name: 'AddressLine1',
                        type: 'String',
                        uri: 'configuration/relationTypes/HasAddress/attributes/AddressLine1'
                    }
                ]
            }
        ],
        survivorshipStrategies: [
            {
                uri: 'configuration/survivorshipStrategies/LUD',
                label: 'Recency'
            },
            {
                uri: 'configuration/survivorshipStrategies/Frequency',
                label: 'Frequency'
            },
            {
                uri: 'configuration/survivorshipStrategies/SRC_SYS',
                label: 'Source system'
            },
            {
                uri: 'configuration/survivorshipStrategies/OtherAttributeWinnerCrosswalk',
                label: 'Other Attribute Winner Crosswalk'
            },
            {
                uri: 'configuration/survivorshipStrategies/MinValue',
                label: 'Minimum value'
            }
        ],
        sources: [
            {
                uri: 'configuration/sources/Reltio',
                label: 'Reltio'
            }
        ]
    };
};
export var selectedAttributeTypes = [
    {
        description: 'String Attribute',
        label: 'String Label',
        name: 'TextField',
        type: 'String',
        uri: 'configuration/entityTypes/HCP/attributes/TextField'
    },
    {
        description: 'Yes or No',
        label: 'Boolean',
        name: 'Boolean',
        type: 'Boolean',
        uri: 'configuration/entityTypes/HCP/attributes/Boolean'
    },
    {
        label: 'Nested attribute',
        name: 'DeepNested',
        type: 'Nested',
        uri: 'configuration/entityTypes/HCP/attributes/DeepNested',
        attributes: [
            {
                label: 'Int_HCP',
                name: 'FirstLevelNestedSub1',
                type: 'Int',
                uri: 'configuration/entityTypes/HCP/attributes/DeepNested/attributes/FirstLevelNestedSub1'
            }
        ]
    },
    {
        label: 'Address',
        name: 'Address',
        access: ['READ'],
        type: 'Reference',
        referencedAttributeURIs: ['configuration/entityTypes/Location/attributes/AddressLine1'],
        uri: 'configuration/entityTypes/Location/attributes/Address'
    },
    {
        label: 'Image Gallery',
        name: 'ImageGallery',
        type: 'Image',
        uri: 'configuration/entityTypes/HCP/attributes/ImageGallery',
        attributes: [
            {
                label: 'Small image url (S3)',
                name: 'UrlThumbnail',
                type: 'String',
                uri: 'configuration/entityTypes/HCP/attributes/ImageGallery/attributes/UrlThumbnail'
            }
        ]
    }
];
var withFlags = function (flags) { return (__assign(__assign({}, ((flags === null || flags === void 0 ? void 0 : flags.pin) ? { pin: true } : {})), ((flags === null || flags === void 0 ? void 0 : flags.ignored) ? { ignored: true } : {}))); };
var createBaseEntityWithAttributes = function (attributes) {
    var base = createEntity();
    return __assign(__assign({}, base), { attributes: __assign(__assign({}, base.attributes), attributes) });
};
var textFieldValue = function (suffix, value, flags) { return (__assign({ ov: true, type: 'configuration/entityTypes/HCP/attributes/TextField', uri: "entities/01L2n5z/attributes/TextField/".concat(suffix), value: value }, withFlags(flags))); };
export var createEntityWithTextFieldSortOrder = function () {
    return createBaseEntityWithAttributes({
        TextField: [
            textFieldValue('sort-middle', 'value-middle'),
            textFieldValue('sort-ignored', 'value-ignored', { ignored: true }),
            textFieldValue('sort-pinned', 'value-pinned', { pin: true })
        ]
    });
};
var deepNestedChild = function (parentSuffix, childSuffix, value, flags) { return (__assign({ type: 'configuration/entityTypes/HCP/attributes/DeepNested/attributes/FirstLevelNestedSub1', ov: true, value: value, uri: "entities/01L2n5z/attributes/DeepNested/".concat(parentSuffix, "/FirstLevelNestedSub1/").concat(childSuffix) }, withFlags(flags))); };
var deepNestedParent = function (label, parentSuffix, children, flags) { return (__assign({ label: label, value: {
        FirstLevelNestedSub1: children
    }, ov: true, uri: "entities/01L2n5z/attributes/DeepNested/".concat(parentSuffix) }, withFlags(flags))); };
export var deepNestedDisplayOrderEntities = {
    multipleTopLevelWithSortedChildrenInsidePinned: function () {
        return createBaseEntityWithAttributes({
            DeepNested: [
                deepNestedParent('nested-middle', 'nested-middle', [deepNestedChild('nested-middle', 'v1', '1')]),
                deepNestedParent('nested-ignored', 'nested-ignored', [deepNestedChild('nested-ignored', 'v2', '2')], {
                    ignored: true
                }),
                deepNestedParent('nested-pinned', 'nested-pinned', [
                    deepNestedChild('nested-pinned', 'sort-middle', 'simple-value-middle'),
                    deepNestedChild('nested-pinned', 'sort-ignored', 'simple-value-ignored', { ignored: true }),
                    deepNestedChild('nested-pinned', 'sort-pinned', 'simple-value-pinned', { pin: true })
                ], { pin: true })
            ]
        });
    }
};
var referenceAddress = function (label, parentSuffix, addressLineValues, flags) {
    var parentUri = "entities/2Vek4DnE/attributes/Address/".concat(parentSuffix);
    return __assign({ label: label, refEntity: {
            objectURI: "entities/ref-".concat(parentSuffix),
            type: 'configuration/entityTypes/Location',
            crosswalks: []
        }, refRelation: {
            objectURI: "relations/ref-".concat(parentSuffix),
            type: 'configuration/relationTypes/HasAddress',
            crosswalks: []
        }, uri: parentUri, value: {
            AddressLine1: addressLineValues.map(function (_a) {
                var suffix = _a.suffix, value = _a.value, flags = _a.flags;
                return (__assign({ ov: true, type: 'configuration/entityTypes/Location/attributes/AddressLine1', uri: "".concat(parentUri, "/AddressLine1/").concat(suffix), value: value }, withFlags(flags)));
            })
        }, startObjectCrosswalks: [], ov: true }, withFlags(flags));
};
export var referenceDisplayOrderEntities = {
    multipleTopLevelWithSortedAddressLinesInsidePinned: function () {
        return createBaseEntityWithAttributes({
            Address: [
                referenceAddress('ref-middle', 'ref-middle', [{ suffix: 'v1', value: 'a' }]),
                referenceAddress('ref-ignored', 'ref-ignored', [{ suffix: 'v2', value: 'b' }], { ignored: true }),
                referenceAddress('ref-pinned', 'ref-pinned', [
                    { suffix: 'sort-middle', value: 'simple-value-middle' },
                    { suffix: 'sort-ignored', value: 'simple-value-ignored', flags: { ignored: true } },
                    { suffix: 'sort-pinned', value: 'simple-value-pinned', flags: { pin: true } }
                ], { pin: true })
            ]
        });
    }
};
