'use strict';

var angular = require('angular');
var services = require('../scripts/modules').services;

angular.module(services.name).factory('OutpatientVisit', function ($resource) {
  return $resource('/resources/outpatient-visit/:_id',
    {
      _id: '@_id'
    },
    {
      update: {
        method: 'PUT'
      }
    });
});

angular.module(services.name).factory('District', function ($resource) {
  return $resource('/resources/district/:_id',
    {
      _id: '@_id'
    },
    {
      update: {
        method: 'PUT',
        headers: { 'Accept': 'application/json' }
      },
      save: {
        method: 'POST',
        headers: { 'Accept': 'application/json' }
      }
    });
});


angular.module(services.name).factory('Diagnosis', function ($resource) {
  return $resource('/resources/diagnosis/:_id',
    {
      _id: '@_id'
    },
    {
      update: {
        method: 'PUT',
        headers: { 'Accept': 'application/json' }
      },
      save: {
        method: 'POST',
        headers: { 'Accept': 'application/json' }
      }
    });
});


angular.module(services.name).factory('Symptom', function ($resource) {
  return $resource('/resources/symptom/:_id',
    {
      _id: '@_id'
    },
    {
      update: {
        method: 'PUT',
        headers: { 'Accept': 'application/json' }
      },
      save: {
        method: 'POST',
        headers: { 'Accept': 'application/json' }
      }
    });
});

angular.module(services.name).factory('District', function ($resource) {
  return $resource('/resources/district/:_id',
    {
      _id: '@_id'
    },
    {
      update: {
        method: 'PUT',
        headers: { 'Accept': 'application/json' }
      },
      save: {
        method: 'POST',
        headers: { 'Accept': 'application/json' }
      }
    });
});


angular.module(services.name).factory('Diagnosis', function ($resource) {
  return $resource('/resources/diagnosis/:_id',
    {
      _id: '@_id'
    },
    {
      update: {
        method: 'PUT',
        headers: { 'Accept': 'application/json' }
      },
      save: {
        method: 'POST',
        headers: { 'Accept': 'application/json' }
      }
    });
});


angular.module(services.name).factory('Symptom', function ($resource) {
  return $resource('/resources/symptom/:_id',
    {
      _id: '@_id'
    },
    {
      update: {
        method: 'PUT',
        headers: { 'Accept': 'application/json' }
      },
      save: {
        method: 'POST',
        headers: { 'Accept': 'application/json' }
      }
    });
});

@@ -308,16 +308,180 @@
 : 'PUT'%0A
+      %7D,%0A      search: %7B%0A        method: 'POST', // really should be GET with body, but you can't do that in HTTP%0A        url: '/resources/outpatient-visit/search'%0A
       %7D%0A

Add search method to OutpatientVisit resource