\set ON_ERROR_STOP on

\c nubarchiva
SET SCHEMA 'nuba00001';

-- insert especificos DPH
DELETE FROM FIELD WHERE IDFORM IN (SELECT IDFORM FROM FORM WHERE TYPE != 'A');
DELETE FROM FORM WHERE TYPE != 'A';

INSERT INTO FORM (IDFORM, TITLE, DESCRIPTION, SORDER, TYPE) VALUES (1, 'Simplificado', 'Elemento de archivo', 1, 'D');
INSERT INTO FORM (IDFORM, TITLE, DESCRIPTION, SORDER, TYPE) VALUES (2, 'Completo', 'Formulario con todos los campos', 2, 'D');

INSERT INTO FIELD (IDFORM, LABEL, IDCLASSEDITOR, REQUIERED, EDITABLE, VISIBLE, DEFAULTVALUE, SORDER, INITEDITOR) VALUES (1, 'Comprobado', 82, false, true, false, null, 230, '{"cssClassEditor":null,"comprobadoSiTF":{"modelMarcRef":{"modelMarcfield":"091","modelMarcSubfield":"z"}},"comprobadoFechaTF":{"modelMarcRef":{"modelMarcfield":"091","modelMarcSubfield":"p"}}}');
INSERT INTO FIELD (IDFORM, LABEL, IDCLASSEDITOR, REQUIERED, EDITABLE, VISIBLE, DEFAULTVALUE, SORDER, INITEDITOR) VALUES (1, 'Área de Identificación', 999, false, true, true, null, 5, null);
INSERT INTO FIELD (IDFORM, LABEL, IDCLASSEDITOR, REQUIERED, EDITABLE, VISIBLE, DEFAULTVALUE, SORDER, INITEDITOR) VALUES (1, 'Nivel de Descripción', 1, true, true, true, '7', 8, null);
INSERT INTO FIELD (IDFORM, LABEL, IDCLASSEDITOR, REQUIERED, EDITABLE, VISIBLE, DEFAULTVALUE, SORDER, INITEDITOR) VALUES (1, 'Título', 9, true, true, true, null, 30, '{"components":[{"componentPath" : "", "properties": {"rows": "10", "cols": "69"}}]}');
INSERT INTO FIELD (IDFORM, LABEL, IDCLASSEDITOR, REQUIERED, EDITABLE, VISIBLE, DEFAULTVALUE, SORDER, INITEDITOR) VALUES (1, 'Fecha(s)', 12, false, true, true, null, 40, null);
INSERT INTO FIELD (IDFORM, LABEL, IDCLASSEDITOR, REQUIERED, EDITABLE, VISIBLE, DEFAULTVALUE, SORDER, INITEDITOR) VALUES (1, 'Notas', 999, false, true, true, null, 180, null);
INSERT INTO FIELD (IDFORM, LABEL, IDCLASSEDITOR, REQUIERED, EDITABLE, VISIBLE, DEFAULTVALUE, SORDER, INITEDITOR) VALUES (1, 'Nota general', 30, false, true, true, null, 190, null);
INSERT INTO FIELD (IDFORM, LABEL, IDCLASSEDITOR, REQUIERED, EDITABLE, VISIBLE, DEFAULTVALUE, SORDER, INITEDITOR) VALUES (1, 'Descriptores', 999, false, true, true, null, 240, null);
INSERT INTO FIELD (IDFORM, LABEL, IDCLASSEDITOR, REQUIERED, EDITABLE, VISIBLE, DEFAULTVALUE, SORDER, INITEDITOR) VALUES (1, 'Autoridades', 34, false, true, true, null, 250, '{"components":[{"componentPath" : "meetingsAuthorityEditor", "properties": {"visible": "false"}}]}');
INSERT INTO FIELD (IDFORM, LABEL, IDCLASSEDITOR, REQUIERED, EDITABLE, VISIBLE, DEFAULTVALUE, SORDER, INITEDITOR) VALUES (1, 'Nivel Superior', 3, false, true, true, null, 10, '{"components":[{"componentPath" : "form:component", "properties": {"excludeThisDescriptionLevelAndBelow": "EX,DO"}}]}');
INSERT INTO FIELD (IDFORM, LABEL, IDCLASSEDITOR, REQUIERED, EDITABLE, VISIBLE, DEFAULTVALUE, SORDER, INITEDITOR) VALUES (1, 'Dimensiones', 14, false, true, false, null, 56, null);
INSERT INTO FIELD (IDFORM, LABEL, IDCLASSEDITOR, REQUIERED, EDITABLE, VISIBLE, DEFAULTVALUE, SORDER, INITEDITOR) VALUES (1, 'Centro/Autor descriptor original', 43, false, true, false, null, 220, null);
INSERT INTO FIELD (IDFORM, LABEL, IDCLASSEDITOR, REQUIERED, EDITABLE, VISIBLE, DEFAULTVALUE, SORDER, INITEDITOR) VALUES (1, 'Signatura', 7, false, true, true, '{"defaultValues":[{"componentPath" : "countryTF","value" : "ES"},{"componentPath" : "archiveTF","value" : "${archive.archiveCode}"}]}', 20, '{"components":[{"componentPath":"","properties":{"maxLengthBox":"6","maxLengthFile":"4"}},{"componentPath":"countryTF","properties":{"visible":"false"}},{"componentPath":"archiveTF","properties":{"visible":"false"}},{"componentPath":"clasificationCodeTF","properties":{"visible":"false"}},{"componentPath":"sectionTF","properties":{"visible":"false"}},{"componentPath":"depositTF","properties":{"visible":"false"}}]}');
INSERT INTO field (IDFORM, LABEL, IDCLASSEDITOR, REQUIERED, EDITABLE, VISIBLE, DEFAULTVALUE, SORDER, INITEDITOR) VALUES (1, 'Signatura Cancelada', 7, false, true, true, null, 21, '{"components":[{"componentPath":"countryTF","properties":{"model.code":"a","model.tag":"089","visible":"false"}},{"componentPath":"archiveTF","properties":{"model.code":"b","model.tag":"089","visible":"false"}},{"componentPath":"documentNumberTF","properties":{"model.code":"c","model.tag":"089"}},{"componentPath":"clasificationCodeTF","properties":{"model.code":"e","model.tag":"089","visible":"false"}},{"componentPath":"boxNumberTF","properties":{"model.code":"f","model.tag":"089"}},{"componentPath":"sectionTF","properties":{"model.code":"g","model.tag":"089","visible":"false"}},{"componentPath":"depositTF","properties":{"model.code":"h","model.tag":"089","visible":"false"}}]}');

INSERT INTO FIELD (IDFORM, LABEL, IDCLASSEDITOR, REQUIERED, EDITABLE, VISIBLE, DEFAULTVALUE, SORDER, INITEDITOR) VALUES (1, 'Idioma', 26, false, true, false, null, 130, null);
INSERT INTO FIELD (IDFORM, LABEL, IDCLASSEDITOR, REQUIERED, EDITABLE, VISIBLE, DEFAULTVALUE, SORDER, INITEDITOR) VALUES (1, 'Soporte', 38, false, true, false, null, 53, '{"userListId": 2}');
INSERT INTO FIELD (IDFORM, LABEL, IDCLASSEDITOR, REQUIERED, EDITABLE, VISIBLE, DEFAULTVALUE, SORDER, INITEDITOR) VALUES (1, 'Recursos', 24, false, true, true, null, 50, null);

INSERT INTO FIELD (IDFORM, LABEL, IDCLASSEDITOR, REQUIERED, EDITABLE, VISIBLE, DEFAULTVALUE, SORDER, INITEDITOR) VALUES (2, 'Área de Identificación', 999, false, true, true, null, 5, null);
INSERT INTO FIELD (IDFORM, LABEL, IDCLASSEDITOR, REQUIERED, EDITABLE, VISIBLE, DEFAULTVALUE, SORDER, INITEDITOR) VALUES (2, 'Nivel de Descripción', 1, true, true, true, '7', 8, null);
INSERT INTO FIELD (IDFORM, LABEL, IDCLASSEDITOR, REQUIERED, EDITABLE, VISIBLE, DEFAULTVALUE, SORDER, INITEDITOR) VALUES (2, 'Título', 84, true, true, true, null, 30, '{"initFields": {"modelMarcfield" : "245","modelMarcSubfield": "a"},"sizeTextArea":{"rows":3, "cols":100}}');
INSERT INTO FIELD (IDFORM, LABEL, IDCLASSEDITOR, REQUIERED, EDITABLE, VISIBLE, DEFAULTVALUE, SORDER, INITEDITOR) VALUES (2, 'Fecha(s)', 12, false, true, true, null, 40, null);
INSERT INTO FIELD (IDFORM, LABEL, IDCLASSEDITOR, REQUIERED, EDITABLE, VISIBLE, DEFAULTVALUE, SORDER, INITEDITOR) VALUES (2, 'Área de Contenido y estructura', 999, false, true, true, null, 80, null);
INSERT INTO FIELD (IDFORM, LABEL, IDCLASSEDITOR, REQUIERED, EDITABLE, VISIBLE, DEFAULTVALUE, SORDER, INITEDITOR) VALUES (2, 'Alcance y contenido', 41, false, true, true, null, 90, null);
INSERT INTO FIELD (IDFORM, LABEL, IDCLASSEDITOR, REQUIERED, EDITABLE, VISIBLE, DEFAULTVALUE, SORDER, INITEDITOR) VALUES (2, 'Área de Acceso y condiciones de uso', 999, false, true, true, null, 110, null);
INSERT INTO FIELD (IDFORM, LABEL, IDCLASSEDITOR, REQUIERED, EDITABLE, VISIBLE, DEFAULTVALUE, SORDER, INITEDITOR) VALUES (2, 'Seguridad', 25, false, true, true, null, 120, null);
INSERT INTO FIELD (IDFORM, LABEL, IDCLASSEDITOR, REQUIERED, EDITABLE, VISIBLE, DEFAULTVALUE, SORDER, INITEDITOR) VALUES (2, 'Estado de conservación', 37, false, true, true, null, 150, null);
INSERT INTO FIELD (IDFORM, LABEL, IDCLASSEDITOR, REQUIERED, EDITABLE, VISIBLE, DEFAULTVALUE, SORDER, INITEDITOR) VALUES (2, 'Notas', 999, false, true, true, null, 180, null);
INSERT INTO FIELD (IDFORM, LABEL, IDCLASSEDITOR, REQUIERED, EDITABLE, VISIBLE, DEFAULTVALUE, SORDER, INITEDITOR) VALUES (2, 'Nota general', 30, false, true, true, null, 190, null);
INSERT INTO FIELD (IDFORM, LABEL, IDCLASSEDITOR, REQUIERED, EDITABLE, VISIBLE, DEFAULTVALUE, SORDER, INITEDITOR) VALUES (2, 'Área de Control de descripción', 999, false, true, true, null, 210, null);
INSERT INTO FIELD (IDFORM, LABEL, IDCLASSEDITOR, REQUIERED, EDITABLE, VISIBLE, DEFAULTVALUE, SORDER, INITEDITOR) VALUES (2, 'Comprobado', 33, false, true, true, null, 230, null);
INSERT INTO FIELD (IDFORM, LABEL, IDCLASSEDITOR, REQUIERED, EDITABLE, VISIBLE, DEFAULTVALUE, SORDER, INITEDITOR) VALUES (2, 'Descriptores', 999, false, true, true, null, 240, null);
INSERT INTO FIELD (IDFORM, LABEL, IDCLASSEDITOR, REQUIERED, EDITABLE, VISIBLE, DEFAULTVALUE, SORDER, INITEDITOR) VALUES (2, 'Autoridades', 34, false, true, true, null, 250, '{"components":[{"componentPath" : "meetingsAuthorityEditor", "properties": {"visible": "false"}}]}');
INSERT INTO FIELD (IDFORM, LABEL, IDCLASSEDITOR, REQUIERED, EDITABLE, VISIBLE, DEFAULTVALUE, SORDER, INITEDITOR) VALUES (2, 'Nivel Superior', 3, false, true, true, null, 10, '{"components":[{"componentPath" : "form:component", "properties": {"excludeThisDescriptionLevelAndBelow": "EX,DO"}}]}');
INSERT INTO FIELD (IDFORM, LABEL, IDCLASSEDITOR, REQUIERED, EDITABLE, VISIBLE, DEFAULTVALUE, SORDER, INITEDITOR) VALUES (2, 'Dimensiones', 14, false, true, true, null, 56, null);
INSERT INTO FIELD (IDFORM, LABEL, IDCLASSEDITOR, REQUIERED, EDITABLE, VISIBLE, DEFAULTVALUE, SORDER, INITEDITOR) VALUES (2, 'Signatura', 7, false, true, true, '{"defaultValues":[{"componentPath" : "countryTF","value" : "ES"},{"componentPath" : "archiveTF","value" : "${archive.archiveCode}"}]}', 20, '{"components":[{"componentPath":"","properties":{"maxLengthBox":"6","maxLengthFile":"4"}},{"componentPath":"clasificationCodeTF","properties":{"visible":"false"}}]}');
INSERT INTO field (IDFORM, LABEL, IDCLASSEDITOR, REQUIERED, EDITABLE, VISIBLE, DEFAULTVALUE, SORDER, INITEDITOR) VALUES (2, 'Signatura Cancelada', 7, false, true, true, null, 21, '{"components":[{"componentPath":"countryTF","properties":{"model.code":"a","model.tag":"089"}},{"componentPath":"archiveTF","properties":{"model.code":"b","model.tag":"089"}},{"componentPath":"documentNumberTF","properties":{"model.code":"c","model.tag":"089"}},{"componentPath":"clasificationCodeTF","properties":{"model.code":"e","model.tag":"089","visible":"false"}},{"componentPath":"boxNumberTF","properties":{"model.code":"f","model.tag":"089"}},{"componentPath":"sectionTF","properties":{"model.code":"g","model.tag":"089"}},{"componentPath":"depositTF","properties":{"model.code":"h","model.tag":"089"}}]}');
INSERT INTO FIELD (IDFORM, LABEL, IDCLASSEDITOR, REQUIERED, EDITABLE, VISIBLE, DEFAULTVALUE, SORDER, INITEDITOR) VALUES (2, 'Idioma', 26, false, true, true, null, 130, null);
INSERT INTO FIELD (IDFORM, LABEL, IDCLASSEDITOR, REQUIERED, EDITABLE, VISIBLE, DEFAULTVALUE, SORDER, INITEDITOR) VALUES (2, 'Centro/Autor descriptor original', 43, false, true, true, null, 220, null);
INSERT INTO FIELD (IDFORM, LABEL, IDCLASSEDITOR, REQUIERED, EDITABLE, VISIBLE, DEFAULTVALUE, SORDER, INITEDITOR) VALUES (2, 'Soporte', 83, false, true, true, null, 53, '{"initFields": {"modelMarcfield" : "340","modelMarcSubfield": "a"},"userListId":2}');
INSERT INTO FIELD (IDFORM, LABEL, IDCLASSEDITOR, REQUIERED, EDITABLE, VISIBLE, DEFAULTVALUE, SORDER, INITEDITOR) VALUES (2, 'Recursos', 24, false, true, true, null, 50, null);
