define([
    'Global',
    'Specialty'
],
    function(Global, Specialty) {
        var Specialties = Backbone.Collection.extend({
            model: Specialty,
            parse: function(response) {
                return response.specialty;
            },
            initialize: function() {
            },
            findByName: function(name) {
                return this.find(function (model) {
                    return model.get('name') === name;
                });
            }
        });

        Specialties.singleInstance = null;

        Specialties.instance = function () {
            Specialties.singleInstance = Specialties.singleInstance || new Specialties();
            return Specialties.singleInstance;
        };

        Specialties.clearInstance = function () {
            Specialties.singleInstance = null;
        };

        return Specialties;
    }
);
