"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.familyAddressDumpData = exports.getFamilyAddress = exports.getOnePersonWithFriends = exports.get5x5FileDataDefinition = exports.get5x5ObjectDefinition = exports.get5x5DateDataDefinition = exports.get5x5BooleanDataDefinition = exports.get5x5NumberDataDefinition = exports.get5x5StringDataDefinition = exports.getFilledDataDefinition = exports.getEmptyDataDefinition = void 0;
const DataDefinition_1 = require("@appglue/common/dist/Common/Data/DataDefinition");
const ObjectDataDefinition_1 = require("@appglue/common/dist/Common/Data/Definitions/ObjectDataDefinition");
const StringDataDefinition_1 = require("@appglue/common/dist/Common/Data/Definitions/StringDataDefinition");
const BooleanDataDefinition_1 = require("@appglue/common/dist/Common/Data/Definitions/BooleanDataDefinition");
const NumberDataDefinition_1 = require("@appglue/common/dist/Common/Data/Definitions/NumberDataDefinition");
const DateDataDefinition_1 = require("@appglue/common/dist/Common/Data/Definitions/DateDataDefinition");
const FileDataDefinition_1 = require("@appglue/common/dist/Common/Data/Definitions/FileDataDefinition");
function getEmptyDataDefinition() {
    return new DataDefinition_1.DataDefinition();
}
exports.getEmptyDataDefinition = getEmptyDataDefinition;
function getFilledDataDefinition() {
    let def = new DataDefinition_1.DataDefinition();
    let fdef;
    fdef = new StringDataDefinition_1.StringDataDefinition();
    fdef.name = "stringfield";
    def.fields.push(fdef);
    fdef = new BooleanDataDefinition_1.BooleanDataDefinition();
    fdef.name = "boolfield";
    def.fields.push(fdef);
    let odef = new ObjectDataDefinition_1.ObjectDataDefinition();
    odef.name = "person";
    fdef = new StringDataDefinition_1.StringDataDefinition();
    fdef.name = "firstName";
    odef.fields.push(fdef);
    fdef = new StringDataDefinition_1.StringDataDefinition();
    fdef.name = "lastName";
    odef.fields.push(fdef);
    let childdef = new ObjectDataDefinition_1.ObjectDataDefinition();
    childdef.name = "children";
    childdef.list = true;
    fdef = new StringDataDefinition_1.StringDataDefinition();
    fdef.name = "name";
    childdef.fields.push(fdef);
    odef.fields.push(childdef);
    def.fields.push(odef);
    return def;
}
exports.getFilledDataDefinition = getFilledDataDefinition;
// 5 x 5 string data definition
function get5x5StringDataDefinition(list, validValues) {
    let def = new DataDefinition_1.DataDefinition();
    for (let i = 0; i < 5; i++) {
        for (let j = 0; j < 5; j++) {
            let fdef = new StringDataDefinition_1.StringDataDefinition(`string_${i}_${j}`);
            if (list) {
                fdef.list = list;
            }
            if (validValues) {
                fdef.validValues = validValues;
            }
            if (((i + 1) * (j + 1)) % 2 === 0) {
                for (let k = 0; k < (i + 1) * (j + 1); k++) {
                    fdef.validValues.push(`${k + 1}`);
                }
            }
            def.fields.push(fdef);
        }
    }
    return def;
}
exports.get5x5StringDataDefinition = get5x5StringDataDefinition;
function get5x5NumberDataDefinition(list) {
    let def = new DataDefinition_1.DataDefinition();
    for (let i = 0; i < 5; i++) {
        for (let j = 0; j < 5; j++) {
            let fdef = new NumberDataDefinition_1.NumberDataDefinition(`number_${i}_${j}`);
            if (list) {
                fdef.list = list;
            }
            def.fields.push(fdef);
        }
    }
    return def;
}
exports.get5x5NumberDataDefinition = get5x5NumberDataDefinition;
function get5x5BooleanDataDefinition(list) {
    let def = new DataDefinition_1.DataDefinition();
    for (let i = 0; i < 5; i++) {
        for (let j = 0; j < 5; j++) {
            let fdef = new BooleanDataDefinition_1.BooleanDataDefinition(`boolean_${i}_${j}`);
            if (list) {
                fdef.list = list;
            }
            def.fields.push(fdef);
        }
    }
    return def;
}
exports.get5x5BooleanDataDefinition = get5x5BooleanDataDefinition;
function get5x5DateDataDefinition(list) {
    let def = new DataDefinition_1.DataDefinition();
    for (let i = 0; i < 5; i++) {
        for (let j = 0; j < 5; j++) {
            let fdef = new DateDataDefinition_1.DateDataDefinition(`date_${i}_${j}`);
            if (list) {
                fdef.list = list;
            }
            def.fields.push(fdef);
        }
    }
    return def;
}
exports.get5x5DateDataDefinition = get5x5DateDataDefinition;
function get5x5ObjectDefinition(list) {
    let def = new DataDefinition_1.DataDefinition();
    for (let i = 0; i < 5; i++) {
        for (let j = 0; j < 5; j++) {
            let odef = new ObjectDataDefinition_1.ObjectDataDefinition(`object_${i}_${j}`);
            if (list) {
                odef.list = list;
            }
            let str1 = new StringDataDefinition_1.StringDataDefinition("firstName");
            let str2 = new StringDataDefinition_1.StringDataDefinition("lastName");
            odef.fields.push(str1);
            odef.fields.push(str2);
            def.fields.push(odef);
        }
    }
    return def;
}
exports.get5x5ObjectDefinition = get5x5ObjectDefinition;
function get5x5FileDataDefinition(list) {
    let def = new DataDefinition_1.DataDefinition();
    for (let i = 0; i < 5; i++) {
        for (let j = 0; j < 5; j++) {
            let odef = new FileDataDefinition_1.FileDataDefinition(`object_${i}_${j}`);
            if (list) {
                odef.list = list;
            }
            def.fields.push(odef);
        }
    }
    return def;
}
exports.get5x5FileDataDefinition = get5x5FileDataDefinition;
function getOnePersonWithFriends() {
    let def = new DataDefinition_1.DataDefinition();
    let ddef = new ObjectDataDefinition_1.ObjectDataDefinition("data");
    def.fields.push(ddef);
    // person
    let odef = new ObjectDataDefinition_1.ObjectDataDefinition("person");
    odef.fields.push(new StringDataDefinition_1.StringDataDefinition("firstName"));
    odef.fields.push(new StringDataDefinition_1.StringDataDefinition("lastName"));
    let age = new NumberDataDefinition_1.NumberDataDefinition("age");
    age.allowDecimals = false;
    odef.fields.push(age);
    let gender = new StringDataDefinition_1.StringDataDefinition("gender");
    gender.validValues = ["male", "female"];
    odef.fields.push(gender);
    ddef.fields.push(odef);
    let friends = new ObjectDataDefinition_1.ObjectDataDefinition("friends");
    friends.list = true;
    friends.fields.push(new StringDataDefinition_1.StringDataDefinition("firstName"));
    friends.fields.push(new StringDataDefinition_1.StringDataDefinition("lastName"));
    age = new NumberDataDefinition_1.NumberDataDefinition("age");
    age.allowDecimals = false;
    friends.fields.push(age);
    let course = new StringDataDefinition_1.StringDataDefinition("course");
    course.list = true;
    friends.fields.push(course);
    odef.fields.push(friends);
    return def;
}
exports.getOnePersonWithFriends = getOnePersonWithFriends;
function getFamilyAddress() {
    let def = new DataDefinition_1.DataDefinition();
    let ddef = new ObjectDataDefinition_1.ObjectDataDefinition("data");
    def.fields.push(ddef);
    // person
    let odef = new ObjectDataDefinition_1.ObjectDataDefinition("person");
    odef.list = true;
    odef.fields.push(new StringDataDefinition_1.StringDataDefinition("firstName"));
    odef.fields.push(new StringDataDefinition_1.StringDataDefinition("lastName"));
    odef.fields.push(new NumberDataDefinition_1.NumberDataDefinition("age"));
    let gender = new StringDataDefinition_1.StringDataDefinition("gender");
    gender.validValues = ["male", "female"];
    odef.fields.push(gender);
    ddef.fields.push(odef);
    let adef = new ObjectDataDefinition_1.ObjectDataDefinition("address");
    adef.fields.push(new StringDataDefinition_1.StringDataDefinition("country"));
    adef.fields.push(new StringDataDefinition_1.StringDataDefinition("address1"));
    adef.fields.push(new StringDataDefinition_1.StringDataDefinition("address2"));
    adef.fields.push(new StringDataDefinition_1.StringDataDefinition("city"));
    adef.fields.push(new StringDataDefinition_1.StringDataDefinition("state"));
    adef.fields.push(new StringDataDefinition_1.StringDataDefinition("postalCode"));
    let peoplelivingthere = new ObjectDataDefinition_1.ObjectDataDefinition("peoplelivingthere");
    peoplelivingthere.list = true;
    let relationship = new StringDataDefinition_1.StringDataDefinition("relationship");
    peoplelivingthere.fields.push(relationship);
    peoplelivingthere.fields.push(new StringDataDefinition_1.StringDataDefinition("firstName"));
    peoplelivingthere.fields.push(new StringDataDefinition_1.StringDataDefinition("lastName"));
    peoplelivingthere.fields.push(new NumberDataDefinition_1.NumberDataDefinition("age"));
    peoplelivingthere.fields.push(gender);
    adef.fields.push(peoplelivingthere);
    odef.fields.push(adef);
    return def;
}
exports.getFamilyAddress = getFamilyAddress;
exports.familyAddressDumpData = {
    data: {
        person: [
            {
                firstName: "firstName",
                lastName: "lastName",
                age: 45,
                gender: "male",
                address: {
                    country: "USA",
                    address1: "address1",
                    address2: "address2",
                    city: "city",
                    postalCode: "90001",
                    peoplelivingthere: [
                        {
                            relationship: "son",
                            firstName: "son",
                            lastName: "lastName",
                            gender: "male",
                        },
                    ],
                },
            },
        ],
    },
};
//# sourceMappingURL=TestData.js.map