/* global Bdf,Ficheform,$$ */

Ficheform.AddendaInclude = {};

Ficheform.AddendaInclude.NOCHANGE_STATE = "nochange";
Ficheform.AddendaInclude.UPDATE_STATE = "update";
Ficheform.AddendaInclude.REMOVE_STATE = "remove";
Ficheform.AddendaInclude.CREATE_STATE = "create";
Ficheform.AddendaInclude.DOCUMENT_CHANGETYPE = "document";
Ficheform.AddendaInclude.CREATION_CHANGETYPE = "creation";

Ficheform.AddendaInclude.init = function () {
    Bdf.FileInput.bindFileEvents($$({ficheformRole: "document-file"}).find("input"));
    $$({ficheformEntry: "addenda-include"}).each(function (index, element) {
        Ficheform.AddendaInclude.Manager.init(element);
    });
};

Ficheform.AddendaInclude.getNamingInstructionLoc = function (addendaName) {
    var namingKey = "naming:addenda_" + addendaName;
    if (Bdf.Loc.contains(namingKey)) {
        return Bdf.Loc.get(namingKey);
    } else {
        return "";
    }
};