var NotesSvc = function() {
    var notes = [
        {
            id: 1,
            titre: "Note 1",
            description: "Description de la note 1"
        },
        {
            id: 2,
            titre: "Note 2",
            description: "Description de la note 2"
        },
        {
            id: 3,
            titre: "Note 3",
            description: "Description de la note 3"
        },
        {
            id: 4,
            titre: "Note 4",
            description: "Description de la note 4"
        },
        {
            id: 5,
            titre: "Note 5",
            description: "Description de la note 5"
        }
    ];

    var service = {
        getNotes: function () {
            return notes;
        },
        getNote: function (id) {
            for (var i = 0; i < notes.length; i++) {
                if (notes[i].id === parseInt(id)) {
                    return notes[i];
                }
            }
            return undefined;
        },
        deleteNote: function (id) {
            var index = -1;
            for (var i = 0; i < notes.length; i++) {
                if (notes[i].id === id) {
                    index = i;
                    break;
                }
            }

            if (index !== -1) {
                notes.splice(i, 1);
            }
        }
    };

    return service;
};