//  @import com.hedgehoglab.application.service.BaseService;
//  @import com.hedgehoglab.solomon.service.exceptions.NoContactsFoundException;

function NotesService(scope){
    BaseService.call(this,scope);
    var _this=this;
    
    this.get_notes_for_contact=function(contact_id,callback){
        _this.request({
            uri:"/api/contacts/"+contact_id+"/notes"
            ,type:"GET"
            ,callback:function(data){
                
                callback(data);
            }
        });
       
        
    };

    this.create_note=function(data,callback){
    	_this.request({
            uri:"/api/notes",
            data:data,
            type:"POST",
            callback:callback
        });
    };

    this.delete_note=function(note_id,callback){
      //    Delete the note and callback
        _this.request({
            uri:"/api/notes/"+note_id
            ,data:{}
            ,type:"DELETE"
            ,callback:callback
        });
    };

    this.save_note=function(note,callback){
      //    Delete the note and callback
        _this.request({
            uri:"/api/notes/"+note.id
            ,data:note
            ,type:"PUT"
            ,callback:callback
        });
    };
    
    this.create_note_for_contact=function(contact_id,note_body,callback){
        _this.request({
            uri:"/api/notes"
            ,data:{
                contact:contact_id
                ,body:note_body
            }
            ,type:"POST"
            ,callback:callback
        });
    };

//    this.get_contacts=function(callback){
//
//        //$.ajaxSetup({async:false});
//        $.getJSON("/api/contacts",{},function(data){
//            callback(data);
//        });
//
//    }
//
//    this.get_contact_counts=function(search_term,callback){
//        $.getJSON("/api/backend/search-results-tag-panel",{"q":search_term},function(data){
//            callback(data);
//        });
//
//    }
};