INSERT INTO core_permissions (code,permission_name,parent,permission_function,default_child,permission_namespace,"module",permission_description,permission_type,icon,ord,hidden,guest,meta) VALUES
	 ('MCOUNT','count',NULL,NULL,NULL,'count','count','Access to count module','MOD','fa-solid fa-calculator',1000,false,false,NULL);
INSERT INTO core_permissions (code,permission_name,parent,permission_function,default_child,permission_namespace,"module",permission_description,permission_type,icon,ord,hidden,guest,meta) VALUES
	 ('SCNTMSC','count_main_function','MCOUNT','','','count','count','Section for main functions','SEC','',1,false,false,NULL);
INSERT INTO public.core_permissions (code,permission_name,parent,permission_function,default_child,permission_namespace,"module",permission_description,permission_type,icon,ord,hidden,guest,meta) VALUES
	 ('XCNTCRE','count_event_create','SCNTMSC','createCountEvent','','count','count','Permission to create billable event record','EXE','',1,false,false,NULL);

INSERT INTO core_permissions (code,permission_name,parent,permission_function,default_child,permission_namespace,"module",permission_description,permission_type,icon,ord,hidden,guest,meta) VALUES
	 ('PCNTEVN','count_events_page','MCOUNT','getObjects','','count/events','count','Billable events management page','PAG','fa-solid fa-calendar-check',1,false,false,NULL);
INSERT INTO core_permissions (code,permission_name,parent,permission_function,default_child,permission_namespace,"module",permission_description,permission_type,icon,ord,hidden,guest,meta) VALUES
	 ('SCNTEVW','count_events_list','PCNTEVN','','','count/events','count','Section to edit events','SEC','',1,false,false,NULL);

INSERT INTO core_permissions (code,permission_name,parent,permission_function,default_child,permission_namespace,"module",permission_description,permission_type,icon,ord,hidden,guest,meta) VALUES
	 ('BCNTSTG','count_events_settings_button','SCNTEVW','','','count/events','count','Button to edit billable event settings','BUT','fa-solid fa-square-sliders',1,false,false,NULL);

INSERT INTO public.core_permissions (code,permission_name,parent,permission_function,default_child,permission_namespace,"module",permission_description,permission_type,icon,ord,hidden,guest,meta) VALUES
	 ('XCNTGET','count_events_get','SCNTEVW','getCountEvents','','count/events','count','Permission to get count events','EXE','',1,false,false,NULL);

INSERT INTO public.core_permissions (code,permission_name,parent,permission_function,default_child,permission_namespace,"module",permission_description,permission_type,icon,ord,hidden,guest,meta) VALUES
	 ('PCNTCNF','count_config','MCOUNT','','','count/config','count','Permission to count config','PAG','fa-solid fa-wrench',1,false,false,NULL),
	 ('PCNTBIL','count_config_billable','PCNTCNF','getObjects','','count/config/billable','count','Permission to count config billable page','PAG','fa-solid fa-file-invoice-dollar',1,false,false,NULL),
	 ('SCNTBIL','count_config_billable_list','PCNTBIL','','','ccount/config/billable','count','Permission to count config billable section','SEC','',1,false,false,NULL),
	 ('XCNTBGT','count_billable_get','SCNTBIL','getBillableEvents','','count/config/billable','count','Permiassion to get billable events','EXE','',1,false,false,NULL),
	 ('BCNTENB','count_enable_billing_button','SCNTBIL','','','count/config/billable','count','Permission to enable billing button','BUT','fa-solid fa-toggle-on',1,false,false,NULL),
	 ('BCNTDIS','count_disable_billing_button','SCNTBIL','','','count/config/billable','count','Permission to disable billing','BUT','fa-solid fa-toggle-off',1,false,false,NULL),
	 ('BCNTCNF','count_configuration_button','SCNTBIL','','','count/config/billable','count','Permisison to configure button','BUT','fa-solid fa-screwdriver-wrench',1,false,false,NULL);
INSERT INTO public.core_permissions (code,permission_name,parent,permission_function,default_child,permission_namespace,"module",permission_description,permission_type,icon,ord,hidden,guest,meta) VALUES
	 ('XTGGBIL','count_billable_toggle','SCNTBIL','toggleBilling','','count/config/billable','count','Permission to toggle billable state','EXE','',1,false,false,NULL);
INSERT INTO public.core_permissions (code,permission_name,parent,permission_function,default_child,permission_namespace,"module",permission_description,permission_type,icon,ord,hidden,guest,meta) VALUES
	 ('XCCFGBE','count_billable_get_config','SCNTBIL','getBillableEventConfig','','count/config','count','Permission to get billable event configuration.','EXE','',1,false,false,NULL);



INSERT INTO public.core_user_roles (id,role_name,hidden) VALUES
	 (25,'BillingAdmin',0);

----------------------------------------------------------------------------------------------------------------------------------------------------------------

INSERT INTO public.core_user_role_has_permission (role_id,permission_code) VALUES
    (25,'MCOUNT'),
    (25,'SCNTMSC'),
    (25,'XCNTCRE'),
    (25,'PCNTEVN'),
    (25,'SCNTEVW'),
    (25,'BCNTSTG'),
    (25,'XCNTGET'),
    (25,'PCNTCNF'),
    (25,'PCNTBIL'),
    (25,'SCNTBIL'),
    (25,'XCNTBGT'),
    (25,'BCNTENB'),
    (25,'BCNTDIS'),
    (25,'BCNTCNF'),
    (25,'XTGGBIL'),
    (25,'XCCFGBE');
----------------------------------------------------------------------------------------------------------------------------------------------------------------

INSERT INTO public.core_settings (setting_type,setting_name,value,properties,ord) VALUES
	 ('count_settings','general_configuration','{"events":{"config":["client_id"]}}','{"section_desc": "Count Module Settings", 
	 "section_icon": "fa-solid fa-calculator", "setting_desc": "General configuration", "setting_icon": "fa-solid fa-sliders", 
	 "section_button": "Change settings", "setting_button": "Edit"}',110);

INSERT INTO public.code_list_count_measure_unit (code,description,ord,icon,misc,properties) VALUES
	 ('PCS','Pieces',NULL,NULL,NULL,NULL),
	 ('HRS','Hours',NULL,NULL,NULL,NULL);

INSERT INTO public.code_lists ("table",description,editable)
	VALUES ('code_list_count_measure_unit','Count-measure units',true);

INSERT INTO public.core_sm_states (object_name,state_code,description,allowed_from,before_hook,after_hook,feedback,afterhook_once,feedback_once,prevent_feedback_on_afterhook,billable,meta,object_type) VALUES
	 ('count_invoices','CRT','created','[""]',NULL,NULL,'[]',true,false,true,false,'{}',NULL),
	 ('count_invoices','INV','invoices','["CRT"]',NULL,NULL,'[]',true,false,true,false,'{}',NULL);

INSERT INTO public.core_permissions (code,permission_name,parent,permission_function,default_child,permission_namespace,"module",permission_description,permission_type,icon,ord,hidden,guest,meta) VALUES
	 ('XCTYRTR','count_widget_yearly_traffic','SCNIVED','getYearlySummary','','count/invoices','count','Permission to retrieve yearly traffic','EXE','',1,false,false,NULL);

INSERT INTO public.core_permissions (code,permission_name,parent,permission_function,default_child,permission_namespace,"module",permission_description,permission_type,icon,ord,hidden,guest,meta) VALUES
	 ('XCTRMCP','count_widget_remaining_to_cap','SCNIVED','getRemainingToCap','','count/invoices','count','Permission to retrieve remaining traffic to cap','EXE','',1,false,false,NULL);
     
INSERT INTO public.core_permissions (code,permission_name,parent,permission_function,default_child,permission_namespace,"module",permission_description,permission_type,icon,ord,hidden,guest,meta) VALUES
	 ('XCTAKDH','count_widget_akontacija_dohodnine','SCNIVED','getAkontacijaDohodnine','','count/invoices','count','Permission to retrieve akontacija dohodnine','EXE','',1,false,false,NULL);
          
INSERT INTO public.core_permissions (code,permission_name,parent,permission_function,default_child,permission_namespace,"module",permission_description,permission_type,icon,ord,hidden,guest,meta) VALUES
	 ('XCTAKPV','count_widget_placilo_vracilo_dohodnine','SCNIVED','getPlaciloVraciloDohodnine','','count/invoices','count','Permission to retrieve placilo/vracilo dohodnine','EXE','',1,false,false,NULL);
        

INSERT INTO core_permissions (code,permission_name,parent,permission_function,default_child,permission_namespace,"module",permission_description,permission_type,icon,ord,hidden,guest,meta) VALUES
	 ('XCTPRDV','count_widget_preostanek_ddv','SCNIVED','getPreostanekDDV','','count/invoices','count','Permission to retrieve preostanek DDV','EXE','',1,false,false,NULL);
	 
INSERT INTO core_permissions (code,permission_name,parent,permission_function,default_child,permission_namespace,"module",permission_description,permission_type,icon,ord,hidden,guest,meta) VALUES
	 ('XCTDOH','count_widget_dohodnina','SCNIVED','getDohodnina','','count/invoices','count','Permission to retrieve dohodnina','EXE','',1,false,false,NULL);

INSERT INTO core_permissions (code,permission_name,parent,permission_function,default_child,permission_namespace,"module",permission_description,permission_type,icon,ord,hidden,guest,meta) VALUES
	 ('BCINADD','count_invoices_view_add_quote','SCNTIVW','','','count/invoices','count','Add quotes button','BUT','fa-solid fa-file-invoice',1,false,false,NULL),
	 ('BCINADA','count_invoices_view_add_advanced','SCNTIVW','','','count/invoices','count','Add advanced button','BUT','fa-solid fa-file-invoice-dollar',1,false,false,NULL),
	 ('BCINEDT','count_invoices_view_add_credit','SCNTIVW','','','count/invoices','count','Add credit notes button','BUT','fa-solid fa-receipt',1,false,false,NULL);

INSERT INTO public.code_list_count_document_types (code,description)
	VALUES ('INV','Invoice');
INSERT INTO public.code_list_count_document_types (code,description)
	VALUES ('CDN','Credit note');
INSERT INTO public.code_list_count_document_types (code,description)
	VALUES ('QOT','Quotation');
INSERT INTO public.code_list_count_document_types (code,description)
	VALUES ('AVN','Advanced');

INSERT INTO core_permissions (code,permission_name,parent,permission_function,default_child,permission_namespace,"module",permission_description,permission_type,icon,ord,hidden,guest,meta) VALUES
	 ('BCINSRC','count_invoices_button_search','SCNTIVW','','','count/invoices','count','Filter button search','BUT','fa-solid fa-magnifying-glass',1,false,false,NULL),
	 ('BCINFLT','count_invoices_button_filters','SCNTIVW','','','count/invoices','count','Filter button filters','BUT','fa-solid fa-filter',1,false,false,NULL),
	 ('BCINRMV','count_invoices_button_filters_remove','SCNTIVW','','','count/invoices','count','Filter button remove','BUT','fa-solid fa-xmark',1,false,false,NULL);

INSERT INTO core_permissions (code,permission_name,parent,permission_function,default_child,permission_namespace,"module",permission_description,permission_type,icon,ord,hidden,guest,meta) VALUES
	 ('XCTSDDV','count_services_ddv_search','SCNIVED','ddvQueryInetis','','count/services','count','Permission to access serch ddb service','EXE','',1,false,false,NULL);


INSERT INTO public.core_permissions (code,permission_name,parent,permission_function,default_child,permission_namespace,"module",permission_description,permission_type,icon,ord,hidden,guest,meta) VALUES
	 ('XCPRINV','count_invoices_process_invoice','SCNIVED','processNormiranecInvoiceData','','count/invoices','count','Permission to process invoice data','EXE','',1,false,false,NULL);
