/*jslint node: true, nomen: true, unparam: true */
/*global jquery, $, _, define, Marionette, jqm, describe, it, expect, beforeEach, spyOn */

define(['Global'], function ( Global) {
	'use strict';
	return Backbone.Model.extend({
		defaults: {
			age: "",
			dateOfBirth: "",
			displayName: "",
			firstName: "",
			gender: "",
			inpatient: false,
			lastName: "",
			link: {},
			patientAssigningAuthority: "",
			patientId: "",
			ssn: "",
		},
		parse: function(response, options) {
			var patientItem = {},
				patient = (response["object-type"] === "SelectedPatient") ? response.patient : response,
				patientIdentifier = patient.patientIdentifier;

			$.extend(true, patientItem, patient, {
				patientAssigningAuthority: patientIdentifier.assigningAuthority,
				patientId: patientIdentifier.uniqueId
			});

			return patientItem;
		}
	});
});