"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ObjectEditorStories = void 0;
const jsx_runtime_1 = require("react/jsx-runtime");
const TestData_1 = require("../Testing/TestData");
const CommonStoryTemplates_1 = require("../CommonStoryTemplates");
const DataDefinition_1 = require("@appglue/common/dist/Common/Data/DataDefinition");
const DataUtilities_1 = require("@appglue/common/dist/Common/DataUtilities");
const ObjectDataDefinition_1 = require("@appglue/common/dist/Common/Data/Definitions/ObjectDataDefinition");
const StringDataDefinition_1 = require("@appglue/common/dist/Common/Data/Definitions/StringDataDefinition");
const NumberDataDefinition_1 = require("@appglue/common/dist/Common/Data/Definitions/NumberDataDefinition");
const StoryData_1 = require("../../StoryBook/StoryData");
let griddef = (0, TestData_1.get5x5ObjectDefinition)();
let def = new DataDefinition_1.DataDefinition();
let odef = new ObjectDataDefinition_1.ObjectDataDefinition("object");
let fdef = new StringDataDefinition_1.StringDataDefinition("firstName");
let ldef = new StringDataDefinition_1.StringDataDefinition("lastName");
odef.fields.push(fdef);
odef.fields.push(ldef);
def.fields.push(odef);
DataUtilities_1.DataUtilities.set(def.getValueObject(), odef.name, {
    firstName: "firstName",
    lastName: "lastName",
});
let typeName = "Object";
exports.ObjectEditorStories = [
    new StoryData_1.StoryNode(() => {
        return (0, jsx_runtime_1.jsx)(CommonStoryTemplates_1.GridTestTemplate, { definition: griddef });
    }, "Data Designer", "Data Editing", typeName, "Grid"),
    new StoryData_1.StoryNode(() => {
        return (0, jsx_runtime_1.jsx)(CommonStoryTemplates_1.DisplayModeTemplate, { definition: def });
    }, "Data Designer", "Data Editing", typeName, "Display Mode"),
    new StoryData_1.StoryNode(() => {
        return (0, jsx_runtime_1.jsx)(CommonStoryTemplates_1.EditModeTemplate, { definition: def });
    }, "Data Designer", "Data Editing", typeName, "Edit Mode"),
    new StoryData_1.StoryNode(() => {
        return (0, jsx_runtime_1.jsx)(CommonStoryTemplates_1.DisplayEditModeTemplate, { definition: def });
    }, "Data Designer", "Data Editing", typeName, "Display Edit Mode"),
    new StoryData_1.StoryNode(() => {
        return (0, jsx_runtime_1.jsx)(CommonStoryTemplates_1.DisplayLayerEditModeTemplate, { definition: def });
    }, "Data Designer", "Data Editing", typeName, "Display Layer Edit Mode"),
    new StoryData_1.StoryNode(() => {
        let def = new DataDefinition_1.DataDefinition();
        odef = new ObjectDataDefinition_1.ObjectDataDefinition("object");
        ldef = new StringDataDefinition_1.StringDataDefinition("lastName");
        let cdef = new StringDataDefinition_1.StringDataDefinition("Children");
        cdef.list = true;
        odef.fields.push(ldef);
        odef.fields.push(cdef);
        def.fields.push(odef);
        return (0, jsx_runtime_1.jsx)(CommonStoryTemplates_1.DisplayModeTemplate, { definition: def });
    }, "Data Designer", "Data Editing", typeName, "Has Child List Display Mode"),
    new StoryData_1.StoryNode(() => {
        let def = new DataDefinition_1.DataDefinition();
        odef = new ObjectDataDefinition_1.ObjectDataDefinition("object");
        ldef = new StringDataDefinition_1.StringDataDefinition("lastName");
        let cdef = new StringDataDefinition_1.StringDataDefinition("Children");
        cdef.list = true;
        odef.fields.push(ldef);
        odef.fields.push(cdef);
        def.fields.push(odef);
        return (0, jsx_runtime_1.jsx)(CommonStoryTemplates_1.EditModeTemplate, { definition: def });
    }, "Data Designer", "Data Editing", typeName, "Has Child List Edit Mode"),
    new StoryData_1.StoryNode(() => {
        let def = new DataDefinition_1.DataDefinition();
        let ddef = new ObjectDataDefinition_1.ObjectDataDefinition("data");
        // person
        odef = new ObjectDataDefinition_1.ObjectDataDefinition("person");
        ldef = new StringDataDefinition_1.StringDataDefinition("lastName");
        odef.fields.push(ldef);
        ddef.fields.push(odef);
        // children
        let chdef = new ObjectDataDefinition_1.ObjectDataDefinition("children");
        chdef.list = true;
        chdef.fields.push(new StringDataDefinition_1.StringDataDefinition("firstName"));
        chdef.fields.push(new NumberDataDefinition_1.NumberDataDefinition("age"));
        // friends
        let friends = new ObjectDataDefinition_1.ObjectDataDefinition("friends");
        friends.fields.push(new StringDataDefinition_1.StringDataDefinition("firstName"));
        friends.fields.push(new StringDataDefinition_1.StringDataDefinition("lastName"));
        // friends scores
        let scores = new ObjectDataDefinition_1.ObjectDataDefinition("scores");
        let math = new NumberDataDefinition_1.NumberDataDefinition("math");
        let english = new NumberDataDefinition_1.NumberDataDefinition("english");
        scores.fields.push(math);
        scores.fields.push(english);
        friends.fields.push(scores);
        friends.list = true;
        chdef.fields.push(friends);
        ddef.fields.push(chdef);
        // address
        let adef = new ObjectDataDefinition_1.ObjectDataDefinition("address");
        let city = new StringDataDefinition_1.StringDataDefinition("city");
        let street = new StringDataDefinition_1.StringDataDefinition("street");
        adef.fields.push(city);
        adef.fields.push(street);
        let postalCode = new StringDataDefinition_1.StringDataDefinition("postalCode");
        adef.fields.push(postalCode);
        ddef.fields.push(adef);
        def.fields.push(ddef);
        return (0, jsx_runtime_1.jsx)(CommonStoryTemplates_1.EditModeTemplate, { definition: def });
    }, "Data Designer", "Data Editing", typeName, "Has Child Object Edit Mode"),
    new StoryData_1.StoryNode(() => {
        return (0, jsx_runtime_1.jsx)(CommonStoryTemplates_1.DisplayLayerEditModeTemplate, { definition: (0, TestData_1.getOnePersonWithFriends)() });
    }, "Data Designer", "Data Editing", typeName, "One Person With Friends"),
    new StoryData_1.StoryNode(() => {
        return (0, jsx_runtime_1.jsx)(CommonStoryTemplates_1.DisplayLayerEditModeTemplate, { definition: (0, TestData_1.getFamilyAddress)() });
    }, "Data Designer", "Data Editing", typeName, "Family Address"),
];
//# sourceMappingURL=ObjectDataDefinition-stories.js.map