(function() {
    'use strict';

    angular.module('semanthequeSidApp')
           .factory('CatalogingConceptSrvc', CatalogingConceptSrvc);

   function CatalogingConceptSrvc($resource, CatalogingUtils) {

        var thesaurus = {
            CONTENT_TYPE: "THESAURUS_CONTENT_TYPE",
            LANG: 'THESAURUS_THESAURUS-003',
            MOTIVE_OF_REFUSE: "THESAURUS_VALUE_LIST-005",
            ROLE_REGROUP: 'THESAURUS_VALUE_LIST-003',
            ROLE_TERM: 'THESAURUS_VALUE_LIST-001',
            SECTION: 'THESAURUS_VALUE_LIST-008',
            SUPPORT: "THESAURUS_SUPPORT",
            SUSPENSION: "THESAURUS_SUSPENSION",
            UNAVAILABILITY_STATUS: "THESAURUS_VALUE_LIST-004",
            WALLET_OBJECT_CREDIT: "THESAURUS_VALUE_LIST-007",
            WALLET_OBJECT_DEBIT: "THESAURUS_VALUE_LIST-006",
            WALLET_PAYMENT_TYPE: "THESAURUS_TYPE_PAYMENT"
        };

        var service = $resource('/api/rest/concept/:id', {
            id: '@identifier'
        }, {
            relationDTO: {
                method: 'GET',
                params: {
                    relationDTO: true
                }
            },
            dto: {
                method: 'GET',
                isArray: true,
                params: {
                    dto: true
                }
            },
            simpleDto: {
                method: 'GET',
                params: {
                    simpledto: true
                }
            },
            getDtoLang: {
                method: 'GET',
                isArray: true,
                params: {
                    dto: true,
                    thesaurusId: thesaurus.LANG
                }
            },
            getDtoRoleRegroup: {
                method: 'GET',
                isArray: true,
                params: {
                    dto: true,
                    thesaurusId: thesaurus.ROLE_REGROUP
                }
            },
            getDtoRoleTerm: {
                method: 'GET',
                isArray: true,
                params: {
                    dto: true,
                    thesaurusId: thesaurus.ROLE_TERM
                }
            },
            getDtoUnavailabilityStatus: {
                method: 'GET',
                isArray: true,
                params: {
                    dto: true,
                    thesaurusId: thesaurus.UNAVAILABILITY_STATUS
                }
            },
            getDtoMotivesOfRefuse: {
                method: 'GET',
                isArray: true,
                params: {
                    dto: true,
                    thesaurusId: thesaurus.MOTIVE_OF_REFUSE
                }
            },
            getDtoWalletObjectDebit: {
                method: 'GET',
                isArray: true,
                params: {
                    dto: true,
                    thesaurusId: thesaurus.WALLET_OBJECT_DEBIT
                }
            },
            getDtoWalletObjectCredit: {
                method: 'GET',
                isArray: true,
                params: {
                    dto: true,
                    thesaurusId: thesaurus.WALLET_OBJECT_CREDIT
                }
            },
            getDtoWalletTypePayment: {
                method: 'GET',
                isArray: true,
                params: {
                    dto: true,
                    thesaurusId: thesaurus.WALLET_PAYMENT_TYPE
                }
            },
            getDtoSuspension: {
                method: 'GET',
                isArray: true,
                params: {
                    dto: true,
                    thesaurusId: thesaurus.SUSPENSION
                }
            },
            getDtoContentType: {
                method: 'GET',
                isArray: true,
                params: {
                    dto: true,
                    thesaurusId: thesaurus.CONTENT_TYPE
                }
            },
            getDtoSupport: {
                method: 'GET',
                isArray: true,
                params: {
                    dto: true,
                    thesaurusId: thesaurus.SUPPORT
                }
            },
            getDtoSection: {
                method: 'GET',
                isArray: true,
                params: {
                    dto: true,
                    thesaurusId: thesaurus.SECTION
                }
            },
            findByTemplateExpression: {
                method: 'GET',
                isArray: true,
                params: {
                    getByTemplateExpression: true
                }
            },
            search: {
                method: 'GET',
                isArray: false,
                params: {
                    search: true
                }
            },
            getEs: {
                method: 'GET',
                isArray: false,
                params: {
                    es: true
                }
            },
            searchConceptsAsTree: {
                method: 'GET',
                isArray: true,
                params: {
                    treeDto: true,
                }
            },
            getConceptImageDto: {
                method: 'GET',
                isArray: false,
                params: {
                    'concept-image': true
                }
            },
            getConcepts : {
                method: 'GET',
                isArray : false,
                params : {
                    dto : true
                }
            },
            supHierarchies: {
                method: 'GET',
                isArray: true,

                params: {
                    supHierarchies: true
                }
            }
        });
        service.THESAURUS = thesaurus;
        service.getTemplateExpression = CatalogingUtils.getTemplateExpression;
        service.getTermToDisplay = CatalogingUtils.getTermToDisplay;
        service.getTermToDisplayWithLang = CatalogingUtils.getTermToDisplayWithLang;

        return service;
   }
})();
