/// <reference path="//Microsoft.WinJS.1.0/js/ui.js" />  
/// <reference path="//Microsoft.WinJS.1.0/js/base.js" />  
(function () { 
    "use strict"; 
    WinJS.Namespace.define("Model", {
        CustomerList:new WinJS.Binding.List(null, {bindable:true}),
        Customer: WinJS.Class.define(function (firstName, lastName, age, id) {
            this._initObservable();
            var self = this;
            self.firstName = firstName;
            self.lastName = lastName;
            self.age = age;
            self.id = id;
        }, {
            id: {
                set: function (value) {
                    this.setProperty("id", value);
                },
                get: function () {
                    return this.getProperty("id");
                }
            },
            firstName: {
                set: function (value) {
                    this.setProperty("firstName", value);
                },
                get: function () {
                    return this.getProperty("firstName");
                }
            },
            lastName: {
                set: function (value) {
                    this.setProperty("lastName", value);
                },
                get: function () {
                    return this.getProperty("lastName");
                }
            },
            age: {
                set: function (value) {
                    this.setProperty("age", value);
                },
                get: function () {
                    return this.getProperty("age");
                }
            }, 
        }, {
            returnSimpleCustomerInfo: function (data) {
                var simpleCustomer = new Object();
                simpleCustomer.id = data.id;
                simpleCustomer.firstName = data.firstName;
                simpleCustomer.lastName = data.lastName;
                simpleCustomer.age = data.age;
                return simpleCustomer;
            },
        }),
        addCustomer: function(firstName, lastName, age, id) {
            Model.CustomerList.push(new Model.Customer(firstName, lastName, age, id));
        },
    });
    WinJS.Class.mix(
        Model.Customer,
        WinJS.Binding.mixin,
        WinJS.Binding.expandProperties(Model.Customer));
})(); 