import { XDataDefinition } from "../../../Common/Data/XDataDefinition";
import { ObjectDataDefinition } from "../../../Common/Data/Definitions/ObjectDataDefinition";
import { StringDataDefinition } from "../../../Common/Data/Definitions/StringDataDefinition";
import { BooleanDataDefinition } from "../../../Common/Data/Definitions/BooleanDataDefinition";
import { NumberDataDefinition } from "../../../Common/Data/Definitions/NumberDataDefinition";
import { DateDataDefinition } from "../../../Common/Data/Definitions/DateDataDefinition";
import { FileDataDefinition } from "../../../Common/Data/Definitions/FileDataDefinition";
export function getEmptyDataDefinition() {
    return new XDataDefinition();
}
export function getFilledDataDefinition() {
    let def = new XDataDefinition();
    let fdef;
    fdef = new StringDataDefinition();
    fdef.name = "stringfield";
    def.fields.push(fdef);
    fdef = new BooleanDataDefinition();
    fdef.name = "boolfield";
    def.fields.push(fdef);
    let odef = new ObjectDataDefinition();
    odef.name = "person";
    fdef = new StringDataDefinition();
    fdef.name = "firstName";
    odef.fields.push(fdef);
    fdef = new StringDataDefinition();
    fdef.name = "lastName";
    odef.fields.push(fdef);
    let childdef = new ObjectDataDefinition();
    childdef.name = "children";
    childdef.list = true;
    fdef = new StringDataDefinition();
    fdef.name = "name";
    childdef.fields.push(fdef);
    odef.fields.push(childdef);
    def.fields.push(odef);
    return def;
}
// 5 x 5 string data definition
export function get5x5StringDataDefinition(list, validValues) {
    let def = new XDataDefinition();
    for (let i = 0; i < 5; i++) {
        for (let j = 0; j < 5; j++) {
            let fdef = new 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;
}
export function get5x5NumberDataDefinition(list) {
    let def = new XDataDefinition();
    for (let i = 0; i < 5; i++) {
        for (let j = 0; j < 5; j++) {
            let fdef = new NumberDataDefinition(`number_${i}_${j}`);
            if (list) {
                fdef.list = list;
            }
            def.fields.push(fdef);
        }
    }
    return def;
}
export function get5x5BooleanDataDefinition(list) {
    let def = new XDataDefinition();
    for (let i = 0; i < 5; i++) {
        for (let j = 0; j < 5; j++) {
            let fdef = new BooleanDataDefinition(`boolean_${i}_${j}`);
            if (list) {
                fdef.list = list;
            }
            def.fields.push(fdef);
        }
    }
    return def;
}
export function get5x5DateDataDefinition(list) {
    let def = new XDataDefinition();
    for (let i = 0; i < 5; i++) {
        for (let j = 0; j < 5; j++) {
            let fdef = new DateDataDefinition(`date_${i}_${j}`);
            if (list) {
                fdef.list = list;
            }
            def.fields.push(fdef);
        }
    }
    return def;
}
export function get5x5ObjectDefinition(list) {
    let def = new XDataDefinition();
    for (let i = 0; i < 5; i++) {
        for (let j = 0; j < 5; j++) {
            let odef = new ObjectDataDefinition(`object_${i}_${j}`);
            if (list) {
                odef.list = list;
            }
            let str1 = new StringDataDefinition("firstName");
            let str2 = new StringDataDefinition("lastName");
            odef.fields.push(str1);
            odef.fields.push(str2);
            def.fields.push(odef);
        }
    }
    return def;
}
export function get5x5FileDataDefinition(list) {
    let def = new XDataDefinition();
    for (let i = 0; i < 5; i++) {
        for (let j = 0; j < 5; j++) {
            let odef = new FileDataDefinition(`object_${i}_${j}`);
            if (list) {
                odef.list = list;
            }
            def.fields.push(odef);
        }
    }
    return def;
}
export function getOnePersonWithFriends() {
    let def = new XDataDefinition();
    let ddef = new ObjectDataDefinition("data");
    def.fields.push(ddef);
    // person
    let odef = new ObjectDataDefinition("person");
    odef.fields.push(new StringDataDefinition("firstName"));
    odef.fields.push(new StringDataDefinition("lastName"));
    let age = new NumberDataDefinition("age");
    age.allowDecimals = false;
    odef.fields.push(age);
    let gender = new StringDataDefinition("gender");
    gender.validValues = ["male", "female"];
    odef.fields.push(gender);
    ddef.fields.push(odef);
    let friends = new ObjectDataDefinition("friends");
    friends.list = true;
    friends.fields.push(new StringDataDefinition("firstName"));
    friends.fields.push(new StringDataDefinition("lastName"));
    age = new NumberDataDefinition("age");
    age.allowDecimals = false;
    friends.fields.push(age);
    let course = new StringDataDefinition("course");
    course.list = true;
    friends.fields.push(course);
    odef.fields.push(friends);
    return def;
}
export function getFamilyAddress() {
    let def = new XDataDefinition();
    let ddef = new ObjectDataDefinition("data");
    def.fields.push(ddef);
    // person
    let odef = new ObjectDataDefinition("person");
    odef.list = true;
    odef.fields.push(new StringDataDefinition("firstName"));
    odef.fields.push(new StringDataDefinition("lastName"));
    odef.fields.push(new NumberDataDefinition("age"));
    let gender = new StringDataDefinition("gender");
    gender.validValues = ["male", "female"];
    odef.fields.push(gender);
    ddef.fields.push(odef);
    let adef = new ObjectDataDefinition("address");
    adef.fields.push(new StringDataDefinition("country"));
    adef.fields.push(new StringDataDefinition("address1"));
    adef.fields.push(new StringDataDefinition("address2"));
    adef.fields.push(new StringDataDefinition("city"));
    adef.fields.push(new StringDataDefinition("state"));
    adef.fields.push(new StringDataDefinition("postalCode"));
    let peoplelivingthere = new ObjectDataDefinition("peoplelivingthere");
    peoplelivingthere.list = true;
    let relationship = new StringDataDefinition("relationship");
    peoplelivingthere.fields.push(relationship);
    peoplelivingthere.fields.push(new StringDataDefinition("firstName"));
    peoplelivingthere.fields.push(new StringDataDefinition("lastName"));
    peoplelivingthere.fields.push(new NumberDataDefinition("age"));
    peoplelivingthere.fields.push(gender);
    adef.fields.push(peoplelivingthere);
    odef.fields.push(adef);
    return def;
}
export const 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