From 754b67b098c1d460921a0429e1337e132aa07636 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Mon, 6 May 2024 09:53:18 +0200 Subject: [PATCH 01/11] chore(deps): update nuget non-major dependencies (#12754) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- backend/packagegroups/NuGet.props | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/backend/packagegroups/NuGet.props b/backend/packagegroups/NuGet.props index 346a069c00e..a5b5f1a8b34 100644 --- a/backend/packagegroups/NuGet.props +++ b/backend/packagegroups/NuGet.props @@ -25,7 +25,7 @@ - + @@ -44,10 +44,10 @@ - - + + - + From 336cb74629d1550b5dd44a9bbeb2d0802b9aa3e7 Mon Sep 17 00:00:00 2001 From: andreastanderen <71079896+standeren@users.noreply.github.com> Date: Mon, 6 May 2024 10:54:20 +0200 Subject: [PATCH 02/11] Change autoSaveOnLayout to be strighter (#12747) --- .../packages/ux-editor/src/containers/FormItemContext.tsx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/frontend/packages/ux-editor/src/containers/FormItemContext.tsx b/frontend/packages/ux-editor/src/containers/FormItemContext.tsx index c07a3b49f98..bf3575d2cc9 100644 --- a/frontend/packages/ux-editor/src/containers/FormItemContext.tsx +++ b/frontend/packages/ux-editor/src/containers/FormItemContext.tsx @@ -148,10 +148,10 @@ export const FormItemContextProvider = ({ const autoSaveOnLayoutChange = async () => { if ( prevSelectedFormLayoutSetNameRef.current === selectedFormLayoutSetName && - prevSelectedFormLayoutNameRef.current === selectedFormLayoutName - ) - return; - await handleSave(); + prevSelectedFormLayoutNameRef.current !== selectedFormLayoutName + ) { + await handleSave(); + } handleDiscard(); prevSelectedFormLayoutSetNameRef.current = selectedFormLayoutSetName; prevSelectedFormLayoutNameRef.current = selectedFormLayoutName; From d28b65e5e1c575e8a5757b03c4024bbcf071c4b4 Mon Sep 17 00:00:00 2001 From: Erling Hauan <148075168+ErlingHauan@users.noreply.github.com> Date: Tue, 7 May 2024 08:25:48 +0200 Subject: [PATCH 03/11] Close text areas when a different component or page is selected (#12752) * Close TextResourceFieldSet when formItem changes * Add closing of textarea when switching pages --- .../components/TextResource/TextResource.tsx | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/frontend/packages/ux-editor/src/components/TextResource/TextResource.tsx b/frontend/packages/ux-editor/src/components/TextResource/TextResource.tsx index 513b5c96567..8eb330d208e 100644 --- a/frontend/packages/ux-editor/src/components/TextResource/TextResource.tsx +++ b/frontend/packages/ux-editor/src/components/TextResource/TextResource.tsx @@ -1,12 +1,14 @@ -import React, { useState } from 'react'; +import React, { useEffect, useState } from 'react'; import { generateRandomId } from 'app-shared/utils/generateRandomId'; import { generateTextResourceId } from '../../utils/generateId'; import { TextResourceEditor } from './TextResourceEditor'; -import { StudioButton, StudioDeleteButton, StudioProperty } from '@studio/components'; +import { StudioButton, StudioDeleteButton, StudioProperty, usePrevious } from '@studio/components'; import { XMarkIcon } from '@studio/icons'; import { TextResourceValue } from './TextResourceValue'; import { useTranslation } from 'react-i18next'; import { DEFAULT_LANGUAGE } from 'app-shared/constants'; +import { useFormItemContext } from '@altinn/ux-editor/containers/FormItemContext'; +import { useAppContext } from '@altinn/ux-editor/hooks'; export interface TextResourceProps { handleIdChange: (id: string) => void; @@ -38,6 +40,12 @@ export const TextResource = ({ label, textResourceId, }: TextResourceProps) => { + const { formItemId } = useFormItemContext(); + const { selectedFormLayoutName: formLayoutName } = useAppContext(); + + const prevFormItemId = usePrevious(formItemId); + const prevFormLayoutName = usePrevious(formLayoutName); + const [isOpen, setIsOpen] = useState(false); const handleOpen = () => { @@ -47,6 +55,12 @@ export const TextResource = ({ setIsOpen(true); }; + useEffect(() => { + if (formItemId !== prevFormItemId || formLayoutName !== prevFormLayoutName) { + setIsOpen(false); + } + }, [formItemId, prevFormItemId, formLayoutName, prevFormLayoutName]); + return isOpen ? ( Date: Tue, 7 May 2024 10:08:01 +0200 Subject: [PATCH 04/11] Explicity convert to utc time (#12777) --- .../Repository/ORMImplementation/Mappers/DeploymentMapper.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/backend/src/Designer/Repository/ORMImplementation/Mappers/DeploymentMapper.cs b/backend/src/Designer/Repository/ORMImplementation/Mappers/DeploymentMapper.cs index 3ca037d1c6f..6541b1570a9 100644 --- a/backend/src/Designer/Repository/ORMImplementation/Mappers/DeploymentMapper.cs +++ b/backend/src/Designer/Repository/ORMImplementation/Mappers/DeploymentMapper.cs @@ -26,7 +26,7 @@ public static Deployment MapToDbModel(DeploymentEntity deploymentEntity) Org = deploymentEntity.Org, App = deploymentEntity.App, Buildresult = deploymentEntity.Build.Result.ToEnumMemberAttributeValue(), - Created = deploymentEntity.Created, + Created = deploymentEntity.Created.ToUniversalTime(), Entity = JsonSerializer.Serialize(deploymentEntity, s_jsonOptions) }; } From 2fad8a41ee7ad878d3953d58d65db4bd5acd7bbd Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Tue, 7 May 2024 14:03:47 +0200 Subject: [PATCH 05/11] fix(deps): update dependency ajv-formats to v3 (#12757) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- package.json | 2 +- yarn.lock | 18 ++++++++++++++++-- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index 430ec7d15e5..0c528535b22 100644 --- a/package.json +++ b/package.json @@ -11,7 +11,7 @@ "@tanstack/react-query": "5.32.0", "@tanstack/react-query-devtools": "5.32.0", "ajv": "8.12.0", - "ajv-formats": "2.1.1", + "ajv-formats": "3.0.1", "react-error-boundary": "4.0.13", "react-i18next": "13.5.0", "react-router-dom": "6.23.0", diff --git a/yarn.lock b/yarn.lock index 24f7a558a71..f1b31cf601a 100644 --- a/yarn.lock +++ b/yarn.lock @@ -8441,7 +8441,21 @@ __metadata: languageName: node linkType: hard -"ajv-formats@npm:2.1.1, ajv-formats@npm:^2.1.1": +"ajv-formats@npm:3.0.1": + version: 3.0.1 + resolution: "ajv-formats@npm:3.0.1" + dependencies: + ajv: "npm:^8.0.0" + peerDependencies: + ajv: ^8.0.0 + peerDependenciesMeta: + ajv: + optional: true + checksum: 10/5679b9f9ced9d0213a202a37f3aa91efcffe59a6de1a6e3da5c873344d3c161820a1f11cc29899661fee36271fd2895dd3851b6461c902a752ad661d1c1e8722 + languageName: node + linkType: hard + +"ajv-formats@npm:^2.1.1": version: 2.1.1 resolution: "ajv-formats@npm:2.1.1" dependencies: @@ -8543,7 +8557,7 @@ __metadata: "@typescript-eslint/eslint-plugin": "npm:7.7.1" "@typescript-eslint/parser": "npm:7.7.1" ajv: "npm:8.12.0" - ajv-formats: "npm:2.1.1" + ajv-formats: "npm:3.0.1" clean-webpack-plugin: "npm:4.0.0" cross-env: "npm:7.0.3" css-loader: "npm:6.11.0" From da69059b99bc61a0e4e964dffcc9e37efa3b318a Mon Sep 17 00:00:00 2001 From: Martin Gunnerud Date: Tue, 7 May 2024 14:40:16 +0200 Subject: [PATCH 06/11] Resourceadm: text changes on about resource according to design (#12779) * text changes according to new design * change delegate text description field to textarea * make description prop optional in radio and switch component in about resource page --- frontend/language/src/nb.json | 26 +++++++++---------- .../ResourcePageInputs/ResourceRadioGroup.tsx | 2 +- .../ResourceSwitchInput.tsx | 10 ++++--- .../AboutResourcePage/AboutResourcePage.tsx | 3 +-- 4 files changed, 20 insertions(+), 21 deletions(-) diff --git a/frontend/language/src/nb.json b/frontend/language/src/nb.json index 609d469aca9..32fa7e4ad61 100644 --- a/frontend/language/src/nb.json +++ b/frontend/language/src/nb.json @@ -846,21 +846,20 @@ "resourceadm.about_resource_contact_legend": "Kontaktinformasjon {{index}}", "resourceadm.about_resource_contact_point_error": "Du mangler å legge til et av feltene for kontaktinformasjon.", "resourceadm.about_resource_contact_remove_button": "Slett kontakt", - "resourceadm.about_resource_delegable_label": "Delegerbar", + "resourceadm.about_resource_delegable_label": "Gjør ressursen delegerbar", "resourceadm.about_resource_delegable_show_text": "Ressursen {{shouldText}} være delegerbar.", - "resourceadm.about_resource_delegable_text": "Delegasjonstekst er påkrevd hvis ressursen er satt til å være delegerbar.", "resourceadm.about_resource_edit_rrr": "Administrer tilgangslister i {{env}}", "resourceadm.about_resource_enterprise_label": "Enterprise bruker", "resourceadm.about_resource_enterprise_show_text": "Ressursen {{shouldText}} ha enterprise bruker aktivert.", "resourceadm.about_resource_enterprise_text": "Brukeren som opptrer på vegne av en part kan være bedriftsbruker.", "resourceadm.about_resource_error_usage_string_description": "beskrivelse", - "resourceadm.about_resource_error_usage_string_rights_description": "delegasjonstekst", + "resourceadm.about_resource_error_usage_string_rights_description": "delegeringstekst", "resourceadm.about_resource_error_usage_string_title": "tittel", "resourceadm.about_resource_homepage_label": "Hjemmeside", "resourceadm.about_resource_homepage_text": "Lenke til informasjon om hvor sluttbruker kan finne tjenesten og informasjon om den.", "resourceadm.about_resource_identifier_description": "Dette er en unik ID for ressursen både i URler og i APIer.", "resourceadm.about_resource_identifier_label": "Ressurs-id", - "resourceadm.about_resource_keywords_label": "Nøkkelord", + "resourceadm.about_resource_keywords_label": "Nøkkelord for ressursen (Bokmål, nynorsk og engelsk)", "resourceadm.about_resource_keywords_text": "Ord som er enkle å søke på. Separer hvert ord med komma \",\".", "resourceadm.about_resource_langauge_error_missing_1": "Du mangler oversettelse for {{usageString}} på {{lang}}.", "resourceadm.about_resource_langauge_error_missing_2": "Du mangler oversettelse for {{usageString}} på {{lang1}} og {{lang2}}.", @@ -884,18 +883,18 @@ "resourceadm.about_resource_references": "Ressursreferanse {{index}}", "resourceadm.about_resource_references_description": "Brukes kun av maskinporten", "resourceadm.about_resource_required_field": "Må fylles ut", - "resourceadm.about_resource_resource_description_label": "Beskrivelse (Bokmål)", - "resourceadm.about_resource_resource_description_text": "Teksten blir synlig på flere områder på tvers av offentlige nettløsninger.", + "resourceadm.about_resource_resource_description_label": "Beskriv tjenesten (Bokmål)", + "resourceadm.about_resource_resource_description_text": "Gi sluttbruker en god og presis beskrivelse av tjenesten og hva den skal løse.", "resourceadm.about_resource_resource_title_label": "Navn på tjenesten (Bokmål)", - "resourceadm.about_resource_resource_title_text": "Navnet vil synes for brukere, og må være gjenkjennelig og beskrivende for hva tjenesten handler om. Pass på å skille tjenester som har like eller nesten like navn, slik at det blir lett for brukere å forstå.", + "resourceadm.about_resource_resource_title_text": "Navnet vil synes for sluttbruker, og må være gjenkjennelig og beskrivende for hva tjenesten handler om. Pass på å skille tjenester som har like eller nesten like navn, slik at det blir lett for sluttbruker å forstå.", "resourceadm.about_resource_resource_type": "Ressurstype", "resourceadm.about_resource_resource_type_brokerservice": "Formidlingstjeneste", - "resourceadm.about_resource_resource_type_error": "Du mangler å legge til ressurstype.", + "resourceadm.about_resource_resource_type_error": "Du må velge en ressurstype.", "resourceadm.about_resource_resource_type_generic_access_resource": "Generisk tilgangsressurs", "resourceadm.about_resource_resource_type_label": "Velg en ressurstype fra listen under.", "resourceadm.about_resource_resource_type_maskinporten": "Maskinporten skjema", "resourceadm.about_resource_resource_type_system_resource": "Systemressurs", - "resourceadm.about_resource_rights_description_label": "Delegasjonstekst", + "resourceadm.about_resource_rights_description_label": "Delegeringstekst (Bokmål)", "resourceadm.about_resource_rights_description_text": "Forklar sluttbruker hvilke rettigheter som delegeres og hva mottaker av rettigheter kan utføre på vegne av den han har fått rettighet for.", "resourceadm.about_resource_rrr_publish_warning": "Ressursen må publiseres i et miljø før tilgangslister kan konfigureres for miljøet. Ressursen er ikke publisert i:", "resourceadm.about_resource_self_identified_label": "Selvidentifisert bruker", @@ -904,14 +903,13 @@ "resourceadm.about_resource_spinner": "Laster inn ressurs", "resourceadm.about_resource_status_completed": "Fullført", "resourceadm.about_resource_status_deprecated": "Avviklet", - "resourceadm.about_resource_status_error": "Du mangler å legge til status.", - "resourceadm.about_resource_status_label": "Status", - "resourceadm.about_resource_status_text": "Velg en status fra listen under.", + "resourceadm.about_resource_status_error": "Du må velge en status.", + "resourceadm.about_resource_status_label": "Velg en status", "resourceadm.about_resource_status_under_development": "Under utvikling", "resourceadm.about_resource_status_withdrawn": "Trukket tilbake", "resourceadm.about_resource_title": "Om ressursen", - "resourceadm.about_resource_translation_description": "Beskrivelse", - "resourceadm.about_resource_translation_right_description": "Delgasjonstekst", + "resourceadm.about_resource_translation_description": "Beskriv tjenesten", + "resourceadm.about_resource_translation_right_description": "Delegeringstekst", "resourceadm.about_resource_translation_title": "Navn på tjenesten", "resourceadm.about_resource_use_rrr_show_text": "Ressursen {{shouldText}} være begrenset av tilgangslister.", "resourceadm.about_resource_visible_label": " Synlighet", diff --git a/frontend/resourceadm/components/ResourcePageInputs/ResourceRadioGroup.tsx b/frontend/resourceadm/components/ResourcePageInputs/ResourceRadioGroup.tsx index bb64a3c3ae5..9dc38b45e6b 100644 --- a/frontend/resourceadm/components/ResourcePageInputs/ResourceRadioGroup.tsx +++ b/frontend/resourceadm/components/ResourcePageInputs/ResourceRadioGroup.tsx @@ -12,7 +12,7 @@ type ResourceRadioGroupProps = { /** * The description of the dropdown */ - description: string; + description?: string; /** * The value selected */ diff --git a/frontend/resourceadm/components/ResourcePageInputs/ResourceSwitchInput.tsx b/frontend/resourceadm/components/ResourcePageInputs/ResourceSwitchInput.tsx index 23d6a40382c..6608308a6b1 100644 --- a/frontend/resourceadm/components/ResourcePageInputs/ResourceSwitchInput.tsx +++ b/frontend/resourceadm/components/ResourcePageInputs/ResourceSwitchInput.tsx @@ -11,7 +11,7 @@ type ResourceSwitchInputProps = { /** * The description of the switch */ - description: string; + description?: string; /** * The value in the switch */ @@ -63,9 +63,11 @@ export const ResourceSwitchInput = ({ - - {description} - + {description && ( + + {description} + + )}
setTranslationType('none')} onChange={(isChecked: boolean) => handleSave({ ...resourceData, delegable: isChecked })} @@ -175,6 +174,7 @@ export const AboutResourcePage = ({ description={t('resourceadm.about_resource_rights_description_text')} translationDescription={t('resourceadm.about_resource_translation_right_description')} isTranslationPanelOpen={translationType === 'rightDescription'} + useTextArea value={resourceData.rightDescription} onFocus={() => setTranslationType('rightDescription')} onBlur={(translations: SupportedLanguage) => @@ -199,7 +199,6 @@ export const AboutResourcePage = ({ /> Date: Wed, 8 May 2024 09:14:26 +0200 Subject: [PATCH 07/11] Studio native select (#12778) * Implement StudioNativeSelect * clean up * clean up * clean up * wrapping component in div --- .../StudioNativeSelect/StudioNativeSelect.mdx | 14 ++++++ .../StudioNativeSelect.module.css | 3 ++ .../StudioNativeSelect.stories.tsx | 30 ++++++++++++ .../StudioNativeSelect.test.tsx | 32 +++++++++++++ .../StudioNativeSelect/StudioNativeSelect.tsx | 47 +++++++++++++++++++ .../components/StudioNativeSelect/index.ts | 1 + .../studio-components/src/components/index.ts | 1 + 7 files changed, 128 insertions(+) create mode 100644 frontend/libs/studio-components/src/components/StudioNativeSelect/StudioNativeSelect.mdx create mode 100644 frontend/libs/studio-components/src/components/StudioNativeSelect/StudioNativeSelect.module.css create mode 100644 frontend/libs/studio-components/src/components/StudioNativeSelect/StudioNativeSelect.stories.tsx create mode 100644 frontend/libs/studio-components/src/components/StudioNativeSelect/StudioNativeSelect.test.tsx create mode 100644 frontend/libs/studio-components/src/components/StudioNativeSelect/StudioNativeSelect.tsx create mode 100644 frontend/libs/studio-components/src/components/StudioNativeSelect/index.ts diff --git a/frontend/libs/studio-components/src/components/StudioNativeSelect/StudioNativeSelect.mdx b/frontend/libs/studio-components/src/components/StudioNativeSelect/StudioNativeSelect.mdx new file mode 100644 index 00000000000..dc8bf03da74 --- /dev/null +++ b/frontend/libs/studio-components/src/components/StudioNativeSelect/StudioNativeSelect.mdx @@ -0,0 +1,14 @@ +import { Canvas, Meta } from '@storybook/blocks'; +import { Heading, Paragraph } from '@digdir/design-system-react'; +import * as StudioNativeSelectStories from './StudioNativeSelect.stories'; + + + + + StudioNativeSelect + + + StudioNativeSelect is an extension of the digdir-designsystemet `NativeSelect`. + + + diff --git a/frontend/libs/studio-components/src/components/StudioNativeSelect/StudioNativeSelect.module.css b/frontend/libs/studio-components/src/components/StudioNativeSelect/StudioNativeSelect.module.css new file mode 100644 index 00000000000..ced97f4a2ca --- /dev/null +++ b/frontend/libs/studio-components/src/components/StudioNativeSelect/StudioNativeSelect.module.css @@ -0,0 +1,3 @@ +.studioNativeSelectDescription { + margin-bottom: var(--fds-spacing-2); +} diff --git a/frontend/libs/studio-components/src/components/StudioNativeSelect/StudioNativeSelect.stories.tsx b/frontend/libs/studio-components/src/components/StudioNativeSelect/StudioNativeSelect.stories.tsx new file mode 100644 index 00000000000..4c263485510 --- /dev/null +++ b/frontend/libs/studio-components/src/components/StudioNativeSelect/StudioNativeSelect.stories.tsx @@ -0,0 +1,30 @@ +import React from 'react'; +import type { Meta, StoryFn } from '@storybook/react'; +import { StudioNativeSelect } from './StudioNativeSelect'; + +type Story = StoryFn; + +const meta: Meta = { + title: 'Studio/StudioNativeSelect', + component: StudioNativeSelect, + argTypes: { + size: { + control: 'radio', + options: ['xsmall', 'small', 'medium', 'large'], + }, + }, +}; +export const Preview: Story = (args): React.ReactElement => ( + + + + + +); + +Preview.args = { + label: 'Label', + description: 'This is a description', + size: 'medium', +}; +export default meta; diff --git a/frontend/libs/studio-components/src/components/StudioNativeSelect/StudioNativeSelect.test.tsx b/frontend/libs/studio-components/src/components/StudioNativeSelect/StudioNativeSelect.test.tsx new file mode 100644 index 00000000000..41fb4df3b06 --- /dev/null +++ b/frontend/libs/studio-components/src/components/StudioNativeSelect/StudioNativeSelect.test.tsx @@ -0,0 +1,32 @@ +import React from 'react'; +import { render, screen } from '@testing-library/react'; +import { StudioNativeSelect, type StudioNativeSelectProps } from './StudioNativeSelect'; + +const mockLabel: string = 'Select label'; +const mockDescription: string = 'Description'; +const mockId: string = 'select-id'; +const defaultProps: StudioNativeSelectProps = { + id: mockId, + label: mockLabel, +}; + +describe('StudioNativeSelect', () => { + afterEach(jest.clearAllMocks); + + it('adds description and aria-describedby attribute when description is present', () => { + render(); + + const descriptionElement = screen.getByText(mockDescription); + expect(descriptionElement).toBeInTheDocument(); + + const select = screen.getByLabelText(mockLabel); + expect(select).toHaveAttribute('aria-describedby', 'studio-native-select-description'); + }); + + it('does not add aria-describedby attribute when description is not provided', () => { + render(); + + const select = screen.getByLabelText(mockLabel); + expect(select).not.toHaveAttribute('aria-describedby', 'studio-native-select-description'); + }); +}); diff --git a/frontend/libs/studio-components/src/components/StudioNativeSelect/StudioNativeSelect.tsx b/frontend/libs/studio-components/src/components/StudioNativeSelect/StudioNativeSelect.tsx new file mode 100644 index 00000000000..26e436d984e --- /dev/null +++ b/frontend/libs/studio-components/src/components/StudioNativeSelect/StudioNativeSelect.tsx @@ -0,0 +1,47 @@ +import React, { forwardRef } from 'react'; +import classes from './StudioNativeSelect.module.css'; +import { + Label, + Paragraph, + NativeSelect, + type NativeSelectProps, +} from '@digdir/design-system-react'; + +export type StudioNativeSelectProps = { + description?: string; +} & Omit; + +//TODO - Add label and description to NativeSelect when this issue is solved in the design system: https://github.com/Altinn/altinn-studio/issues/12725 +export const StudioNativeSelect = forwardRef( + ({ children, description, label, id, size, ...rest }, ref): React.JSX.Element => { + return ( +
+ + {description && ( + + {description} + + )} + + {children} + +
+ ); + }, +); + +StudioNativeSelect.displayName = 'StudioNativeSelect'; diff --git a/frontend/libs/studio-components/src/components/StudioNativeSelect/index.ts b/frontend/libs/studio-components/src/components/StudioNativeSelect/index.ts new file mode 100644 index 00000000000..d7cbd872cfa --- /dev/null +++ b/frontend/libs/studio-components/src/components/StudioNativeSelect/index.ts @@ -0,0 +1 @@ +export { StudioNativeSelect } from './StudioNativeSelect'; diff --git a/frontend/libs/studio-components/src/components/index.ts b/frontend/libs/studio-components/src/components/index.ts index 1b8ae3da58b..04625e7e136 100644 --- a/frontend/libs/studio-components/src/components/index.ts +++ b/frontend/libs/studio-components/src/components/index.ts @@ -13,6 +13,7 @@ export * from './StudioIconTextfield'; export * from './StudioLabelAsParagraph'; export * from './StudioLabelWrapper'; export * from './StudioModal'; +export * from './StudioNativeSelect'; export * from './StudioNotFoundPage'; export * from './StudioPageSpinner'; export * from './StudioProperty'; From 297698216fe6c16c295bb8f1d19d9f6d29d925ce Mon Sep 17 00:00:00 2001 From: Ivar Nesje Date: Wed, 8 May 2024 10:09:31 +0200 Subject: [PATCH 08/11] Improve data model generation (#12734) * Update test infrastructure * Update baseline for datamodels to what they actually equals. * Add #nullable dissable to generated models * Rewrite model codegen without changing output * Add support for generating classes with nullable reference types. * Add code for generating a hack with [XmlText] and nullable properties * Activate XmlTextValueNullableHack and AddShouldSerializeForTagContent * Use arrow function for `ShouldSerialize*()` * Run dotnet format * Fix failing test * Add test case --- .../Csharp/CSharpGenerationSettings.cs | 15 + .../DataModeling/Converter/Csharp/Compiler.cs | 15 +- .../Csharp/CsharpCompilationException.cs | 2 +- .../Csharp/JsonMetadataToCsharpConverter.cs | 148 +- .../IModelMetadataToCsharpConverter.cs | 3 +- .../Implementation/ModelNameValidator.cs | 2 +- .../Implementation/SchemaModelService.cs | 2 +- .../Assertions/TypeAssertions.cs | 9 +- .../CsharpModelConversionTestsBase.cs | 2 +- .../CsharpEnd2EndGenerationTests.cs | 20 +- .../TestDataClasses/CSharpEnd2EndTestData.cs | 2 + .../TestDataClasses/ValidationTestData.cs | 1 + .../DataModelsController/PutDatamodelTests.cs | 2 +- .../Services/SchemaModelServiceTests.cs | 2 +- .../SharedResourcesHelper.cs | 5 + testdata/Model/CSharp/Gitea/3422-39646.cs | 9605 +++++++++++++++++ testdata/Model/CSharp/Gitea/3430-39615.cs | 542 + ...undregistrene_ReelleRettighetshavere_M.cs" | 140 +- ...\270kkel_M_2020-05-26_5702_34556_SERES.cs" | 8 +- ...303\245r_M_2020-05-25_5704_34554_SERES.cs" | 8 +- ...nesteeier_M_2020-05-25_5703_34553_SERES.cs | 8 +- testdata/Model/CSharp/Gitea/aal-vedlegg.cs | 2 +- testdata/Model/CSharp/Gitea/bokskjema.cs | 75 +- .../Gitea/dat-aarligmelding-bemanning.cs | 2 +- .../Model/CSharp/Gitea/dat-bilpleie-soknad.cs | 89 +- testdata/Model/CSharp/Gitea/dat-skjema.cs | 24 +- testdata/Model/CSharp/Gitea/dev-nill-test.cs | 92 +- .../dihe-redusert-foreldrebetaling-bhg.cs | 73 +- testdata/Model/CSharp/Gitea/hi-algeskjema.cs | 91 +- testdata/Model/CSharp/Gitea/krt-1188a-1.cs | 118 +- testdata/Model/CSharp/Gitea/nbib-melding.cs | 2 +- .../CSharp/Gitea/nsm-klareringsportalen.cs | 210 +- .../skd-formueinntekt-skattemelding-v2.cs | 2 +- testdata/Model/CSharp/Gitea/skjema.cs | 34 +- .../CSharp/Gitea/srf-fufinn-behovsendring.cs | 2 +- .../Gitea/srf-fufinn-behovskartleggin.cs | 2 +- .../Gitea/srf-melding-til-statsforvalteren.cs | 2 +- .../Gitea/stami-atid-databehandler-2022.cs | 2 +- .../CSharp/Gitea/stami-mu-bestilling-2021.cs | 2 +- .../Gitea/stami-mu-databehandler-2021.cs | 2 +- .../udi-unntak-karantenehotell-velferd.cs | 2 +- .../CSharp/Gitea/udir-invitasjon-vfkl.cs | 2 +- testdata/Model/CSharp/Gitea/udir-vfkl.cs | 2 +- testdata/Model/XmlSchema/Gitea/3422-39646.xsd | 5095 +++++++++ testdata/Model/XmlSchema/Gitea/3430-39615.xsd | 456 + 45 files changed, 16286 insertions(+), 638 deletions(-) create mode 100644 testdata/Model/CSharp/Gitea/3422-39646.cs create mode 100644 testdata/Model/CSharp/Gitea/3430-39615.cs create mode 100644 testdata/Model/XmlSchema/Gitea/3422-39646.xsd create mode 100644 testdata/Model/XmlSchema/Gitea/3430-39615.xsd diff --git a/backend/src/DataModeling/Converter/Csharp/CSharpGenerationSettings.cs b/backend/src/DataModeling/Converter/Csharp/CSharpGenerationSettings.cs index 87009988f2b..a7538d18f34 100644 --- a/backend/src/DataModeling/Converter/Csharp/CSharpGenerationSettings.cs +++ b/backend/src/DataModeling/Converter/Csharp/CSharpGenerationSettings.cs @@ -5,5 +5,20 @@ public class CSharpGenerationSettings public int IndentSize { get; set; } = 2; public string ModelNamespace { get; set; } = "Altinn.App.Models"; + + /// + /// Create two properties on [XmlText] elements + /// one called value that is used by xml serialization + /// and one called valueNullable for json serialization. + /// + /// The valueNullable property also used in a `ShouldSerialize` method + /// on the parent element + /// + public bool XmlTextValueNullableHack { get; set; } = true; + + /// + /// Add a ShouldSerialize method for to the parent property for [XmlText] elements when all attibutes are fixed + /// + public bool AddShouldSerializeForTagContent { get; set; } = true; } } diff --git a/backend/src/DataModeling/Converter/Csharp/Compiler.cs b/backend/src/DataModeling/Converter/Csharp/Compiler.cs index a83b5cb9930..2a4ee761e34 100644 --- a/backend/src/DataModeling/Converter/Csharp/Compiler.cs +++ b/backend/src/DataModeling/Converter/Csharp/Compiler.cs @@ -38,16 +38,17 @@ public static Assembly CompileToAssembly(string csharpCode) { EmitResult result = compilation.Emit(ms); - if (!result.Success) + var ignoredDiagnostics = new[] + { + "CS8019", // CS8019: Unnecessary using directive. + }; + var diagnostics = result.Diagnostics.Where(d => !ignoredDiagnostics.Contains(d.Descriptor.Id)).ToArray(); + if (diagnostics.Any()) { - IEnumerable failures = result.Diagnostics.Where(diagnostic => - diagnostic.IsWarningAsError || - diagnostic.Severity == DiagnosticSeverity.Error); - List customErrorMessages = new(); - foreach (Diagnostic diagnostic in failures) + foreach (Diagnostic diagnostic in diagnostics) { - customErrorMessages.Add(diagnostic.GetMessage()); + customErrorMessages.Add(diagnostic.Id + "" + diagnostic.GetMessage() + csharpCode[(diagnostic.Location.SourceSpan.Start - 10)..(diagnostic.Location.SourceSpan.End + 10)]); } throw new CsharpCompilationException("Csharp compilation failed.", customErrorMessages); diff --git a/backend/src/DataModeling/Converter/Csharp/CsharpCompilationException.cs b/backend/src/DataModeling/Converter/Csharp/CsharpCompilationException.cs index 9653be6a0e1..ad4aa41b902 100644 --- a/backend/src/DataModeling/Converter/Csharp/CsharpCompilationException.cs +++ b/backend/src/DataModeling/Converter/Csharp/CsharpCompilationException.cs @@ -9,7 +9,7 @@ public class CsharpCompilationException : Exception public List CustomErrorMessages { get; } /// - public CsharpCompilationException(string message, List customErrorMessages) : base(message) + public CsharpCompilationException(string message, List customErrorMessages) : base(message + "\n\n" + string.Join("\n", customErrorMessages)) { CustomErrorMessages = customErrorMessages; } diff --git a/backend/src/DataModeling/Converter/Csharp/JsonMetadataToCsharpConverter.cs b/backend/src/DataModeling/Converter/Csharp/JsonMetadataToCsharpConverter.cs index a88d9c48adc..c2bc71b3ea1 100644 --- a/backend/src/DataModeling/Converter/Csharp/JsonMetadataToCsharpConverter.cs +++ b/backend/src/DataModeling/Converter/Csharp/JsonMetadataToCsharpConverter.cs @@ -22,7 +22,7 @@ public JsonMetadataToCsharpConverter(CSharpGenerationSettings generationSettings private string Indent(int level = 1) => new string(' ', level * _generationSettings.IndentSize); /// - public string CreateModelFromMetadata(ModelMetadata serviceMetadata, bool separateNamespaces = false) + public string CreateModelFromMetadata(ModelMetadata serviceMetadata, bool separateNamespaces, bool useNullableReferenceTypes) { Dictionary classes = new(); @@ -31,10 +31,18 @@ public string CreateModelFromMetadata(ModelMetadata serviceMetadata, bool separa (separateNamespaces ? $".{rootElementType.TypeName}" : string.Empty); - CreateModelFromMetadataRecursive(classes, rootElementType, serviceMetadata, serviceMetadata.TargetNamespace); + CreateModelFromMetadataRecursive(classes, rootElementType, serviceMetadata, serviceMetadata.TargetNamespace, useNullableReferenceTypes); - StringBuilder writer = new StringBuilder() - .AppendLine("using System;") + StringBuilder writer = new StringBuilder(); + if (useNullableReferenceTypes) + { + writer.AppendLine("#nullable enable"); + } + else + { + writer.AppendLine("#nullable disable"); + } + writer.AppendLine("using System;") .AppendLine("using System.Collections.Generic;") .AppendLine("using System.ComponentModel.DataAnnotations;") .AppendLine("using System.Linq;") @@ -61,7 +69,8 @@ public string CreateModelFromMetadata(ModelMetadata serviceMetadata, bool separa /// The parent Element /// Model metadata /// Target namespace in xsd schema. - private void CreateModelFromMetadataRecursive(Dictionary classes, ElementMetadata parentElement, ModelMetadata serviceMetadata, string targetNamespace = null) + /// wheter to add nullable? to reference types + private void CreateModelFromMetadataRecursive(Dictionary classes, ElementMetadata parentElement, ModelMetadata serviceMetadata, string targetNamespace, bool useNullableReferenceTypes) { List referredTypes = new List(); @@ -102,15 +111,15 @@ private void CreateModelFromMetadataRecursive(Dictionary classes if (element.Type == ElementType.Field) { - ParseFieldProperty(element, classBuilder, ref elementOrder, required); + ParseFieldProperty(element, classBuilder, ref elementOrder, required, useNullableReferenceTypes); } else if (element.Type == ElementType.Group) { - ParseGroupProperty(element, classBuilder, referredTypes, ref elementOrder); + ParseGroupProperty(element, classBuilder, serviceMetadata, referredTypes, ref elementOrder, useNullableReferenceTypes); } else if (element.Type == ElementType.Attribute) { - ParseAttributeProperty(element, classBuilder, required); + ParseAttributeProperty(element, classBuilder, required, useNullableReferenceTypes); } } @@ -123,18 +132,52 @@ private void CreateModelFromMetadataRecursive(Dictionary classes foreach (ElementMetadata refType in referredTypes) { - CreateModelFromMetadataRecursive(classes, refType, serviceMetadata); + CreateModelFromMetadataRecursive(classes, refType, serviceMetadata, targetNamespace: null, useNullableReferenceTypes); } } - private void ParseFieldProperty(ElementMetadata element, StringBuilder classBuilder, ref int elementOrder, bool required) + private void ParseFieldProperty(ElementMetadata element, StringBuilder classBuilder, ref int elementOrder, bool required, bool useNullableReferenceTypes) { + string nullableReference = useNullableReferenceTypes ? "?" : string.Empty; (string dataType, bool isValueType) = GetPropertyType(element.XsdValueType); WriteRestrictionAnnotations(classBuilder, element); - if (element.IsTagContent) + + // [XmlText] properties can't be nullable value types, so we need a hack so that they behave as if nullable works. + if (_generationSettings.XmlTextValueNullableHack && element.IsTagContent && isValueType) + { + if (required) + { + classBuilder.AppendLine(Indent(2) + "[Required]"); + } + classBuilder.AppendLine(Indent(2) + "[XmlIgnore]"); + classBuilder.AppendLine(Indent(2) + "[JsonPropertyName(\"value\")]"); + classBuilder.AppendLine(Indent(2) + "[JsonProperty(PropertyName = \"value\")]"); + classBuilder.AppendLine($"{Indent(2)}public {dataType}? valueNullable {{ get; set; }}"); + classBuilder.AppendLine(); + + classBuilder.AppendLine(Indent(2) + "[XmlText]"); + classBuilder.AppendLine(Indent(2) + "[System.Text.Json.Serialization.JsonIgnore]"); + classBuilder.AppendLine(Indent(2) + "[Newtonsoft.Json.JsonIgnore]"); + classBuilder.AppendLine(Indent(2) + "public " + dataType + " value"); + classBuilder.AppendLine(Indent(2) + "{"); + classBuilder.AppendLine(Indent(3) + "get => valueNullable ?? default;"); + classBuilder.AppendLine(Indent(3) + "set"); + classBuilder.AppendLine(Indent(3) + "{"); + classBuilder.AppendLine(Indent(4) + "this.valueNullable = value;"); + classBuilder.AppendLine(Indent(3) + "}"); + classBuilder.AppendLine(Indent(2) + "}"); + classBuilder.AppendLine(); + } + else if (element.IsTagContent) { classBuilder.AppendLine(Indent(2) + "[XmlText()]"); + if (required && isValueType) // Why [Required] only on value types? + { + classBuilder.AppendLine(Indent(2) + "[Required]"); + } + classBuilder.AppendLine($"{Indent(2)}public {dataType}{nullableReference} value {{ get; set; }}"); + classBuilder.AppendLine(); } else { @@ -145,30 +188,39 @@ private void ParseFieldProperty(ElementMetadata element, StringBuilder classBuil // deserialization, we need both JsonProperty and JsonPropertyName annotations. classBuilder.AppendLine(Indent(2) + "[JsonProperty(\"" + element.XName + "\")]"); classBuilder.AppendLine(Indent(2) + "[JsonPropertyName(\"" + element.XName + "\")]"); - } - if (element.MaxOccurs > 1) - { - classBuilder.AppendLine(Indent(2) + "public List<" + dataType + "> " + element.Name + " { get; set; }\n"); - } - else - { - if (required && isValueType) + if (element.MaxOccurs > 1) { - classBuilder.AppendLine(Indent(2) + "[Required]"); + classBuilder.AppendLine($"{Indent(2)}public List<{dataType}>{nullableReference} {element.Name} {{ get; set; }}\n"); } - - bool shouldBeNullable = isValueType && !element.IsTagContent; // Can't use complex type for XmlText. - classBuilder.AppendLine(Indent(2) + "public " + dataType + (shouldBeNullable ? "?" : string.Empty) + " " + element.Name + " { get; set; }\n"); - if (shouldBeNullable && element.Nillable.HasValue && !element.Nillable.Value && element.MinOccurs == 0) + else { - WriteShouldSerializeMethod(classBuilder, element.Name); + if (required && isValueType) + { + classBuilder.AppendLine(Indent(2) + "[Required]"); + } + + + if (isValueType) + { + classBuilder.AppendLine($"{Indent(2)}public {dataType}? {element.Name} {{ get; set; }}\n"); + + if (element.Nillable.HasValue && !element.Nillable.Value && element.MinOccurs == 0) + { + WriteShouldSerializeMethod(classBuilder, element.Name); + } + } + else + { + classBuilder.AppendLine($"{Indent(2)}public {dataType}{nullableReference} {element.Name} {{ get; set; }}\n"); + } } } } - private void ParseGroupProperty(ElementMetadata element, StringBuilder classBuilder, List referredTypes, ref int elementOrder) + private void ParseGroupProperty(ElementMetadata element, StringBuilder classBuilder, ModelMetadata modelMetadata, List referredTypes, ref int elementOrder, bool useNullableReferenceTypes) { + var nullableReference = useNullableReferenceTypes ? "?" : string.Empty; WriteRestrictionAnnotations(classBuilder, element); elementOrder += 1; classBuilder.AppendLine(Indent(2) + "[XmlElement(\"" + element.XName + "\", Order = " + elementOrder + ")]"); @@ -195,11 +247,16 @@ private void ParseGroupProperty(ElementMetadata element, StringBuilder classBuil if (element.MaxOccurs > 1) { - classBuilder.AppendLine(Indent(2) + "public List<" + dataType + "> " + element.Name + " { get; set; }\n"); + classBuilder.AppendLine($"{Indent(2)}public List<{dataType}>{nullableReference} {element.Name} {{ get; set; }}\n"); } else { - classBuilder.AppendLine(Indent(2) + "public " + dataType + " " + element.Name + " { get; set; }\n"); + classBuilder.AppendLine($"{Indent(2)}public {dataType}{nullableReference} {element.Name} {{ get; set; }}\n"); + + if (_generationSettings.AddShouldSerializeForTagContent) + { + AddShouldSerializeForTagContent(element, classBuilder, modelMetadata); + } } if (!primitiveType) @@ -208,8 +265,26 @@ private void ParseGroupProperty(ElementMetadata element, StringBuilder classBuil } } - private void ParseAttributeProperty(ElementMetadata element, StringBuilder classBuilder, bool required) + private void AddShouldSerializeForTagContent(ElementMetadata element, StringBuilder classBuilder, ModelMetadata modelMetadata) + { + var children = modelMetadata.Elements.Values.Where(metadata => + metadata.ParentElement == element.ID); + if (children.Count(metadata => metadata.FixedValue != null) == 1 && children.Count(metadata => metadata.IsTagContent) == 1) + { + var taggedContentChild = children.Single(metadata => metadata.IsTagContent); + var value = _generationSettings.XmlTextValueNullableHack && taggedContentChild.XsdValueType.HasValue && + GetPropertyType(taggedContentChild.XsdValueType).IsValueType + ? "valueNullable is not null" + : "value is not null"; + + classBuilder.AppendLine($"{Indent(2)}public bool ShouldSerialize{element.Name}() => {element.Name}?.{value};"); + classBuilder.AppendLine(); + } + } + + private void ParseAttributeProperty(ElementMetadata element, StringBuilder classBuilder, bool required, bool useNullableReferenceTypes) { + string nullableReference = useNullableReferenceTypes ? "?" : string.Empty; string dataType = "string"; bool isValueType = false; if (element.XsdValueType != null) @@ -225,7 +300,8 @@ private void ParseAttributeProperty(ElementMetadata element, StringBuilder class classBuilder.AppendLine(Indent(2) + "[BindNever]"); if (dataType.Equals("string")) { - classBuilder.AppendLine(Indent(2) + "public " + dataType + " " + element.Name + " { get; set; } = \"" + element.FixedValue + "\";\n"); + classBuilder.AppendLine( + $"{Indent(2)}public {dataType} {element.Name} {{ get; set; }} = \"{element.FixedValue}\";\n"); } else { @@ -238,7 +314,7 @@ private void ParseAttributeProperty(ElementMetadata element, StringBuilder class { classBuilder.AppendLine(Indent(2) + "[Required]"); } - classBuilder.AppendLine(Indent(2) + "public " + dataType + " " + element.Name + " { get; set; }\n"); + classBuilder.AppendLine($"{Indent(2)}public {dataType}{nullableReference} {element.Name} {{ get; set; }}\n"); } } @@ -448,10 +524,7 @@ or BaseValueType.Date /// private void WriteShouldSerializeMethod(StringBuilder classBuilder, string propName) { - classBuilder.AppendLine(Indent(2) + $"public bool ShouldSerialize{propName}()"); - classBuilder.AppendLine(Indent(2) + "{"); - classBuilder.AppendLine(Indent(3) + $"return {propName}.HasValue;"); - classBuilder.AppendLine(Indent(2) + "}"); + classBuilder.AppendLine(Indent(2) + $"public bool ShouldSerialize{propName}() => {propName}.HasValue;"); classBuilder.AppendLine(); } @@ -468,10 +541,7 @@ private void WriteAltinnRowId(StringBuilder classBuilder) classBuilder.AppendLine(Indent(2) + "[Newtonsoft.Json.JsonIgnore]"); classBuilder.AppendLine(Indent(2) + "public Guid AltinnRowId { get; set; }"); classBuilder.AppendLine(""); - classBuilder.AppendLine(Indent(2) + "public bool ShouldSerializeAltinnRowId()"); - classBuilder.AppendLine(Indent(2) + "{"); - classBuilder.AppendLine(Indent(3) + "return AltinnRowId != default;"); - classBuilder.AppendLine(Indent(2) + "}"); + classBuilder.AppendLine(Indent(2) + "public bool ShouldSerializeAltinnRowId() => AltinnRowId != default;"); classBuilder.AppendLine(); } } diff --git a/backend/src/DataModeling/Converter/Interfaces/IModelMetadataToCsharpConverter.cs b/backend/src/DataModeling/Converter/Interfaces/IModelMetadataToCsharpConverter.cs index 8397dd96b52..f509eed0a61 100644 --- a/backend/src/DataModeling/Converter/Interfaces/IModelMetadataToCsharpConverter.cs +++ b/backend/src/DataModeling/Converter/Interfaces/IModelMetadataToCsharpConverter.cs @@ -9,7 +9,8 @@ public interface IModelMetadataToCsharpConverter /// /// ServiceMetadata object /// Indicates if models should be stored in the separate namespace. + /// Whether to add nullable? to reference types /// The model code in C# - public string CreateModelFromMetadata(ModelMetadata serviceMetadata, bool separateNamespaces = false); + public string CreateModelFromMetadata(ModelMetadata serviceMetadata, bool separateNamespaces, bool useNullableReferenceTypes); } } diff --git a/backend/src/Designer/Services/Implementation/ModelNameValidator.cs b/backend/src/Designer/Services/Implementation/ModelNameValidator.cs index d927ac86b6d..c0b6caa6ed7 100644 --- a/backend/src/Designer/Services/Implementation/ModelNameValidator.cs +++ b/backend/src/Designer/Services/Implementation/ModelNameValidator.cs @@ -78,7 +78,7 @@ private ModelMetadata TestE2EConversion(Stream xsdSchema) var jsonSchemaConverterStrategy = JsonSchemaConverterStrategyFactory.SelectStrategy(jsonSchema); var metamodelConverter = new JsonSchemaToMetamodelConverter(jsonSchemaConverterStrategy.GetAnalyzer()); var modelMetadata = metamodelConverter.Convert(SerializeJsonSchema(jsonSchema)); - _modelMetadataToCsharpConverter.CreateModelFromMetadata(modelMetadata); + _modelMetadataToCsharpConverter.CreateModelFromMetadata(modelMetadata, separateNamespaces: false, useNullableReferenceTypes: false); return modelMetadata; } diff --git a/backend/src/Designer/Services/Implementation/SchemaModelService.cs b/backend/src/Designer/Services/Implementation/SchemaModelService.cs index bed9abd511e..4aaf7b7d869 100644 --- a/backend/src/Designer/Services/Implementation/SchemaModelService.cs +++ b/backend/src/Designer/Services/Implementation/SchemaModelService.cs @@ -310,7 +310,7 @@ private async Task UpdateCSharpClasses(AltinnAppGitRepository altinnAppG string modelName = modelMetadata.GetRootElement().TypeName; bool separateNamespace = !application.DataTypes.Any(d => d.AppLogic?.ClassRef == $"Altinn.App.Models.{modelName}"); - string csharpClasses = _modelMetadataToCsharpConverter.CreateModelFromMetadata(modelMetadata, separateNamespace); + string csharpClasses = _modelMetadataToCsharpConverter.CreateModelFromMetadata(modelMetadata, separateNamespace, useNullableReferenceTypes: false); await altinnAppGitRepository.SaveCSharpClasses(csharpClasses, schemaName); return separateNamespace ? $"Altinn.App.Models.{modelName}.{modelName}" : $"Altinn.App.Models.{modelName}"; } diff --git a/backend/tests/DataModeling.Tests/Assertions/TypeAssertions.cs b/backend/tests/DataModeling.Tests/Assertions/TypeAssertions.cs index 6bcc0548639..4bb5247c58f 100644 --- a/backend/tests/DataModeling.Tests/Assertions/TypeAssertions.cs +++ b/backend/tests/DataModeling.Tests/Assertions/TypeAssertions.cs @@ -83,12 +83,9 @@ private static void IsEquivalentTo(PropertyInfo expected, PropertyInfo actual) private static void IsEquivalentTo(IEnumerable expected, IEnumerable actual) { - expected.Count().Should().Be(actual.Count()); - - foreach (var item in expected) - { - Assert.Single(actual.Where(x => x.ToString() == item.ToString())); - } + var expectedStrings = expected.Select(e => e.ToString()); + var actualStrings = actual.Select(a => a.ToString()); + expectedStrings.Should().BeEquivalentTo(actualStrings); } private static void IsEquivalentTo(TypeAttributes expected, TypeAttributes actual) diff --git a/backend/tests/DataModeling.Tests/BaseClasses/CsharpModelConversionTestsBase.cs b/backend/tests/DataModeling.Tests/BaseClasses/CsharpModelConversionTestsBase.cs index b6c440c15ba..dec78df5716 100644 --- a/backend/tests/DataModeling.Tests/BaseClasses/CsharpModelConversionTestsBase.cs +++ b/backend/tests/DataModeling.Tests/BaseClasses/CsharpModelConversionTestsBase.cs @@ -65,7 +65,7 @@ protected TTestType ModelMetadataLoaded(string jsonSchemaPath) protected TTestType ModelMetadataConvertedToCsharpClass() { - CSharpClasses = new JsonMetadataToCsharpConverter(new CSharpGenerationSettings()).CreateModelFromMetadata(ModelMetadata); + CSharpClasses = new JsonMetadataToCsharpConverter(new CSharpGenerationSettings()).CreateModelFromMetadata(ModelMetadata, separateNamespaces: false, useNullableReferenceTypes: false); return this as TTestType; } diff --git a/backend/tests/DataModeling.Tests/CsharpEnd2EndGenerationTests.cs b/backend/tests/DataModeling.Tests/CsharpEnd2EndGenerationTests.cs index 692ea8f6323..2194ab689cc 100644 --- a/backend/tests/DataModeling.Tests/CsharpEnd2EndGenerationTests.cs +++ b/backend/tests/DataModeling.Tests/CsharpEnd2EndGenerationTests.cs @@ -1,4 +1,5 @@ -using System.Linq; +using System.IO; +using System.Linq; using System.Xml.Serialization; using Altinn.Studio.DataModeling.Converter.Csharp; using DataModeling.Tests.Assertions; @@ -8,11 +9,19 @@ using FluentAssertions; using SharedResources.Tests; using Xunit; +using Xunit.Abstractions; namespace DataModeling.Tests { public class CsharpEnd2EndGenerationTests : CsharpModelConversionTestsBase { + private readonly ITestOutputHelper _testOutput; + + public CsharpEnd2EndGenerationTests(ITestOutputHelper testOutput) + { + _testOutput = testOutput; + } + [Theory] [ClassData(typeof(CSharpEnd2EndTestData))] public void Convert_FromXsd_Should_EqualExpected(string xsdSchemaPath, string expectedCsharpClassPath) @@ -61,6 +70,15 @@ public void JsonSchemaShouldConvertToXsdAndCSharp(string jsonSchemaPath, params private void GeneratedClassesShouldBeEquivalentToExpected(string expectedCsharpClassPath) { string expectedClasses = SharedResourcesHelper.LoadTestDataAsString(expectedCsharpClassPath); + + _testOutput.WriteLine("Expected classes"); + _testOutput.WriteLine(expectedClasses); + _testOutput.WriteLine("Generated classes"); + _testOutput.WriteLine(CSharpClasses); + + // Save the current generated classes to the expected file so they can be compared with git diff. + SharedResourcesHelper.WriteUpdatedTestData(expectedCsharpClassPath, CSharpClasses); + var expectedAssembly = Compiler.CompileToAssembly(expectedClasses); // Compare root types. diff --git a/backend/tests/DataModeling.Tests/TestDataClasses/CSharpEnd2EndTestData.cs b/backend/tests/DataModeling.Tests/TestDataClasses/CSharpEnd2EndTestData.cs index 98bd90cbcd2..7667f6f2d85 100644 --- a/backend/tests/DataModeling.Tests/TestDataClasses/CSharpEnd2EndTestData.cs +++ b/backend/tests/DataModeling.Tests/TestDataClasses/CSharpEnd2EndTestData.cs @@ -33,6 +33,8 @@ public IEnumerator GetEnumerator() yield return new object[] { "Model/XmlSchema/Gitea/skd-formueinntekt-skattemelding-v2.xsd", "Model/CSharp/Gitea/skd-formueinntekt-skattemelding-v2.cs" }; yield return new object[] { "Model/XmlSchema/Gitea/aal-vedlegg.xsd", "Model/CSharp/Gitea/aal-vedlegg.cs" }; yield return new object[] { "Model/XmlSchema/Gitea/krt-1188a-1.xsd", "Model/CSharp/Gitea/krt-1188a-1.cs" }; + yield return new object[] { "Model/XmlSchema/Gitea/3422-39646.xsd", "Model/CSharp/Gitea/3422-39646.cs" }; + yield return new object[] { "Model/XmlSchema/Gitea/3430-39615.xsd", "Model/CSharp/Gitea/3430-39615.cs" }; yield return new object[] { "Model/XmlSchema/Gitea/Brønnøysundregistrene_ReelleRettighetshavere_M.xsd", "Model/CSharp/Gitea/Brønnøysundregistrene_ReelleRettighetshavere_M.cs" }; yield return new object[] { "Model/XmlSchema/Gitea/dev-nill-test.xsd", "Model/CSharp/Gitea/dev-nill-test.cs" }; } diff --git a/backend/tests/DataModeling.Tests/TestDataClasses/ValidationTestData.cs b/backend/tests/DataModeling.Tests/TestDataClasses/ValidationTestData.cs index 590c8cf3799..e947b01fcf8 100644 --- a/backend/tests/DataModeling.Tests/TestDataClasses/ValidationTestData.cs +++ b/backend/tests/DataModeling.Tests/TestDataClasses/ValidationTestData.cs @@ -19,6 +19,7 @@ public IEnumerator GetEnumerator() yield return new object[] { "Model/XmlSchema/Gitea/stami-atid-databehandler-2022.xsd" }; yield return new object[] { "Model/XmlSchema/Gitea/stami-mu-databehandler-2021.xsd" }; yield return new object[] { "Model/XmlSchema/Gitea/skd-formueinntekt-skattemelding-v2.xsd" }; + yield return new object[] { "Model/XmlSchema/Gitea/krt-1188a-1.xsd" }; // Can generate non valid date string from regex // yield return new object[] { "Model/XmlSchema/Gitea/hi-algeskjema.xsd" }; diff --git a/backend/tests/Designer.Tests/Controllers/DataModelsController/PutDatamodelTests.cs b/backend/tests/Designer.Tests/Controllers/DataModelsController/PutDatamodelTests.cs index 4842e9d1445..4408ae9e7ac 100644 --- a/backend/tests/Designer.Tests/Controllers/DataModelsController/PutDatamodelTests.cs +++ b/backend/tests/Designer.Tests/Controllers/DataModelsController/PutDatamodelTests.cs @@ -92,7 +92,7 @@ public async Task InvalidInput_ShouldReturn_BadRequest_And_CustomErrorMessages(s customErrorMessages.Should().NotBeNull(); var customErrorMessagesElement = (JsonElement)customErrorMessages; var firstErrorMessage = customErrorMessagesElement.EnumerateArray().FirstOrDefault().GetString(); - firstErrorMessage.Should().Be("'root': member names cannot be the same as their enclosing type"); + firstErrorMessage.Should().Contain("'root': member names cannot be the same as their enclosing type"); } [Theory] diff --git a/backend/tests/Designer.Tests/Services/SchemaModelServiceTests.cs b/backend/tests/Designer.Tests/Services/SchemaModelServiceTests.cs index 954e224a2cd..828851e2d5c 100644 --- a/backend/tests/Designer.Tests/Services/SchemaModelServiceTests.cs +++ b/backend/tests/Designer.Tests/Services/SchemaModelServiceTests.cs @@ -229,7 +229,7 @@ public async Task UpdateSchema_InvalidJsonSchema_ShouldThrowException() }); Assert.NotNull(exception.CustomErrorMessages); - Assert.Equal(new List() { "'root': member names cannot be the same as their enclosing type" }, exception.CustomErrorMessages); + exception.CustomErrorMessages.Should().ContainSingle(c => c.Contains("root': member names cannot be the same as their enclosing type")); } [Theory] diff --git a/backend/tests/SharedResources.Tests/SharedResourcesHelper.cs b/backend/tests/SharedResources.Tests/SharedResourcesHelper.cs index b7ff94b2422..e2c4a92a4c4 100644 --- a/backend/tests/SharedResources.Tests/SharedResourcesHelper.cs +++ b/backend/tests/SharedResources.Tests/SharedResourcesHelper.cs @@ -43,4 +43,9 @@ public static XmlSchema LoadXmlSchemaTestData(string resourceName) return xmlSchema; } + + public static void WriteUpdatedTestData(string resourceName, string cSharpClasses) + { + File.WriteAllText(Path.Join("..", "..", "..", "..", "..", "..", "testdata", resourceName), cSharpClasses); + } } diff --git a/testdata/Model/CSharp/Gitea/3422-39646.cs b/testdata/Model/CSharp/Gitea/3422-39646.cs new file mode 100644 index 00000000000..950739ac849 --- /dev/null +++ b/testdata/Model/CSharp/Gitea/3422-39646.cs @@ -0,0 +1,9605 @@ +#nullable disable +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using System.Linq; +using System.Text.Json.Serialization; +using System.Xml.Serialization; +using Microsoft.AspNetCore.Mvc.ModelBinding; +using Newtonsoft.Json; +namespace Altinn.App.Models +{ + [XmlRoot(ElementName="melding")] + public class RR0010U_M + { + [XmlAttribute("dataFormatProvider")] + [BindNever] + public string dataFormatProvider { get; set; } = "SERES"; + + [XmlAttribute("dataFormatId")] + [BindNever] + public string dataFormatId { get; set; } = "3422"; + + [XmlAttribute("dataFormatVersion")] + [BindNever] + public string dataFormatVersion { get; set; } = "48706"; + + [XmlElement("Rapport-RR0010U", Order = 1)] + [JsonProperty("Rapport-RR0010U")] + [JsonPropertyName("Rapport-RR0010U")] + public RapportRR0010U RapportRR0010U { get; set; } + + [XmlElement("Skjemainnhold", Order = 2)] + [JsonProperty("Skjemainnhold")] + [JsonPropertyName("Skjemainnhold")] + public Skjemainnhold Skjemainnhold { get; set; } + + } + + public class RapportRR0010U + { + [XmlElement("aarsregnskap", Order = 1)] + [JsonProperty("aarsregnskap")] + [JsonPropertyName("aarsregnskap")] + public Aarsregnskap aarsregnskap { get; set; } + + } + + public class Aarsregnskap + { + [XmlElement("type", Order = 1)] + [JsonProperty("type")] + [JsonPropertyName("type")] + public ArsregnskapType25942 type { get; set; } + + public bool ShouldSerializetype() => type?.value is not null; + + [XmlElement("valuta", Order = 2)] + [JsonProperty("valuta")] + [JsonPropertyName("valuta")] + public ArsregnskapValutakode34984 valuta { get; set; } + + public bool ShouldSerializevaluta() => valuta?.value is not null; + + [XmlElement("valoer", Order = 3)] + [JsonProperty("valoer")] + [JsonPropertyName("valoer")] + public ArsregnskapValor28974 valoer { get; set; } + + public bool ShouldSerializevaloer() => valoer?.value is not null; + + } + + public class ArsregnskapType25942 + { + [XmlText()] + public string value { get; set; } + + [XmlAttribute("orid")] + [BindNever] + public string orid { get; set; } = "25942"; + + } + + public class ArsregnskapValutakode34984 + { + [XmlText()] + public string value { get; set; } + + [XmlAttribute("orid")] + [BindNever] + public string orid { get; set; } = "34984"; + + } + + public class ArsregnskapValor28974 + { + [XmlText()] + public string value { get; set; } + + [XmlAttribute("orid")] + [BindNever] + public string orid { get; set; } = "28974"; + + } + + public class Skjemainnhold + { + [XmlElement("resultatregnskapAktivitetsbasert", Order = 1)] + [JsonProperty("resultatregnskapAktivitetsbasert")] + [JsonPropertyName("resultatregnskapAktivitetsbasert")] + public ResultatregnskapAktivitetsbasert resultatregnskapAktivitetsbasert { get; set; } + + [XmlElement("balanseEiendelerAnleggsmidler", Order = 2)] + [JsonProperty("balanseEiendelerAnleggsmidler")] + [JsonPropertyName("balanseEiendelerAnleggsmidler")] + public BalanseEiendelerAnleggsmidler balanseEiendelerAnleggsmidler { get; set; } + + [XmlElement("balanseEiendelerOmloepsmidler", Order = 3)] + [JsonProperty("balanseEiendelerOmloepsmidler")] + [JsonPropertyName("balanseEiendelerOmloepsmidler")] + public BalanseEiendelerOmloepsmidler balanseEiendelerOmloepsmidler { get; set; } + + [XmlElement("balanseFormaalskapital", Order = 4)] + [JsonProperty("balanseFormaalskapital")] + [JsonPropertyName("balanseFormaalskapital")] + public BalanseFormaalskapital balanseFormaalskapital { get; set; } + + [XmlElement("balanseGjeld", Order = 5)] + [JsonProperty("balanseGjeld")] + [JsonPropertyName("balanseGjeld")] + public BalanseGjeld balanseGjeld { get; set; } + + [XmlElement("posterUtenomBalansen", Order = 6)] + [JsonProperty("posterUtenomBalansen")] + [JsonPropertyName("posterUtenomBalansen")] + public PosterUtenomBalansen posterUtenomBalansen { get; set; } + + } + + public class ResultatregnskapAktivitetsbasert + { + [XmlElement("anskaffedeMidler", Order = 1)] + [JsonProperty("anskaffedeMidler")] + [JsonPropertyName("anskaffedeMidler")] + public AnskaffedeMidler anskaffedeMidler { get; set; } + + [XmlElement("forbrukteMidler", Order = 2)] + [JsonProperty("forbrukteMidler")] + [JsonPropertyName("forbrukteMidler")] + public ForbrukteMidler forbrukteMidler { get; set; } + + [XmlElement("aarsresultat", Order = 3)] + [JsonProperty("aarsresultat")] + [JsonPropertyName("aarsresultat")] + public Aarsresultat aarsresultat { get; set; } + + [XmlElement("tilleggReduksjonEgenkapital", Order = 4)] + [JsonProperty("tilleggReduksjonEgenkapital")] + [JsonPropertyName("tilleggReduksjonEgenkapital")] + public TilleggReduksjonEgenkapital tilleggReduksjonEgenkapital { get; set; } + + } + + public class AnskaffedeMidler + { + [XmlElement("medlemsinntekter", Order = 1)] + [JsonProperty("medlemsinntekter")] + [JsonPropertyName("medlemsinntekter")] + public Medlemsinntekter medlemsinntekter { get; set; } + + [XmlElement("offentligeTilskudd", Order = 2)] + [JsonProperty("offentligeTilskudd")] + [JsonPropertyName("offentligeTilskudd")] + public OffentligeTilskudd offentligeTilskudd { get; set; } + + [XmlElement("andreTilskudd", Order = 3)] + [JsonProperty("andreTilskudd")] + [JsonPropertyName("andreTilskudd")] + public AndreTilskudd andreTilskudd { get; set; } + + [XmlElement("sumTilskudd", Order = 4)] + [JsonProperty("sumTilskudd")] + [JsonPropertyName("sumTilskudd")] + public SumTilskudd sumTilskudd { get; set; } + + [XmlElement("innsamledeMidlerGaverMv", Order = 5)] + [JsonProperty("innsamledeMidlerGaverMv")] + [JsonPropertyName("innsamledeMidlerGaverMv")] + public InnsamledeMidlerGaverMv innsamledeMidlerGaverMv { get; set; } + + [XmlElement("aktiviteterOppfyllerOrgFormaal", Order = 6)] + [JsonProperty("aktiviteterOppfyllerOrgFormaal")] + [JsonPropertyName("aktiviteterOppfyllerOrgFormaal")] + public AktiviteterOppfyllerOrgFormaal aktiviteterOppfyllerOrgFormaal { get; set; } + + [XmlElement("aktiviteterSkaperInntekt", Order = 7)] + [JsonProperty("aktiviteterSkaperInntekt")] + [JsonPropertyName("aktiviteterSkaperInntekt")] + public AktiviteterSkaperInntekt aktiviteterSkaperInntekt { get; set; } + + [XmlElement("opptjenteInntekterOperasjonelleAktiviteter", Order = 8)] + [JsonProperty("opptjenteInntekterOperasjonelleAktiviteter")] + [JsonPropertyName("opptjenteInntekterOperasjonelleAktiviteter")] + public OpptjenteInntekterOperasjonelleAktiviteter opptjenteInntekterOperasjonelleAktiviteter { get; set; } + + [XmlElement("annenDriftsinntekt", Order = 9)] + [JsonProperty("annenDriftsinntekt")] + [JsonPropertyName("annenDriftsinntekt")] + public AnnenDriftsinntekt annenDriftsinntekt { get; set; } + + [XmlElement("finansOgInvesteringsinntekter", Order = 10)] + [JsonProperty("finansOgInvesteringsinntekter")] + [JsonPropertyName("finansOgInvesteringsinntekter")] + public FinansOgInvesteringsinntekter finansOgInvesteringsinntekter { get; set; } + + [XmlElement("andreInntekter", Order = 11)] + [JsonProperty("andreInntekter")] + [JsonPropertyName("andreInntekter")] + public AndreInntekter andreInntekter { get; set; } + + [XmlElement("sumAnskaffedeMidler", Order = 12)] + [JsonProperty("sumAnskaffedeMidler")] + [JsonPropertyName("sumAnskaffedeMidler")] + public SumAnskaffedeMidler sumAnskaffedeMidler { get; set; } + + } + + public class Medlemsinntekter + { + [XmlElement("note", Order = 1)] + [JsonProperty("note")] + [JsonPropertyName("note")] + public NoteMedlemsinntekter30319 note { get; set; } + + public bool ShouldSerializenote() => note?.value is not null; + + [XmlElement("aarets", Order = 2)] + [JsonProperty("aarets")] + [JsonPropertyName("aarets")] + public Medlemsinntekter30320 aarets { get; set; } + + public bool ShouldSerializeaarets() => aarets?.valueNullable is not null; + + [XmlElement("fjoraarets", Order = 3)] + [JsonProperty("fjoraarets")] + [JsonPropertyName("fjoraarets")] + public MedlemsinntekterFjoraret30321 fjoraarets { get; set; } + + public bool ShouldSerializefjoraarets() => fjoraarets?.valueNullable is not null; + + } + + public class NoteMedlemsinntekter30319 + { + [MinLength(1)] + [MaxLength(35)] + [XmlText()] + public string value { get; set; } + + [XmlAttribute("orid")] + [BindNever] + public string orid { get; set; } = "30319"; + + } + + public class Medlemsinntekter30320 + { + [RegularExpression(@"^-?[0-9]{0,15}$")] + [Range(Double.MinValue,Double.MaxValue)] + [Required] + [XmlIgnore] + [JsonPropertyName("value")] + [JsonProperty(PropertyName = "value")] + public decimal? valueNullable { get; set; } + + [XmlText] + [System.Text.Json.Serialization.JsonIgnore] + [Newtonsoft.Json.JsonIgnore] + public decimal value + { + get => valueNullable ?? default; + set + { + this.valueNullable = value; + } + } + + [XmlAttribute("orid")] + [BindNever] + public string orid { get; set; } = "30320"; + + } + + public class MedlemsinntekterFjoraret30321 + { + [RegularExpression(@"^-?[0-9]{0,15}$")] + [Range(Double.MinValue,Double.MaxValue)] + [Required] + [XmlIgnore] + [JsonPropertyName("value")] + [JsonProperty(PropertyName = "value")] + public decimal? valueNullable { get; set; } + + [XmlText] + [System.Text.Json.Serialization.JsonIgnore] + [Newtonsoft.Json.JsonIgnore] + public decimal value + { + get => valueNullable ?? default; + set + { + this.valueNullable = value; + } + } + + [XmlAttribute("orid")] + [BindNever] + public string orid { get; set; } = "30321"; + + } + + public class OffentligeTilskudd + { + [XmlElement("note", Order = 1)] + [JsonProperty("note")] + [JsonPropertyName("note")] + public NoteTilskuddOffentlig33418 note { get; set; } + + public bool ShouldSerializenote() => note?.value is not null; + + [XmlElement("aarets", Order = 2)] + [JsonProperty("aarets")] + [JsonPropertyName("aarets")] + public TilskuddOffentlig33419 aarets { get; set; } + + public bool ShouldSerializeaarets() => aarets?.valueNullable is not null; + + [XmlElement("fjoraarets", Order = 3)] + [JsonProperty("fjoraarets")] + [JsonPropertyName("fjoraarets")] + public TilskuddOffentligFjoraret33420 fjoraarets { get; set; } + + public bool ShouldSerializefjoraarets() => fjoraarets?.valueNullable is not null; + + } + + public class NoteTilskuddOffentlig33418 + { + [MinLength(1)] + [MaxLength(35)] + [XmlText()] + public string value { get; set; } + + [XmlAttribute("orid")] + [BindNever] + public string orid { get; set; } = "33418"; + + } + + public class TilskuddOffentlig33419 + { + [RegularExpression(@"^-?[0-9]{0,15}$")] + [Range(Double.MinValue,Double.MaxValue)] + [Required] + [XmlIgnore] + [JsonPropertyName("value")] + [JsonProperty(PropertyName = "value")] + public decimal? valueNullable { get; set; } + + [XmlText] + [System.Text.Json.Serialization.JsonIgnore] + [Newtonsoft.Json.JsonIgnore] + public decimal value + { + get => valueNullable ?? default; + set + { + this.valueNullable = value; + } + } + + [XmlAttribute("orid")] + [BindNever] + public string orid { get; set; } = "33419"; + + } + + public class TilskuddOffentligFjoraret33420 + { + [RegularExpression(@"^-?[0-9]{0,15}$")] + [Range(Double.MinValue,Double.MaxValue)] + [Required] + [XmlIgnore] + [JsonPropertyName("value")] + [JsonProperty(PropertyName = "value")] + public decimal? valueNullable { get; set; } + + [XmlText] + [System.Text.Json.Serialization.JsonIgnore] + [Newtonsoft.Json.JsonIgnore] + public decimal value + { + get => valueNullable ?? default; + set + { + this.valueNullable = value; + } + } + + [XmlAttribute("orid")] + [BindNever] + public string orid { get; set; } = "33420"; + + } + + public class AndreTilskudd + { + [XmlElement("note", Order = 1)] + [JsonProperty("note")] + [JsonPropertyName("note")] + public NoteTilskuddAndre33421 note { get; set; } + + public bool ShouldSerializenote() => note?.value is not null; + + [XmlElement("aarets", Order = 2)] + [JsonProperty("aarets")] + [JsonPropertyName("aarets")] + public TilskuddAndre33422 aarets { get; set; } + + public bool ShouldSerializeaarets() => aarets?.valueNullable is not null; + + [XmlElement("fjoraarets", Order = 3)] + [JsonProperty("fjoraarets")] + [JsonPropertyName("fjoraarets")] + public TilskuddAndreFjoraret33423 fjoraarets { get; set; } + + public bool ShouldSerializefjoraarets() => fjoraarets?.valueNullable is not null; + + } + + public class NoteTilskuddAndre33421 + { + [XmlText()] + public string value { get; set; } + + [XmlAttribute("orid")] + [BindNever] + public string orid { get; set; } = "33421"; + + } + + public class TilskuddAndre33422 + { + [RegularExpression(@"^-?[0-9]{0,15}$")] + [Range(Double.MinValue,Double.MaxValue)] + [Required] + [XmlIgnore] + [JsonPropertyName("value")] + [JsonProperty(PropertyName = "value")] + public decimal? valueNullable { get; set; } + + [XmlText] + [System.Text.Json.Serialization.JsonIgnore] + [Newtonsoft.Json.JsonIgnore] + public decimal value + { + get => valueNullable ?? default; + set + { + this.valueNullable = value; + } + } + + [XmlAttribute("orid")] + [BindNever] + public string orid { get; set; } = "33422"; + + } + + public class TilskuddAndreFjoraret33423 + { + [Range(Double.MinValue,Double.MaxValue)] + [Required] + [XmlIgnore] + [JsonPropertyName("value")] + [JsonProperty(PropertyName = "value")] + public decimal? valueNullable { get; set; } + + [XmlText] + [System.Text.Json.Serialization.JsonIgnore] + [Newtonsoft.Json.JsonIgnore] + public decimal value + { + get => valueNullable ?? default; + set + { + this.valueNullable = value; + } + } + + [XmlAttribute("orid")] + [BindNever] + public string orid { get; set; } = "33423"; + + } + + public class SumTilskudd + { + [XmlElement("note", Order = 1)] + [JsonProperty("note")] + [JsonPropertyName("note")] + public NoteTilskudd30310 note { get; set; } + + public bool ShouldSerializenote() => note?.value is not null; + + [XmlElement("aarets", Order = 2)] + [JsonProperty("aarets")] + [JsonPropertyName("aarets")] + public TilskuddOffentlig30311 aarets { get; set; } + + public bool ShouldSerializeaarets() => aarets?.valueNullable is not null; + + [XmlElement("fjoraarets", Order = 3)] + [JsonProperty("fjoraarets")] + [JsonPropertyName("fjoraarets")] + public TilskuddOffentligFjoraret30312 fjoraarets { get; set; } + + public bool ShouldSerializefjoraarets() => fjoraarets?.valueNullable is not null; + + } + + public class NoteTilskudd30310 + { + [MinLength(1)] + [MaxLength(35)] + [XmlText()] + public string value { get; set; } + + [XmlAttribute("orid")] + [BindNever] + public string orid { get; set; } = "30310"; + + } + + public class TilskuddOffentlig30311 + { + [RegularExpression(@"^-?[0-9]{0,15}$")] + [Range(Double.MinValue,Double.MaxValue)] + [Required] + [XmlIgnore] + [JsonPropertyName("value")] + [JsonProperty(PropertyName = "value")] + public decimal? valueNullable { get; set; } + + [XmlText] + [System.Text.Json.Serialization.JsonIgnore] + [Newtonsoft.Json.JsonIgnore] + public decimal value + { + get => valueNullable ?? default; + set + { + this.valueNullable = value; + } + } + + [XmlAttribute("orid")] + [BindNever] + public string orid { get; set; } = "30311"; + + } + + public class TilskuddOffentligFjoraret30312 + { + [RegularExpression(@"^-?[0-9]{0,15}$")] + [Range(Double.MinValue,Double.MaxValue)] + [Required] + [XmlIgnore] + [JsonPropertyName("value")] + [JsonProperty(PropertyName = "value")] + public decimal? valueNullable { get; set; } + + [XmlText] + [System.Text.Json.Serialization.JsonIgnore] + [Newtonsoft.Json.JsonIgnore] + public decimal value + { + get => valueNullable ?? default; + set + { + this.valueNullable = value; + } + } + + [XmlAttribute("orid")] + [BindNever] + public string orid { get; set; } = "30312"; + + } + + public class InnsamledeMidlerGaverMv + { + [XmlElement("note", Order = 1)] + [JsonProperty("note")] + [JsonPropertyName("note")] + public NoteMidlerGaverInnsamlede30313 note { get; set; } + + public bool ShouldSerializenote() => note?.value is not null; + + [XmlElement("aarets", Order = 2)] + [JsonProperty("aarets")] + [JsonPropertyName("aarets")] + public MidlerGaverInnsamlede30314 aarets { get; set; } + + public bool ShouldSerializeaarets() => aarets?.valueNullable is not null; + + [XmlElement("fjoraarets", Order = 3)] + [JsonProperty("fjoraarets")] + [JsonPropertyName("fjoraarets")] + public MidlerGaverInnsamledeFjoraret30315 fjoraarets { get; set; } + + public bool ShouldSerializefjoraarets() => fjoraarets?.valueNullable is not null; + + } + + public class NoteMidlerGaverInnsamlede30313 + { + [MinLength(1)] + [MaxLength(35)] + [XmlText()] + public string value { get; set; } + + [XmlAttribute("orid")] + [BindNever] + public string orid { get; set; } = "30313"; + + } + + public class MidlerGaverInnsamlede30314 + { + [RegularExpression(@"^-?[0-9]{0,15}$")] + [Range(Double.MinValue,Double.MaxValue)] + [Required] + [XmlIgnore] + [JsonPropertyName("value")] + [JsonProperty(PropertyName = "value")] + public decimal? valueNullable { get; set; } + + [XmlText] + [System.Text.Json.Serialization.JsonIgnore] + [Newtonsoft.Json.JsonIgnore] + public decimal value + { + get => valueNullable ?? default; + set + { + this.valueNullable = value; + } + } + + [XmlAttribute("orid")] + [BindNever] + public string orid { get; set; } = "30314"; + + } + + public class MidlerGaverInnsamledeFjoraret30315 + { + [RegularExpression(@"^-?[0-9]{0,15}$")] + [Range(Double.MinValue,Double.MaxValue)] + [Required] + [XmlIgnore] + [JsonPropertyName("value")] + [JsonProperty(PropertyName = "value")] + public decimal? valueNullable { get; set; } + + [XmlText] + [System.Text.Json.Serialization.JsonIgnore] + [Newtonsoft.Json.JsonIgnore] + public decimal value + { + get => valueNullable ?? default; + set + { + this.valueNullable = value; + } + } + + [XmlAttribute("orid")] + [BindNever] + public string orid { get; set; } = "30315"; + + } + + public class AktiviteterOppfyllerOrgFormaal + { + [XmlElement("note", Order = 1)] + [JsonProperty("note")] + [JsonPropertyName("note")] + public NoteAktiviteterOppfyllerOrganisasjonensFormal33424 note { get; set; } + + public bool ShouldSerializenote() => note?.value is not null; + + [XmlElement("aarets", Order = 2)] + [JsonProperty("aarets")] + [JsonPropertyName("aarets")] + public AktiviteterOppfyllerOrganisasjonensFormal33425 aarets { get; set; } + + public bool ShouldSerializeaarets() => aarets?.valueNullable is not null; + + [XmlElement("fjoraarets", Order = 3)] + [JsonProperty("fjoraarets")] + [JsonPropertyName("fjoraarets")] + public AktiviteterOppfyllerOrganisasjonensFormalFjoraret33426 fjoraarets { get; set; } + + public bool ShouldSerializefjoraarets() => fjoraarets?.valueNullable is not null; + + } + + public class NoteAktiviteterOppfyllerOrganisasjonensFormal33424 + { + [MinLength(1)] + [MaxLength(35)] + [XmlText()] + public string value { get; set; } + + [XmlAttribute("orid")] + [BindNever] + public string orid { get; set; } = "33424"; + + } + + public class AktiviteterOppfyllerOrganisasjonensFormal33425 + { + [RegularExpression(@"^-?[0-9]{0,15}$")] + [Range(Double.MinValue,Double.MaxValue)] + [Required] + [XmlIgnore] + [JsonPropertyName("value")] + [JsonProperty(PropertyName = "value")] + public decimal? valueNullable { get; set; } + + [XmlText] + [System.Text.Json.Serialization.JsonIgnore] + [Newtonsoft.Json.JsonIgnore] + public decimal value + { + get => valueNullable ?? default; + set + { + this.valueNullable = value; + } + } + + [XmlAttribute("orid")] + [BindNever] + public string orid { get; set; } = "33425"; + + } + + public class AktiviteterOppfyllerOrganisasjonensFormalFjoraret33426 + { + [RegularExpression(@"^-?[0-9]{0,15}$")] + [Range(Double.MinValue,Double.MaxValue)] + [Required] + [XmlIgnore] + [JsonPropertyName("value")] + [JsonProperty(PropertyName = "value")] + public decimal? valueNullable { get; set; } + + [XmlText] + [System.Text.Json.Serialization.JsonIgnore] + [Newtonsoft.Json.JsonIgnore] + public decimal value + { + get => valueNullable ?? default; + set + { + this.valueNullable = value; + } + } + + [XmlAttribute("orid")] + [BindNever] + public string orid { get; set; } = "33426"; + + } + + public class AktiviteterSkaperInntekt + { + [XmlElement("note", Order = 1)] + [JsonProperty("note")] + [JsonPropertyName("note")] + public NoteAktiviteterSkaperInntekt33427 note { get; set; } + + public bool ShouldSerializenote() => note?.value is not null; + + [XmlElement("aarets", Order = 2)] + [JsonProperty("aarets")] + [JsonPropertyName("aarets")] + public AktiviteterSkaperInntekt33428 aarets { get; set; } + + public bool ShouldSerializeaarets() => aarets?.valueNullable is not null; + + [XmlElement("fjoraarets", Order = 3)] + [JsonProperty("fjoraarets")] + [JsonPropertyName("fjoraarets")] + public AktiviteterSkaperInntektFjoraret33429 fjoraarets { get; set; } + + public bool ShouldSerializefjoraarets() => fjoraarets?.valueNullable is not null; + + } + + public class NoteAktiviteterSkaperInntekt33427 + { + [MinLength(1)] + [MaxLength(35)] + [XmlText()] + public string value { get; set; } + + [XmlAttribute("orid")] + [BindNever] + public string orid { get; set; } = "33427"; + + } + + public class AktiviteterSkaperInntekt33428 + { + [RegularExpression(@"^-?[0-9]{0,15}$")] + [Range(Double.MinValue,Double.MaxValue)] + [Required] + [XmlIgnore] + [JsonPropertyName("value")] + [JsonProperty(PropertyName = "value")] + public decimal? valueNullable { get; set; } + + [XmlText] + [System.Text.Json.Serialization.JsonIgnore] + [Newtonsoft.Json.JsonIgnore] + public decimal value + { + get => valueNullable ?? default; + set + { + this.valueNullable = value; + } + } + + [XmlAttribute("orid")] + [BindNever] + public string orid { get; set; } = "33428"; + + } + + public class AktiviteterSkaperInntektFjoraret33429 + { + [RegularExpression(@"^-?[0-9]{0,15}$")] + [Range(Double.MinValue,Double.MaxValue)] + [Required] + [XmlIgnore] + [JsonPropertyName("value")] + [JsonProperty(PropertyName = "value")] + public decimal? valueNullable { get; set; } + + [XmlText] + [System.Text.Json.Serialization.JsonIgnore] + [Newtonsoft.Json.JsonIgnore] + public decimal value + { + get => valueNullable ?? default; + set + { + this.valueNullable = value; + } + } + + [XmlAttribute("orid")] + [BindNever] + public string orid { get; set; } = "33429"; + + } + + public class OpptjenteInntekterOperasjonelleAktiviteter + { + [XmlElement("note", Order = 1)] + [JsonProperty("note")] + [JsonPropertyName("note")] + public NoteAktiviteterOperasjonelle33430 note { get; set; } + + public bool ShouldSerializenote() => note?.value is not null; + + [XmlElement("aarets", Order = 2)] + [JsonProperty("aarets")] + [JsonPropertyName("aarets")] + public AktiviteterOperasjonelle33431 aarets { get; set; } + + public bool ShouldSerializeaarets() => aarets?.valueNullable is not null; + + [XmlElement("fjoraarets", Order = 3)] + [JsonProperty("fjoraarets")] + [JsonPropertyName("fjoraarets")] + public AktiviteterOperasjonelleFjoraret33432 fjoraarets { get; set; } + + public bool ShouldSerializefjoraarets() => fjoraarets?.valueNullable is not null; + + } + + public class NoteAktiviteterOperasjonelle33430 + { + [MinLength(1)] + [MaxLength(35)] + [XmlText()] + public string value { get; set; } + + [XmlAttribute("orid")] + [BindNever] + public string orid { get; set; } = "33430"; + + } + + public class AktiviteterOperasjonelle33431 + { + [RegularExpression(@"^-?[0-9]{0,15}$")] + [Range(Double.MinValue,Double.MaxValue)] + [Required] + [XmlIgnore] + [JsonPropertyName("value")] + [JsonProperty(PropertyName = "value")] + public decimal? valueNullable { get; set; } + + [XmlText] + [System.Text.Json.Serialization.JsonIgnore] + [Newtonsoft.Json.JsonIgnore] + public decimal value + { + get => valueNullable ?? default; + set + { + this.valueNullable = value; + } + } + + [XmlAttribute("orid")] + [BindNever] + public string orid { get; set; } = "33431"; + + } + + public class AktiviteterOperasjonelleFjoraret33432 + { + [RegularExpression(@"^-?[0-9]{0,15}$")] + [Range(Double.MinValue,Double.MaxValue)] + [Required] + [XmlIgnore] + [JsonPropertyName("value")] + [JsonProperty(PropertyName = "value")] + public decimal? valueNullable { get; set; } + + [XmlText] + [System.Text.Json.Serialization.JsonIgnore] + [Newtonsoft.Json.JsonIgnore] + public decimal value + { + get => valueNullable ?? default; + set + { + this.valueNullable = value; + } + } + + [XmlAttribute("orid")] + [BindNever] + public string orid { get; set; } = "33432"; + + } + + public class AnnenDriftsinntekt + { + [XmlElement("note", Order = 1)] + [JsonProperty("note")] + [JsonPropertyName("note")] + public NoteDriftsinntekterAndreSum18238 note { get; set; } + + public bool ShouldSerializenote() => note?.value is not null; + + [XmlElement("aarets", Order = 2)] + [JsonProperty("aarets")] + [JsonPropertyName("aarets")] + public DriftsinntekterAndreSum7709 aarets { get; set; } + + public bool ShouldSerializeaarets() => aarets?.valueNullable is not null; + + [XmlElement("fjoraarets", Order = 3)] + [JsonProperty("fjoraarets")] + [JsonPropertyName("fjoraarets")] + public DriftsinntekterAndreFjoraretSum7966 fjoraarets { get; set; } + + public bool ShouldSerializefjoraarets() => fjoraarets?.valueNullable is not null; + + } + + public class NoteDriftsinntekterAndreSum18238 + { + [MinLength(1)] + [MaxLength(35)] + [XmlText()] + public string value { get; set; } + + [XmlAttribute("orid")] + [BindNever] + public string orid { get; set; } = "18238"; + + } + + public class DriftsinntekterAndreSum7709 + { + [RegularExpression(@"^-?[0-9]{0,15}$")] + [Range(Double.MinValue,Double.MaxValue)] + [Required] + [XmlIgnore] + [JsonPropertyName("value")] + [JsonProperty(PropertyName = "value")] + public decimal? valueNullable { get; set; } + + [XmlText] + [System.Text.Json.Serialization.JsonIgnore] + [Newtonsoft.Json.JsonIgnore] + public decimal value + { + get => valueNullable ?? default; + set + { + this.valueNullable = value; + } + } + + [XmlAttribute("orid")] + [BindNever] + public string orid { get; set; } = "7709"; + + } + + public class DriftsinntekterAndreFjoraretSum7966 + { + [RegularExpression(@"^-?[0-9]{0,15}$")] + [Range(Double.MinValue,Double.MaxValue)] + [Required] + [XmlIgnore] + [JsonPropertyName("value")] + [JsonProperty(PropertyName = "value")] + public decimal? valueNullable { get; set; } + + [XmlText] + [System.Text.Json.Serialization.JsonIgnore] + [Newtonsoft.Json.JsonIgnore] + public decimal value + { + get => valueNullable ?? default; + set + { + this.valueNullable = value; + } + } + + [XmlAttribute("orid")] + [BindNever] + public string orid { get; set; } = "7966"; + + } + + public class FinansOgInvesteringsinntekter + { + [XmlElement("note", Order = 1)] + [JsonProperty("note")] + [JsonPropertyName("note")] + public NoteFinansinntekterInvesteringsinntekter33433 note { get; set; } + + public bool ShouldSerializenote() => note?.value is not null; + + [XmlElement("aarets", Order = 2)] + [JsonProperty("aarets")] + [JsonPropertyName("aarets")] + public FinansinntekterInvesteringsinntekter33434 aarets { get; set; } + + public bool ShouldSerializeaarets() => aarets?.valueNullable is not null; + + [XmlElement("fjoraarets", Order = 3)] + [JsonProperty("fjoraarets")] + [JsonPropertyName("fjoraarets")] + public FinansinntekterInvesteringsinntekterFjoraret33435 fjoraarets { get; set; } + + public bool ShouldSerializefjoraarets() => fjoraarets?.valueNullable is not null; + + } + + public class NoteFinansinntekterInvesteringsinntekter33433 + { + [MinLength(1)] + [MaxLength(35)] + [XmlText()] + public string value { get; set; } + + [XmlAttribute("orid")] + [BindNever] + public string orid { get; set; } = "33433"; + + } + + public class FinansinntekterInvesteringsinntekter33434 + { + [RegularExpression(@"^-?[0-9]{0,15}$")] + [Range(Double.MinValue,Double.MaxValue)] + [Required] + [XmlIgnore] + [JsonPropertyName("value")] + [JsonProperty(PropertyName = "value")] + public decimal? valueNullable { get; set; } + + [XmlText] + [System.Text.Json.Serialization.JsonIgnore] + [Newtonsoft.Json.JsonIgnore] + public decimal value + { + get => valueNullable ?? default; + set + { + this.valueNullable = value; + } + } + + [XmlAttribute("orid")] + [BindNever] + public string orid { get; set; } = "33434"; + + } + + public class FinansinntekterInvesteringsinntekterFjoraret33435 + { + [RegularExpression(@"^-?[0-9]{0,15}$")] + [Range(Double.MinValue,Double.MaxValue)] + [Required] + [XmlIgnore] + [JsonPropertyName("value")] + [JsonProperty(PropertyName = "value")] + public decimal? valueNullable { get; set; } + + [XmlText] + [System.Text.Json.Serialization.JsonIgnore] + [Newtonsoft.Json.JsonIgnore] + public decimal value + { + get => valueNullable ?? default; + set + { + this.valueNullable = value; + } + } + + [XmlAttribute("orid")] + [BindNever] + public string orid { get; set; } = "33435"; + + } + + public class AndreInntekter + { + [XmlElement("note", Order = 1)] + [JsonProperty("note")] + [JsonPropertyName("note")] + public NoteInntektAnnen30307 note { get; set; } + + public bool ShouldSerializenote() => note?.value is not null; + + [XmlElement("aarets", Order = 2)] + [JsonProperty("aarets")] + [JsonPropertyName("aarets")] + public InntektAnnen30308 aarets { get; set; } + + public bool ShouldSerializeaarets() => aarets?.valueNullable is not null; + + [XmlElement("fjoraarets", Order = 3)] + [JsonProperty("fjoraarets")] + [JsonPropertyName("fjoraarets")] + public InntektAnnenFjoraret30309 fjoraarets { get; set; } + + public bool ShouldSerializefjoraarets() => fjoraarets?.valueNullable is not null; + + } + + public class NoteInntektAnnen30307 + { + [MinLength(1)] + [MaxLength(35)] + [XmlText()] + public string value { get; set; } + + [XmlAttribute("orid")] + [BindNever] + public string orid { get; set; } = "30307"; + + } + + public class InntektAnnen30308 + { + [RegularExpression(@"^-?[0-9]{0,15}$")] + [Range(Double.MinValue,Double.MaxValue)] + [Required] + [XmlIgnore] + [JsonPropertyName("value")] + [JsonProperty(PropertyName = "value")] + public decimal? valueNullable { get; set; } + + [XmlText] + [System.Text.Json.Serialization.JsonIgnore] + [Newtonsoft.Json.JsonIgnore] + public decimal value + { + get => valueNullable ?? default; + set + { + this.valueNullable = value; + } + } + + [XmlAttribute("orid")] + [BindNever] + public string orid { get; set; } = "30308"; + + } + + public class InntektAnnenFjoraret30309 + { + [RegularExpression(@"^-?[0-9]{0,15}$")] + [Range(Double.MinValue,Double.MaxValue)] + [Required] + [XmlIgnore] + [JsonPropertyName("value")] + [JsonProperty(PropertyName = "value")] + public decimal? valueNullable { get; set; } + + [XmlText] + [System.Text.Json.Serialization.JsonIgnore] + [Newtonsoft.Json.JsonIgnore] + public decimal value + { + get => valueNullable ?? default; + set + { + this.valueNullable = value; + } + } + + [XmlAttribute("orid")] + [BindNever] + public string orid { get; set; } = "30309"; + + } + + public class SumAnskaffedeMidler + { + [XmlElement("note", Order = 1)] + [JsonProperty("note")] + [JsonPropertyName("note")] + public NoteMidlerAnskaffede30316 note { get; set; } + + public bool ShouldSerializenote() => note?.value is not null; + + [XmlElement("aarets", Order = 2)] + [JsonProperty("aarets")] + [JsonPropertyName("aarets")] + public MidlerAnskaffede30317 aarets { get; set; } + + public bool ShouldSerializeaarets() => aarets?.valueNullable is not null; + + [XmlElement("fjoraarets", Order = 3)] + [JsonProperty("fjoraarets")] + [JsonPropertyName("fjoraarets")] + public MidlerAnskaffedeFjoraret30318 fjoraarets { get; set; } + + public bool ShouldSerializefjoraarets() => fjoraarets?.valueNullable is not null; + + } + + public class NoteMidlerAnskaffede30316 + { + [MinLength(1)] + [MaxLength(35)] + [XmlText()] + public string value { get; set; } + + [XmlAttribute("orid")] + [BindNever] + public string orid { get; set; } = "30316"; + + } + + public class MidlerAnskaffede30317 + { + [RegularExpression(@"^-?[0-9]{0,15}$")] + [Range(Double.MinValue,Double.MaxValue)] + [Required] + [XmlIgnore] + [JsonPropertyName("value")] + [JsonProperty(PropertyName = "value")] + public decimal? valueNullable { get; set; } + + [XmlText] + [System.Text.Json.Serialization.JsonIgnore] + [Newtonsoft.Json.JsonIgnore] + public decimal value + { + get => valueNullable ?? default; + set + { + this.valueNullable = value; + } + } + + [XmlAttribute("orid")] + [BindNever] + public string orid { get; set; } = "30317"; + + } + + public class MidlerAnskaffedeFjoraret30318 + { + [RegularExpression(@"^-?[0-9]{0,15}$")] + [Range(Double.MinValue,Double.MaxValue)] + [Required] + [XmlIgnore] + [JsonPropertyName("value")] + [JsonProperty(PropertyName = "value")] + public decimal? valueNullable { get; set; } + + [XmlText] + [System.Text.Json.Serialization.JsonIgnore] + [Newtonsoft.Json.JsonIgnore] + public decimal value + { + get => valueNullable ?? default; + set + { + this.valueNullable = value; + } + } + + [XmlAttribute("orid")] + [BindNever] + public string orid { get; set; } = "30318"; + + } + + public class ForbrukteMidler + { + [XmlElement("kostnadAnskaffelseMidler", Order = 1)] + [JsonProperty("kostnadAnskaffelseMidler")] + [JsonPropertyName("kostnadAnskaffelseMidler")] + public KostnadAnskaffelseMidler kostnadAnskaffelseMidler { get; set; } + + [XmlElement("tilskuddBevilningOppfyllelseOrgFormaal", Order = 2)] + [JsonProperty("tilskuddBevilningOppfyllelseOrgFormaal")] + [JsonPropertyName("tilskuddBevilningOppfyllelseOrgFormaal")] + public TilskuddBevilningOppfyllelseOrgFormaal tilskuddBevilningOppfyllelseOrgFormaal { get; set; } + + [XmlElement("kostnaderOppfyllelseOrgFormaal", Order = 3)] + [JsonProperty("kostnaderOppfyllelseOrgFormaal")] + [JsonPropertyName("kostnaderOppfyllelseOrgFormaal")] + public KostnaderOppfyllelseOrgFormaal kostnaderOppfyllelseOrgFormaal { get; set; } + + [XmlElement("kostnaderOrgFormaal", Order = 4)] + [JsonProperty("kostnaderOrgFormaal")] + [JsonPropertyName("kostnaderOrgFormaal")] + public KostnaderOrgFormaal kostnaderOrgFormaal { get; set; } + + [XmlElement("annenRentekostnad", Order = 5)] + [JsonProperty("annenRentekostnad")] + [JsonPropertyName("annenRentekostnad")] + public AnnenRentekostnad annenRentekostnad { get; set; } + + [XmlElement("annenFinanskostnad", Order = 6)] + [JsonProperty("annenFinanskostnad")] + [JsonPropertyName("annenFinanskostnad")] + public AnnenFinanskostnad annenFinanskostnad { get; set; } + + [XmlElement("administrasjonskostnader", Order = 7)] + [JsonProperty("administrasjonskostnader")] + [JsonPropertyName("administrasjonskostnader")] + public Administrasjonskostnader administrasjonskostnader { get; set; } + + [XmlElement("annenDriftskostnad", Order = 8)] + [JsonProperty("annenDriftskostnad")] + [JsonPropertyName("annenDriftskostnad")] + public AnnenDriftskostnad annenDriftskostnad { get; set; } + + [XmlElement("sumForbrukteMidler", Order = 9)] + [JsonProperty("sumForbrukteMidler")] + [JsonPropertyName("sumForbrukteMidler")] + public SumForbrukteMidler sumForbrukteMidler { get; set; } + + } + + public class KostnadAnskaffelseMidler + { + [XmlElement("note", Order = 1)] + [JsonProperty("note")] + [JsonPropertyName("note")] + public NoteKostnadAnskaffelseAvMidler30806 note { get; set; } + + public bool ShouldSerializenote() => note?.value is not null; + + [XmlElement("aarets", Order = 2)] + [JsonProperty("aarets")] + [JsonPropertyName("aarets")] + public KostnadAnskaffelseAvMidler30807 aarets { get; set; } + + public bool ShouldSerializeaarets() => aarets?.valueNullable is not null; + + [XmlElement("fjoraarets", Order = 3)] + [JsonProperty("fjoraarets")] + [JsonPropertyName("fjoraarets")] + public KostnadAnskaffelseAvMidlerFjoraret30808 fjoraarets { get; set; } + + public bool ShouldSerializefjoraarets() => fjoraarets?.valueNullable is not null; + + } + + public class NoteKostnadAnskaffelseAvMidler30806 + { + [MinLength(1)] + [MaxLength(35)] + [XmlText()] + public string value { get; set; } + + [XmlAttribute("orid")] + [BindNever] + public string orid { get; set; } = "30806"; + + } + + public class KostnadAnskaffelseAvMidler30807 + { + [RegularExpression(@"^-?[0-9]{0,15}$")] + [Range(Double.MinValue,Double.MaxValue)] + [Required] + [XmlIgnore] + [JsonPropertyName("value")] + [JsonProperty(PropertyName = "value")] + public decimal? valueNullable { get; set; } + + [XmlText] + [System.Text.Json.Serialization.JsonIgnore] + [Newtonsoft.Json.JsonIgnore] + public decimal value + { + get => valueNullable ?? default; + set + { + this.valueNullable = value; + } + } + + [XmlAttribute("orid")] + [BindNever] + public string orid { get; set; } = "30807"; + + } + + public class KostnadAnskaffelseAvMidlerFjoraret30808 + { + [RegularExpression(@"^-?[0-9]{0,15}$")] + [Range(Double.MinValue,Double.MaxValue)] + [Required] + [XmlIgnore] + [JsonPropertyName("value")] + [JsonProperty(PropertyName = "value")] + public decimal? valueNullable { get; set; } + + [XmlText] + [System.Text.Json.Serialization.JsonIgnore] + [Newtonsoft.Json.JsonIgnore] + public decimal value + { + get => valueNullable ?? default; + set + { + this.valueNullable = value; + } + } + + [XmlAttribute("orid")] + [BindNever] + public string orid { get; set; } = "30808"; + + } + + public class TilskuddBevilningOppfyllelseOrgFormaal + { + [XmlElement("note", Order = 1)] + [JsonProperty("note")] + [JsonPropertyName("note")] + public NoteTilskuddBevilningOppfyllelseOrganisasjonensFormal33436 note { get; set; } + + public bool ShouldSerializenote() => note?.value is not null; + + [XmlElement("aarets", Order = 2)] + [JsonProperty("aarets")] + [JsonPropertyName("aarets")] + public TilskuddBevilningOppfyllelseOrganisasjonensFormal33437 aarets { get; set; } + + public bool ShouldSerializeaarets() => aarets?.valueNullable is not null; + + [XmlElement("fjoraarets", Order = 3)] + [JsonProperty("fjoraarets")] + [JsonPropertyName("fjoraarets")] + public TilskuddBevilningOppfyllelseOrganisasjonensFormalFjoraret33438 fjoraarets { get; set; } + + public bool ShouldSerializefjoraarets() => fjoraarets?.valueNullable is not null; + + } + + public class NoteTilskuddBevilningOppfyllelseOrganisasjonensFormal33436 + { + [MinLength(1)] + [MaxLength(35)] + [XmlText()] + public string value { get; set; } + + [XmlAttribute("orid")] + [BindNever] + public string orid { get; set; } = "33436"; + + } + + public class TilskuddBevilningOppfyllelseOrganisasjonensFormal33437 + { + [RegularExpression(@"^-?[0-9]{0,15}$")] + [Range(Double.MinValue,Double.MaxValue)] + [Required] + [XmlIgnore] + [JsonPropertyName("value")] + [JsonProperty(PropertyName = "value")] + public decimal? valueNullable { get; set; } + + [XmlText] + [System.Text.Json.Serialization.JsonIgnore] + [Newtonsoft.Json.JsonIgnore] + public decimal value + { + get => valueNullable ?? default; + set + { + this.valueNullable = value; + } + } + + [XmlAttribute("orid")] + [BindNever] + public string orid { get; set; } = "33437"; + + } + + public class TilskuddBevilningOppfyllelseOrganisasjonensFormalFjoraret33438 + { + [RegularExpression(@"^-?[0-9]{0,15}$")] + [Range(Double.MinValue,Double.MaxValue)] + [Required] + [XmlIgnore] + [JsonPropertyName("value")] + [JsonProperty(PropertyName = "value")] + public decimal? valueNullable { get; set; } + + [XmlText] + [System.Text.Json.Serialization.JsonIgnore] + [Newtonsoft.Json.JsonIgnore] + public decimal value + { + get => valueNullable ?? default; + set + { + this.valueNullable = value; + } + } + + [XmlAttribute("orid")] + [BindNever] + public string orid { get; set; } = "33438"; + + } + + public class KostnaderOppfyllelseOrgFormaal + { + [XmlElement("note", Order = 1)] + [JsonProperty("note")] + [JsonPropertyName("note")] + public NoteKostnaderOppfyllelseOrganisasjonensFormal33439 note { get; set; } + + public bool ShouldSerializenote() => note?.value is not null; + + [XmlElement("aarets", Order = 2)] + [JsonProperty("aarets")] + [JsonPropertyName("aarets")] + public KostnaderOppfyllelseOrganisasjonensFormal33440 aarets { get; set; } + + public bool ShouldSerializeaarets() => aarets?.valueNullable is not null; + + [XmlElement("fjoraarets", Order = 3)] + [JsonProperty("fjoraarets")] + [JsonPropertyName("fjoraarets")] + public KostnaderOppfyllelseOrganisasjonensFormalFjoraret33441 fjoraarets { get; set; } + + public bool ShouldSerializefjoraarets() => fjoraarets?.valueNullable is not null; + + } + + public class NoteKostnaderOppfyllelseOrganisasjonensFormal33439 + { + [MinLength(1)] + [MaxLength(35)] + [XmlText()] + public string value { get; set; } + + [XmlAttribute("orid")] + [BindNever] + public string orid { get; set; } = "33439"; + + } + + public class KostnaderOppfyllelseOrganisasjonensFormal33440 + { + [RegularExpression(@"^-?[0-9]{0,15}$")] + [Range(Double.MinValue,Double.MaxValue)] + [Required] + [XmlIgnore] + [JsonPropertyName("value")] + [JsonProperty(PropertyName = "value")] + public decimal? valueNullable { get; set; } + + [XmlText] + [System.Text.Json.Serialization.JsonIgnore] + [Newtonsoft.Json.JsonIgnore] + public decimal value + { + get => valueNullable ?? default; + set + { + this.valueNullable = value; + } + } + + [XmlAttribute("orid")] + [BindNever] + public string orid { get; set; } = "33440"; + + } + + public class KostnaderOppfyllelseOrganisasjonensFormalFjoraret33441 + { + [RegularExpression(@"^-?[0-9]{0,15}$")] + [Range(Double.MinValue,Double.MaxValue)] + [Required] + [XmlIgnore] + [JsonPropertyName("value")] + [JsonProperty(PropertyName = "value")] + public decimal? valueNullable { get; set; } + + [XmlText] + [System.Text.Json.Serialization.JsonIgnore] + [Newtonsoft.Json.JsonIgnore] + public decimal value + { + get => valueNullable ?? default; + set + { + this.valueNullable = value; + } + } + + [XmlAttribute("orid")] + [BindNever] + public string orid { get; set; } = "33441"; + + } + + public class KostnaderOrgFormaal + { + [XmlElement("note", Order = 1)] + [JsonProperty("note")] + [JsonPropertyName("note")] + public NoteKostnadOrganisasjonensFormal30809 note { get; set; } + + public bool ShouldSerializenote() => note?.value is not null; + + [XmlElement("aarets", Order = 2)] + [JsonProperty("aarets")] + [JsonPropertyName("aarets")] + public KostnadOrganisasjonensFormal30810 aarets { get; set; } + + public bool ShouldSerializeaarets() => aarets?.valueNullable is not null; + + [XmlElement("fjoraarets", Order = 3)] + [JsonProperty("fjoraarets")] + [JsonPropertyName("fjoraarets")] + public KostnadOrganisasjonensFormalFjoraret30811 fjoraarets { get; set; } + + public bool ShouldSerializefjoraarets() => fjoraarets?.valueNullable is not null; + + } + + public class NoteKostnadOrganisasjonensFormal30809 + { + [MinLength(1)] + [MaxLength(35)] + [XmlText()] + public string value { get; set; } + + [XmlAttribute("orid")] + [BindNever] + public string orid { get; set; } = "30809"; + + } + + public class KostnadOrganisasjonensFormal30810 + { + [RegularExpression(@"^-?[0-9]{0,15}$")] + [Range(Double.MinValue,Double.MaxValue)] + [Required] + [XmlIgnore] + [JsonPropertyName("value")] + [JsonProperty(PropertyName = "value")] + public decimal? valueNullable { get; set; } + + [XmlText] + [System.Text.Json.Serialization.JsonIgnore] + [Newtonsoft.Json.JsonIgnore] + public decimal value + { + get => valueNullable ?? default; + set + { + this.valueNullable = value; + } + } + + [XmlAttribute("orid")] + [BindNever] + public string orid { get; set; } = "30810"; + + } + + public class KostnadOrganisasjonensFormalFjoraret30811 + { + [RegularExpression(@"^-?[0-9]{0,15}$")] + [Range(Double.MinValue,Double.MaxValue)] + [Required] + [XmlIgnore] + [JsonPropertyName("value")] + [JsonProperty(PropertyName = "value")] + public decimal? valueNullable { get; set; } + + [XmlText] + [System.Text.Json.Serialization.JsonIgnore] + [Newtonsoft.Json.JsonIgnore] + public decimal value + { + get => valueNullable ?? default; + set + { + this.valueNullable = value; + } + } + + [XmlAttribute("orid")] + [BindNever] + public string orid { get; set; } = "30811"; + + } + + public class AnnenRentekostnad + { + [XmlElement("note", Order = 1)] + [JsonProperty("note")] + [JsonPropertyName("note")] + public NoteRentekostnaderAndre18550 note { get; set; } + + public bool ShouldSerializenote() => note?.value is not null; + + [XmlElement("aarets", Order = 2)] + [JsonProperty("aarets")] + [JsonPropertyName("aarets")] + public RentekostnaderAndre2216 aarets { get; set; } + + public bool ShouldSerializeaarets() => aarets?.valueNullable is not null; + + [XmlElement("fjoraarets", Order = 3)] + [JsonProperty("fjoraarets")] + [JsonPropertyName("fjoraarets")] + public RentekostnaderAndreFjoraret7039 fjoraarets { get; set; } + + public bool ShouldSerializefjoraarets() => fjoraarets?.valueNullable is not null; + + } + + public class NoteRentekostnaderAndre18550 + { + [MinLength(1)] + [MaxLength(35)] + [XmlText()] + public string value { get; set; } + + [XmlAttribute("orid")] + [BindNever] + public string orid { get; set; } = "18550"; + + } + + public class RentekostnaderAndre2216 + { + [RegularExpression(@"^-?[0-9]{0,15}$")] + [Range(Double.MinValue,Double.MaxValue)] + [Required] + [XmlIgnore] + [JsonPropertyName("value")] + [JsonProperty(PropertyName = "value")] + public decimal? valueNullable { get; set; } + + [XmlText] + [System.Text.Json.Serialization.JsonIgnore] + [Newtonsoft.Json.JsonIgnore] + public decimal value + { + get => valueNullable ?? default; + set + { + this.valueNullable = value; + } + } + + [XmlAttribute("orid")] + [BindNever] + public string orid { get; set; } = "2216"; + + } + + public class RentekostnaderAndreFjoraret7039 + { + [RegularExpression(@"^-?[0-9]{0,15}$")] + [Range(Double.MinValue,Double.MaxValue)] + [Required] + [XmlIgnore] + [JsonPropertyName("value")] + [JsonProperty(PropertyName = "value")] + public decimal? valueNullable { get; set; } + + [XmlText] + [System.Text.Json.Serialization.JsonIgnore] + [Newtonsoft.Json.JsonIgnore] + public decimal value + { + get => valueNullable ?? default; + set + { + this.valueNullable = value; + } + } + + [XmlAttribute("orid")] + [BindNever] + public string orid { get; set; } = "7039"; + + } + + public class AnnenFinanskostnad + { + [XmlElement("note", Order = 1)] + [JsonProperty("note")] + [JsonPropertyName("note")] + public NoteFinanskostnaderAndre18337 note { get; set; } + + public bool ShouldSerializenote() => note?.value is not null; + + [XmlElement("aarets", Order = 2)] + [JsonProperty("aarets")] + [JsonPropertyName("aarets")] + public FinanskostnaderAndre156 aarets { get; set; } + + public bool ShouldSerializeaarets() => aarets?.valueNullable is not null; + + [XmlElement("fjoraarets", Order = 3)] + [JsonProperty("fjoraarets")] + [JsonPropertyName("fjoraarets")] + public FinanskostnaderAndreFjoraret7041 fjoraarets { get; set; } + + public bool ShouldSerializefjoraarets() => fjoraarets?.valueNullable is not null; + + } + + public class NoteFinanskostnaderAndre18337 + { + [MinLength(1)] + [MaxLength(35)] + [XmlText()] + public string value { get; set; } + + [XmlAttribute("orid")] + [BindNever] + public string orid { get; set; } = "18337"; + + } + + public class FinanskostnaderAndre156 + { + [RegularExpression(@"^-?[0-9]{0,15}$")] + [Range(Double.MinValue,Double.MaxValue)] + [Required] + [XmlIgnore] + [JsonPropertyName("value")] + [JsonProperty(PropertyName = "value")] + public decimal? valueNullable { get; set; } + + [XmlText] + [System.Text.Json.Serialization.JsonIgnore] + [Newtonsoft.Json.JsonIgnore] + public decimal value + { + get => valueNullable ?? default; + set + { + this.valueNullable = value; + } + } + + [XmlAttribute("orid")] + [BindNever] + public string orid { get; set; } = "156"; + + } + + public class FinanskostnaderAndreFjoraret7041 + { + [RegularExpression(@"^-?[0-9]{0,15}$")] + [Range(Double.MinValue,Double.MaxValue)] + [Required] + [XmlIgnore] + [JsonPropertyName("value")] + [JsonProperty(PropertyName = "value")] + public decimal? valueNullable { get; set; } + + [XmlText] + [System.Text.Json.Serialization.JsonIgnore] + [Newtonsoft.Json.JsonIgnore] + public decimal value + { + get => valueNullable ?? default; + set + { + this.valueNullable = value; + } + } + + [XmlAttribute("orid")] + [BindNever] + public string orid { get; set; } = "7041"; + + } + + public class Administrasjonskostnader + { + [XmlElement("note", Order = 1)] + [JsonProperty("note")] + [JsonPropertyName("note")] + public NoteKostnaderAdministrative27924 note { get; set; } + + public bool ShouldSerializenote() => note?.value is not null; + + [XmlElement("aarets", Order = 2)] + [JsonProperty("aarets")] + [JsonPropertyName("aarets")] + public KostnaderAdministrative27926 aarets { get; set; } + + public bool ShouldSerializeaarets() => aarets?.valueNullable is not null; + + [XmlElement("fjoraarets", Order = 3)] + [JsonProperty("fjoraarets")] + [JsonPropertyName("fjoraarets")] + public KostnaderAdministrativeFjoraret27928 fjoraarets { get; set; } + + public bool ShouldSerializefjoraarets() => fjoraarets?.valueNullable is not null; + + } + + public class NoteKostnaderAdministrative27924 + { + [MinLength(1)] + [MaxLength(35)] + [XmlText()] + public string value { get; set; } + + [XmlAttribute("orid")] + [BindNever] + public string orid { get; set; } = "27924"; + + } + + public class KostnaderAdministrative27926 + { + [RegularExpression(@"^-?[0-9]{0,15}$")] + [Range(Double.MinValue,Double.MaxValue)] + [Required] + [XmlIgnore] + [JsonPropertyName("value")] + [JsonProperty(PropertyName = "value")] + public decimal? valueNullable { get; set; } + + [XmlText] + [System.Text.Json.Serialization.JsonIgnore] + [Newtonsoft.Json.JsonIgnore] + public decimal value + { + get => valueNullable ?? default; + set + { + this.valueNullable = value; + } + } + + [XmlAttribute("orid")] + [BindNever] + public string orid { get; set; } = "27926"; + + } + + public class KostnaderAdministrativeFjoraret27928 + { + [RegularExpression(@"^-?[0-9]{0,15}$")] + [Range(Double.MinValue,Double.MaxValue)] + [Required] + [XmlIgnore] + [JsonPropertyName("value")] + [JsonProperty(PropertyName = "value")] + public decimal? valueNullable { get; set; } + + [XmlText] + [System.Text.Json.Serialization.JsonIgnore] + [Newtonsoft.Json.JsonIgnore] + public decimal value + { + get => valueNullable ?? default; + set + { + this.valueNullable = value; + } + } + + [XmlAttribute("orid")] + [BindNever] + public string orid { get; set; } = "27928"; + + } + + public class AnnenDriftskostnad + { + [XmlElement("note", Order = 1)] + [JsonProperty("note")] + [JsonPropertyName("note")] + public NoteDriftskostnaderAndre18249 note { get; set; } + + public bool ShouldSerializenote() => note?.value is not null; + + [XmlElement("aarets", Order = 2)] + [JsonProperty("aarets")] + [JsonPropertyName("aarets")] + public DriftskostnaderAndre82 aarets { get; set; } + + public bool ShouldSerializeaarets() => aarets?.valueNullable is not null; + + [XmlElement("fjoraarets", Order = 3)] + [JsonProperty("fjoraarets")] + [JsonPropertyName("fjoraarets")] + public DriftskostnaderAndreFjoraret7023 fjoraarets { get; set; } + + public bool ShouldSerializefjoraarets() => fjoraarets?.valueNullable is not null; + + } + + public class NoteDriftskostnaderAndre18249 + { + [MinLength(1)] + [MaxLength(35)] + [XmlText()] + public string value { get; set; } + + [XmlAttribute("orid")] + [BindNever] + public string orid { get; set; } = "18249"; + + } + + public class DriftskostnaderAndre82 + { + [RegularExpression(@"^-?[0-9]{0,15}$")] + [Range(Double.MinValue,Double.MaxValue)] + [Required] + [XmlIgnore] + [JsonPropertyName("value")] + [JsonProperty(PropertyName = "value")] + public decimal? valueNullable { get; set; } + + [XmlText] + [System.Text.Json.Serialization.JsonIgnore] + [Newtonsoft.Json.JsonIgnore] + public decimal value + { + get => valueNullable ?? default; + set + { + this.valueNullable = value; + } + } + + [XmlAttribute("orid")] + [BindNever] + public string orid { get; set; } = "82"; + + } + + public class DriftskostnaderAndreFjoraret7023 + { + [RegularExpression(@"^-?[0-9]{0,15}$")] + [Range(Double.MinValue,Double.MaxValue)] + [Required] + [XmlIgnore] + [JsonPropertyName("value")] + [JsonProperty(PropertyName = "value")] + public decimal? valueNullable { get; set; } + + [XmlText] + [System.Text.Json.Serialization.JsonIgnore] + [Newtonsoft.Json.JsonIgnore] + public decimal value + { + get => valueNullable ?? default; + set + { + this.valueNullable = value; + } + } + + [XmlAttribute("orid")] + [BindNever] + public string orid { get; set; } = "7023"; + + } + + public class SumForbrukteMidler + { + [XmlElement("note", Order = 1)] + [JsonProperty("note")] + [JsonPropertyName("note")] + public NoteMidlerForbrukte30812 note { get; set; } + + public bool ShouldSerializenote() => note?.value is not null; + + [XmlElement("aarets", Order = 2)] + [JsonProperty("aarets")] + [JsonPropertyName("aarets")] + public MidlerForbrukte30813 aarets { get; set; } + + public bool ShouldSerializeaarets() => aarets?.valueNullable is not null; + + [XmlElement("fjoraarets", Order = 3)] + [JsonProperty("fjoraarets")] + [JsonPropertyName("fjoraarets")] + public MidlerForbrukteFjoraret30814 fjoraarets { get; set; } + + public bool ShouldSerializefjoraarets() => fjoraarets?.valueNullable is not null; + + } + + public class NoteMidlerForbrukte30812 + { + [MinLength(1)] + [MaxLength(35)] + [XmlText()] + public string value { get; set; } + + [XmlAttribute("orid")] + [BindNever] + public string orid { get; set; } = "30812"; + + } + + public class MidlerForbrukte30813 + { + [RegularExpression(@"^-?[0-9]{0,15}$")] + [Range(Double.MinValue,Double.MaxValue)] + [Required] + [XmlIgnore] + [JsonPropertyName("value")] + [JsonProperty(PropertyName = "value")] + public decimal? valueNullable { get; set; } + + [XmlText] + [System.Text.Json.Serialization.JsonIgnore] + [Newtonsoft.Json.JsonIgnore] + public decimal value + { + get => valueNullable ?? default; + set + { + this.valueNullable = value; + } + } + + [XmlAttribute("orid")] + [BindNever] + public string orid { get; set; } = "30813"; + + } + + public class MidlerForbrukteFjoraret30814 + { + [RegularExpression(@"^-?[0-9]{0,15}$")] + [Range(Double.MinValue,Double.MaxValue)] + [Required] + [XmlIgnore] + [JsonPropertyName("value")] + [JsonProperty(PropertyName = "value")] + public decimal? valueNullable { get; set; } + + [XmlText] + [System.Text.Json.Serialization.JsonIgnore] + [Newtonsoft.Json.JsonIgnore] + public decimal value + { + get => valueNullable ?? default; + set + { + this.valueNullable = value; + } + } + + [XmlAttribute("orid")] + [BindNever] + public string orid { get; set; } = "30814"; + + } + + public class Aarsresultat + { + [XmlElement("ordinaertResultatFoerSkattekostnad", Order = 1)] + [JsonProperty("ordinaertResultatFoerSkattekostnad")] + [JsonPropertyName("ordinaertResultatFoerSkattekostnad")] + public OrdinaertResultatFoerSkattekostnaO ordinaertResultatFoerSkattekostnad { get; set; } + + [XmlElement("skattekostnadOrdinaertResultat", Order = 2)] + [JsonProperty("skattekostnadOrdinaertResultat")] + [JsonPropertyName("skattekostnadOrdinaertResultat")] + public SkattekostnadOrdinaertResultat skattekostnadOrdinaertResultat { get; set; } + + [XmlElement("ordinaertResultatEtterSkattekostnad", Order = 3)] + [JsonProperty("ordinaertResultatEtterSkattekostnad")] + [JsonPropertyName("ordinaertResultatEtterSkattekostnad")] + public OrdinaertResultatEtterSkattekostnad ordinaertResultatEtterSkattekostnad { get; set; } + + [XmlElement("ekstraordinaerePoster", Order = 4)] + [JsonProperty("ekstraordinaerePoster")] + [JsonPropertyName("ekstraordinaerePoster")] + public EkstraordinaerePoster ekstraordinaerePoster { get; set; } + + [XmlElement("skattekostnadPaaEkstraordinaertResultat", Order = 5)] + [JsonProperty("skattekostnadPaaEkstraordinaertResultat")] + [JsonPropertyName("skattekostnadPaaEkstraordinaertResultat")] + public SkattekostnadPaaEkstraordinaertResultat skattekostnadPaaEkstraordinaertResultat { get; set; } + + [XmlElement("aarsresultat", Order = 6)] + [JsonProperty("aarsresultat")] + [JsonPropertyName("aarsresultat")] + public AarsresultatPoster aarsresultat { get; set; } + + [XmlElement("minoritetsinteresser", Order = 7)] + [JsonProperty("minoritetsinteresser")] + [JsonPropertyName("minoritetsinteresser")] + public Minoritetsinteresser minoritetsinteresser { get; set; } + + [XmlElement("aarsresultatEtterMinoritetsinteresser", Order = 8)] + [JsonProperty("aarsresultatEtterMinoritetsinteresser")] + [JsonPropertyName("aarsresultatEtterMinoritetsinteresser")] + public AarsresultatEtterMinoritetsinteresser aarsresultatEtterMinoritetsinteresser { get; set; } + + [XmlElement("andreResultatkomponenterIfrs", Order = 9)] + [JsonProperty("andreResultatkomponenterIfrs")] + [JsonPropertyName("andreResultatkomponenterIfrs")] + public AndreResultatkomponenterIfrs andreResultatkomponenterIfrs { get; set; } + + [XmlElement("totalresultatIfrs", Order = 10)] + [JsonProperty("totalresultatIfrs")] + [JsonPropertyName("totalresultatIfrs")] + public TotalresultatIfrs totalresultatIfrs { get; set; } + + } + + public class OrdinaertResultatFoerSkattekostnaO + { + [XmlElement("note", Order = 1)] + [JsonProperty("note")] + [JsonPropertyName("note")] + public NoteResultatForSkattekostnad18355 note { get; set; } + + public bool ShouldSerializenote() => note?.value is not null; + + [XmlElement("aarets", Order = 2)] + [JsonProperty("aarets")] + [JsonPropertyName("aarets")] + public ResultatForSkattekostnad167 aarets { get; set; } + + public bool ShouldSerializeaarets() => aarets?.valueNullable is not null; + + [XmlElement("fjoraarets", Order = 3)] + [JsonProperty("fjoraarets")] + [JsonPropertyName("fjoraarets")] + public ResultatForSkattekostnadFjoraret7042 fjoraarets { get; set; } + + public bool ShouldSerializefjoraarets() => fjoraarets?.valueNullable is not null; + + } + + public class NoteResultatForSkattekostnad18355 + { + [MinLength(1)] + [MaxLength(35)] + [XmlText()] + public string value { get; set; } + + [XmlAttribute("orid")] + [BindNever] + public string orid { get; set; } = "18355"; + + } + + public class ResultatForSkattekostnad167 + { + [RegularExpression(@"^-?[0-9]{0,15}$")] + [Range(Double.MinValue,Double.MaxValue)] + [Required] + [XmlIgnore] + [JsonPropertyName("value")] + [JsonProperty(PropertyName = "value")] + public decimal? valueNullable { get; set; } + + [XmlText] + [System.Text.Json.Serialization.JsonIgnore] + [Newtonsoft.Json.JsonIgnore] + public decimal value + { + get => valueNullable ?? default; + set + { + this.valueNullable = value; + } + } + + [XmlAttribute("orid")] + [BindNever] + public string orid { get; set; } = "167"; + + } + + public class ResultatForSkattekostnadFjoraret7042 + { + [RegularExpression(@"^-?[0-9]{0,15}$")] + [Range(Double.MinValue,Double.MaxValue)] + [Required] + [XmlIgnore] + [JsonPropertyName("value")] + [JsonProperty(PropertyName = "value")] + public decimal? valueNullable { get; set; } + + [XmlText] + [System.Text.Json.Serialization.JsonIgnore] + [Newtonsoft.Json.JsonIgnore] + public decimal value + { + get => valueNullable ?? default; + set + { + this.valueNullable = value; + } + } + + [XmlAttribute("orid")] + [BindNever] + public string orid { get; set; } = "7042"; + + } + + public class SkattekostnadOrdinaertResultat + { + [XmlElement("note", Order = 1)] + [JsonProperty("note")] + [JsonPropertyName("note")] + public NoteSkattekostnadOrdinartResultat18259 note { get; set; } + + public bool ShouldSerializenote() => note?.value is not null; + + [XmlElement("aarets", Order = 2)] + [JsonProperty("aarets")] + [JsonPropertyName("aarets")] + public SkattekostnadOrdinartResultat11835 aarets { get; set; } + + public bool ShouldSerializeaarets() => aarets?.valueNullable is not null; + + [XmlElement("fjoraarets", Order = 3)] + [JsonProperty("fjoraarets")] + [JsonPropertyName("fjoraarets")] + public SkattekostnadOrdinartResultatFjoraret11836 fjoraarets { get; set; } + + public bool ShouldSerializefjoraarets() => fjoraarets?.valueNullable is not null; + + } + + public class NoteSkattekostnadOrdinartResultat18259 + { + [MinLength(1)] + [MaxLength(35)] + [XmlText()] + public string value { get; set; } + + [XmlAttribute("orid")] + [BindNever] + public string orid { get; set; } = "18259"; + + } + + public class SkattekostnadOrdinartResultat11835 + { + [RegularExpression(@"^-?[0-9]{0,15}$")] + [Range(Double.MinValue,Double.MaxValue)] + [Required] + [XmlIgnore] + [JsonPropertyName("value")] + [JsonProperty(PropertyName = "value")] + public decimal? valueNullable { get; set; } + + [XmlText] + [System.Text.Json.Serialization.JsonIgnore] + [Newtonsoft.Json.JsonIgnore] + public decimal value + { + get => valueNullable ?? default; + set + { + this.valueNullable = value; + } + } + + [XmlAttribute("orid")] + [BindNever] + public string orid { get; set; } = "11835"; + + } + + public class SkattekostnadOrdinartResultatFjoraret11836 + { + [RegularExpression(@"^-?[0-9]{0,15}$")] + [Range(Double.MinValue,Double.MaxValue)] + [Required] + [XmlIgnore] + [JsonPropertyName("value")] + [JsonProperty(PropertyName = "value")] + public decimal? valueNullable { get; set; } + + [XmlText] + [System.Text.Json.Serialization.JsonIgnore] + [Newtonsoft.Json.JsonIgnore] + public decimal value + { + get => valueNullable ?? default; + set + { + this.valueNullable = value; + } + } + + [XmlAttribute("orid")] + [BindNever] + public string orid { get; set; } = "11836"; + + } + + public class OrdinaertResultatEtterSkattekostnad + { + [XmlElement("note", Order = 1)] + [JsonProperty("note")] + [JsonPropertyName("note")] + public NoteResultatOrdinart18258 note { get; set; } + + public bool ShouldSerializenote() => note?.value is not null; + + [XmlElement("aarets", Order = 2)] + [JsonProperty("aarets")] + [JsonPropertyName("aarets")] + public ResultatOrdinart7048 aarets { get; set; } + + public bool ShouldSerializeaarets() => aarets?.valueNullable is not null; + + [XmlElement("fjoraarets", Order = 3)] + [JsonProperty("fjoraarets")] + [JsonPropertyName("fjoraarets")] + public ResultatOrdinartFjordaret7049 fjoraarets { get; set; } + + public bool ShouldSerializefjoraarets() => fjoraarets?.valueNullable is not null; + + } + + public class NoteResultatOrdinart18258 + { + [MinLength(1)] + [MaxLength(35)] + [XmlText()] + public string value { get; set; } + + [XmlAttribute("orid")] + [BindNever] + public string orid { get; set; } = "18258"; + + } + + public class ResultatOrdinart7048 + { + [RegularExpression(@"^-?[0-9]{0,15}$")] + [Range(Double.MinValue,Double.MaxValue)] + [Required] + [XmlIgnore] + [JsonPropertyName("value")] + [JsonProperty(PropertyName = "value")] + public decimal? valueNullable { get; set; } + + [XmlText] + [System.Text.Json.Serialization.JsonIgnore] + [Newtonsoft.Json.JsonIgnore] + public decimal value + { + get => valueNullable ?? default; + set + { + this.valueNullable = value; + } + } + + [XmlAttribute("orid")] + [BindNever] + public string orid { get; set; } = "7048"; + + } + + public class ResultatOrdinartFjordaret7049 + { + [RegularExpression(@"^-?[0-9]{0,15}$")] + [Range(Double.MinValue,Double.MaxValue)] + [Required] + [XmlIgnore] + [JsonPropertyName("value")] + [JsonProperty(PropertyName = "value")] + public decimal? valueNullable { get; set; } + + [XmlText] + [System.Text.Json.Serialization.JsonIgnore] + [Newtonsoft.Json.JsonIgnore] + public decimal value + { + get => valueNullable ?? default; + set + { + this.valueNullable = value; + } + } + + [XmlAttribute("orid")] + [BindNever] + public string orid { get; set; } = "7049"; + + } + + public class EkstraordinaerePoster + { + [XmlElement("note", Order = 1)] + [JsonProperty("note")] + [JsonPropertyName("note")] + public NoteResultatEkstraordinarePoster29047 note { get; set; } + + public bool ShouldSerializenote() => note?.value is not null; + + [XmlElement("aarets", Order = 2)] + [JsonProperty("aarets")] + [JsonPropertyName("aarets")] + public ResultatEkstraordinarePoster29048 aarets { get; set; } + + public bool ShouldSerializeaarets() => aarets?.valueNullable is not null; + + [XmlElement("fjoraarets", Order = 3)] + [JsonProperty("fjoraarets")] + [JsonPropertyName("fjoraarets")] + public ResultatEkstraordinarePosterFjoraret29049 fjoraarets { get; set; } + + public bool ShouldSerializefjoraarets() => fjoraarets?.valueNullable is not null; + + } + + public class NoteResultatEkstraordinarePoster29047 + { + [MinLength(1)] + [MaxLength(35)] + [XmlText()] + public string value { get; set; } + + [XmlAttribute("orid")] + [BindNever] + public string orid { get; set; } = "29047"; + + } + + public class ResultatEkstraordinarePoster29048 + { + [RegularExpression(@"^-?[0-9]{0,15}$")] + [Range(Double.MinValue,Double.MaxValue)] + [Required] + [XmlIgnore] + [JsonPropertyName("value")] + [JsonProperty(PropertyName = "value")] + public decimal? valueNullable { get; set; } + + [XmlText] + [System.Text.Json.Serialization.JsonIgnore] + [Newtonsoft.Json.JsonIgnore] + public decimal value + { + get => valueNullable ?? default; + set + { + this.valueNullable = value; + } + } + + [XmlAttribute("orid")] + [BindNever] + public string orid { get; set; } = "29048"; + + } + + public class ResultatEkstraordinarePosterFjoraret29049 + { + [RegularExpression(@"^-?[0-9]{0,15}$")] + [Range(Double.MinValue,Double.MaxValue)] + [Required] + [XmlIgnore] + [JsonPropertyName("value")] + [JsonProperty(PropertyName = "value")] + public decimal? valueNullable { get; set; } + + [XmlText] + [System.Text.Json.Serialization.JsonIgnore] + [Newtonsoft.Json.JsonIgnore] + public decimal value + { + get => valueNullable ?? default; + set + { + this.valueNullable = value; + } + } + + [XmlAttribute("orid")] + [BindNever] + public string orid { get; set; } = "29049"; + + } + + public class SkattekostnadPaaEkstraordinaertResultat + { + [XmlElement("note", Order = 1)] + [JsonProperty("note")] + [JsonPropertyName("note")] + public NoteSkattekostnadEkstraordinartResultat18263 note { get; set; } + + public bool ShouldSerializenote() => note?.value is not null; + + [XmlElement("aarets", Order = 2)] + [JsonProperty("aarets")] + [JsonPropertyName("aarets")] + public SkattekostnadEkstraordinartResultat2821 aarets { get; set; } + + public bool ShouldSerializeaarets() => aarets?.valueNullable is not null; + + [XmlElement("fjoraarets", Order = 3)] + [JsonProperty("fjoraarets")] + [JsonPropertyName("fjoraarets")] + public SkattekostnadEkstraordinartResultatFjoraret8002 fjoraarets { get; set; } + + public bool ShouldSerializefjoraarets() => fjoraarets?.valueNullable is not null; + + } + + public class NoteSkattekostnadEkstraordinartResultat18263 + { + [MinLength(1)] + [MaxLength(35)] + [XmlText()] + public string value { get; set; } + + [XmlAttribute("orid")] + [BindNever] + public string orid { get; set; } = "18263"; + + } + + public class SkattekostnadEkstraordinartResultat2821 + { + [RegularExpression(@"^-?[0-9]{0,15}$")] + [Range(Double.MinValue,Double.MaxValue)] + [Required] + [XmlIgnore] + [JsonPropertyName("value")] + [JsonProperty(PropertyName = "value")] + public decimal? valueNullable { get; set; } + + [XmlText] + [System.Text.Json.Serialization.JsonIgnore] + [Newtonsoft.Json.JsonIgnore] + public decimal value + { + get => valueNullable ?? default; + set + { + this.valueNullable = value; + } + } + + [XmlAttribute("orid")] + [BindNever] + public string orid { get; set; } = "2821"; + + } + + public class SkattekostnadEkstraordinartResultatFjoraret8002 + { + [RegularExpression(@"^-?[0-9]{0,15}$")] + [Range(Double.MinValue,Double.MaxValue)] + [Required] + [XmlIgnore] + [JsonPropertyName("value")] + [JsonProperty(PropertyName = "value")] + public decimal? valueNullable { get; set; } + + [XmlText] + [System.Text.Json.Serialization.JsonIgnore] + [Newtonsoft.Json.JsonIgnore] + public decimal value + { + get => valueNullable ?? default; + set + { + this.valueNullable = value; + } + } + + [XmlAttribute("orid")] + [BindNever] + public string orid { get; set; } = "8002"; + + } + + public class AarsresultatPoster + { + [XmlElement("note", Order = 1)] + [JsonProperty("note")] + [JsonPropertyName("note")] + public NoteArsresultat18265 note { get; set; } + + public bool ShouldSerializenote() => note?.value is not null; + + [XmlElement("aarets", Order = 2)] + [JsonProperty("aarets")] + [JsonPropertyName("aarets")] + public Arsresultat172 aarets { get; set; } + + public bool ShouldSerializeaarets() => aarets?.valueNullable is not null; + + [XmlElement("fjoraarets", Order = 3)] + [JsonProperty("fjoraarets")] + [JsonPropertyName("fjoraarets")] + public ArsresultatFjoraret7054 fjoraarets { get; set; } + + public bool ShouldSerializefjoraarets() => fjoraarets?.valueNullable is not null; + + } + + public class NoteArsresultat18265 + { + [MinLength(1)] + [MaxLength(35)] + [XmlText()] + public string value { get; set; } + + [XmlAttribute("orid")] + [BindNever] + public string orid { get; set; } = "18265"; + + } + + public class Arsresultat172 + { + [RegularExpression(@"^-?[0-9]{0,15}$")] + [Range(Double.MinValue,Double.MaxValue)] + [Required] + [XmlIgnore] + [JsonPropertyName("value")] + [JsonProperty(PropertyName = "value")] + public decimal? valueNullable { get; set; } + + [XmlText] + [System.Text.Json.Serialization.JsonIgnore] + [Newtonsoft.Json.JsonIgnore] + public decimal value + { + get => valueNullable ?? default; + set + { + this.valueNullable = value; + } + } + + [XmlAttribute("orid")] + [BindNever] + public string orid { get; set; } = "172"; + + } + + public class ArsresultatFjoraret7054 + { + [RegularExpression(@"^-?[0-9]{0,15}$")] + [Range(Double.MinValue,Double.MaxValue)] + [Required] + [XmlIgnore] + [JsonPropertyName("value")] + [JsonProperty(PropertyName = "value")] + public decimal? valueNullable { get; set; } + + [XmlText] + [System.Text.Json.Serialization.JsonIgnore] + [Newtonsoft.Json.JsonIgnore] + public decimal value + { + get => valueNullable ?? default; + set + { + this.valueNullable = value; + } + } + + [XmlAttribute("orid")] + [BindNever] + public string orid { get; set; } = "7054"; + + } + + public class Minoritetsinteresser + { + [XmlElement("note", Order = 1)] + [JsonProperty("note")] + [JsonPropertyName("note")] + public NoteMinoritetsinteresser18264 note { get; set; } + + public bool ShouldSerializenote() => note?.value is not null; + + [XmlElement("aarets", Order = 2)] + [JsonProperty("aarets")] + [JsonPropertyName("aarets")] + public Minoritetsinteresser7717 aarets { get; set; } + + public bool ShouldSerializeaarets() => aarets?.valueNullable is not null; + + [XmlElement("fjoraarets", Order = 3)] + [JsonProperty("fjoraarets")] + [JsonPropertyName("fjoraarets")] + public MinoritetsinteresserFjoraret8004 fjoraarets { get; set; } + + public bool ShouldSerializefjoraarets() => fjoraarets?.valueNullable is not null; + + } + + public class NoteMinoritetsinteresser18264 + { + [MinLength(1)] + [MaxLength(35)] + [XmlText()] + public string value { get; set; } + + [XmlAttribute("orid")] + [BindNever] + public string orid { get; set; } = "18264"; + + } + + public class Minoritetsinteresser7717 + { + [RegularExpression(@"^-?[0-9]{0,15}$")] + [Range(Double.MinValue,Double.MaxValue)] + [Required] + [XmlIgnore] + [JsonPropertyName("value")] + [JsonProperty(PropertyName = "value")] + public decimal? valueNullable { get; set; } + + [XmlText] + [System.Text.Json.Serialization.JsonIgnore] + [Newtonsoft.Json.JsonIgnore] + public decimal value + { + get => valueNullable ?? default; + set + { + this.valueNullable = value; + } + } + + [XmlAttribute("orid")] + [BindNever] + public string orid { get; set; } = "7717"; + + } + + public class MinoritetsinteresserFjoraret8004 + { + [RegularExpression(@"^-?[0-9]{0,15}$")] + [Range(Double.MinValue,Double.MaxValue)] + [Required] + [XmlIgnore] + [JsonPropertyName("value")] + [JsonProperty(PropertyName = "value")] + public decimal? valueNullable { get; set; } + + [XmlText] + [System.Text.Json.Serialization.JsonIgnore] + [Newtonsoft.Json.JsonIgnore] + public decimal value + { + get => valueNullable ?? default; + set + { + this.valueNullable = value; + } + } + + [XmlAttribute("orid")] + [BindNever] + public string orid { get; set; } = "8004"; + + } + + public class AarsresultatEtterMinoritetsinteresser + { + [XmlElement("note", Order = 1)] + [JsonProperty("note")] + [JsonPropertyName("note")] + public NoteArsresultatEtterMinoritetsinteresser33417 note { get; set; } + + public bool ShouldSerializenote() => note?.value is not null; + + [XmlElement("aarets", Order = 2)] + [JsonProperty("aarets")] + [JsonPropertyName("aarets")] + public ArsresultatEtterMinoritetsinteresser33415 aarets { get; set; } + + public bool ShouldSerializeaarets() => aarets?.valueNullable is not null; + + [XmlElement("fjoraarets", Order = 3)] + [JsonProperty("fjoraarets")] + [JsonPropertyName("fjoraarets")] + public ArsresultatEtterMinoritetsinteresserFjoraret33416 fjoraarets { get; set; } + + public bool ShouldSerializefjoraarets() => fjoraarets?.valueNullable is not null; + + } + + public class NoteArsresultatEtterMinoritetsinteresser33417 + { + [MinLength(1)] + [MaxLength(35)] + [XmlText()] + public string value { get; set; } + + [XmlAttribute("orid")] + [BindNever] + public string orid { get; set; } = "33417"; + + } + + public class ArsresultatEtterMinoritetsinteresser33415 + { + [RegularExpression(@"^-?[0-9]{0,15}$")] + [Range(Double.MinValue,Double.MaxValue)] + [Required] + [XmlIgnore] + [JsonPropertyName("value")] + [JsonProperty(PropertyName = "value")] + public decimal? valueNullable { get; set; } + + [XmlText] + [System.Text.Json.Serialization.JsonIgnore] + [Newtonsoft.Json.JsonIgnore] + public decimal value + { + get => valueNullable ?? default; + set + { + this.valueNullable = value; + } + } + + [XmlAttribute("orid")] + [BindNever] + public string orid { get; set; } = "33415"; + + } + + public class ArsresultatEtterMinoritetsinteresserFjoraret33416 + { + [RegularExpression(@"^-?[0-9]{0,15}$")] + [Range(Double.MinValue,Double.MaxValue)] + [Required] + [XmlIgnore] + [JsonPropertyName("value")] + [JsonProperty(PropertyName = "value")] + public decimal? valueNullable { get; set; } + + [XmlText] + [System.Text.Json.Serialization.JsonIgnore] + [Newtonsoft.Json.JsonIgnore] + public decimal value + { + get => valueNullable ?? default; + set + { + this.valueNullable = value; + } + } + + [XmlAttribute("orid")] + [BindNever] + public string orid { get; set; } = "33416"; + + } + + public class AndreResultatkomponenterIfrs + { + [XmlElement("note", Order = 1)] + [JsonProperty("note")] + [JsonPropertyName("note")] + public NoteResultatkomponenterAndreIFRS35536 note { get; set; } + + public bool ShouldSerializenote() => note?.value is not null; + + [XmlElement("aarets", Order = 2)] + [JsonProperty("aarets")] + [JsonPropertyName("aarets")] + public ResultatkomponenterAndreIFRS32929 aarets { get; set; } + + public bool ShouldSerializeaarets() => aarets?.valueNullable is not null; + + [XmlElement("fjoraarets", Order = 3)] + [JsonProperty("fjoraarets")] + [JsonPropertyName("fjoraarets")] + public ResultatkomponenterAndreIFRSFjoraret32930 fjoraarets { get; set; } + + public bool ShouldSerializefjoraarets() => fjoraarets?.valueNullable is not null; + + } + + public class NoteResultatkomponenterAndreIFRS35536 + { + [XmlText()] + public string value { get; set; } + + [XmlAttribute("orid")] + [BindNever] + public string orid { get; set; } = "35536"; + + } + + public class ResultatkomponenterAndreIFRS32929 + { + [RegularExpression(@"^-?[0-9]{0,15}$")] + [Range(Double.MinValue,Double.MaxValue)] + [Required] + [XmlIgnore] + [JsonPropertyName("value")] + [JsonProperty(PropertyName = "value")] + public decimal? valueNullable { get; set; } + + [XmlText] + [System.Text.Json.Serialization.JsonIgnore] + [Newtonsoft.Json.JsonIgnore] + public decimal value + { + get => valueNullable ?? default; + set + { + this.valueNullable = value; + } + } + + [XmlAttribute("orid")] + [BindNever] + public string orid { get; set; } = "32929"; + + } + + public class ResultatkomponenterAndreIFRSFjoraret32930 + { + [RegularExpression(@"^-?[0-9]{0,15}$")] + [Range(Double.MinValue,Double.MaxValue)] + [Required] + [XmlIgnore] + [JsonPropertyName("value")] + [JsonProperty(PropertyName = "value")] + public decimal? valueNullable { get; set; } + + [XmlText] + [System.Text.Json.Serialization.JsonIgnore] + [Newtonsoft.Json.JsonIgnore] + public decimal value + { + get => valueNullable ?? default; + set + { + this.valueNullable = value; + } + } + + [XmlAttribute("orid")] + [BindNever] + public string orid { get; set; } = "32930"; + + } + + public class TotalresultatIfrs + { + [XmlElement("note", Order = 1)] + [JsonProperty("note")] + [JsonPropertyName("note")] + public NoteTotalresultatIFRS36635 note { get; set; } + + public bool ShouldSerializenote() => note?.value is not null; + + [XmlElement("aarets", Order = 2)] + [JsonProperty("aarets")] + [JsonPropertyName("aarets")] + public TotalresultatIFRS36633 aarets { get; set; } + + public bool ShouldSerializeaarets() => aarets?.valueNullable is not null; + + [XmlElement("fjoraarets", Order = 3)] + [JsonProperty("fjoraarets")] + [JsonPropertyName("fjoraarets")] + public TotalresultatIFRSFjoraaret36634 fjoraarets { get; set; } + + public bool ShouldSerializefjoraarets() => fjoraarets?.valueNullable is not null; + + } + + public class NoteTotalresultatIFRS36635 + { + [MinLength(1)] + [MaxLength(35)] + [XmlText()] + public string value { get; set; } + + [XmlAttribute("orid")] + [BindNever] + public string orid { get; set; } = "36635"; + + } + + public class TotalresultatIFRS36633 + { + [RegularExpression(@"^-?[0-9]{0,15}$")] + [Range(Double.MinValue,Double.MaxValue)] + [Required] + [XmlIgnore] + [JsonPropertyName("value")] + [JsonProperty(PropertyName = "value")] + public decimal? valueNullable { get; set; } + + [XmlText] + [System.Text.Json.Serialization.JsonIgnore] + [Newtonsoft.Json.JsonIgnore] + public decimal value + { + get => valueNullable ?? default; + set + { + this.valueNullable = value; + } + } + + [XmlAttribute("orid")] + [BindNever] + public string orid { get; set; } = "36633"; + + } + + public class TotalresultatIFRSFjoraaret36634 + { + [RegularExpression(@"^-?[0-9]{0,15}$")] + [Range(Double.MinValue,Double.MaxValue)] + [Required] + [XmlIgnore] + [JsonPropertyName("value")] + [JsonProperty(PropertyName = "value")] + public decimal? valueNullable { get; set; } + + [XmlText] + [System.Text.Json.Serialization.JsonIgnore] + [Newtonsoft.Json.JsonIgnore] + public decimal value + { + get => valueNullable ?? default; + set + { + this.valueNullable = value; + } + } + + [XmlAttribute("orid")] + [BindNever] + public string orid { get; set; } = "36634"; + + } + + public class TilleggReduksjonEgenkapital + { + [XmlElement("grunnkapital", Order = 1)] + [JsonProperty("grunnkapital")] + [JsonPropertyName("grunnkapital")] + public GrunnkapitalTilleggReduksjonEgenkapital grunnkapital { get; set; } + + [XmlElement("formaalskapitalLovpaalagteRestriksjoner", Order = 2)] + [JsonProperty("formaalskapitalLovpaalagteRestriksjoner")] + [JsonPropertyName("formaalskapitalLovpaalagteRestriksjoner")] + public FormaalskapitalLovpaalagteRestriksjonerPoster formaalskapitalLovpaalagteRestriksjoner { get; set; } + + [XmlElement("formaalskapitalEksterntPaalagteRestriksjoner", Order = 3)] + [JsonProperty("formaalskapitalEksterntPaalagteRestriksjoner")] + [JsonPropertyName("formaalskapitalEksterntPaalagteRestriksjoner")] + public FormaalskapitalEksterntPaalagteRestriksjonerTilleggReduksjonEgenkapital formaalskapitalEksterntPaalagteRestriksjoner { get; set; } + + [XmlElement("formaalskapitalSelvpaalagteRestriksjoner", Order = 4)] + [JsonProperty("formaalskapitalSelvpaalagteRestriksjoner")] + [JsonPropertyName("formaalskapitalSelvpaalagteRestriksjoner")] + public FormaalskapitalSelvpaalagteRestriksjonerPoster formaalskapitalSelvpaalagteRestriksjoner { get; set; } + + [XmlElement("annenFormaalskapital", Order = 5)] + [JsonProperty("annenFormaalskapital")] + [JsonPropertyName("annenFormaalskapital")] + public AnnenFormaalskapitalTilleggReduksjonEgenkapital annenFormaalskapital { get; set; } + + } + + public class GrunnkapitalTilleggReduksjonEgenkapital + { + [XmlElement("note", Order = 1)] + [JsonProperty("note")] + [JsonPropertyName("note")] + public NoteGrunnkapital30815 note { get; set; } + + public bool ShouldSerializenote() => note?.value is not null; + + [XmlElement("aarets", Order = 2)] + [JsonProperty("aarets")] + [JsonPropertyName("aarets")] + public Grunnkapital30816 aarets { get; set; } + + public bool ShouldSerializeaarets() => aarets?.valueNullable is not null; + + [XmlElement("fjoraarets", Order = 3)] + [JsonProperty("fjoraarets")] + [JsonPropertyName("fjoraarets")] + public GrunnkapitalFjoraret30817 fjoraarets { get; set; } + + public bool ShouldSerializefjoraarets() => fjoraarets?.valueNullable is not null; + + } + + public class NoteGrunnkapital30815 + { + [MinLength(1)] + [MaxLength(35)] + [XmlText()] + public string value { get; set; } + + [XmlAttribute("orid")] + [BindNever] + public string orid { get; set; } = "30815"; + + } + + public class Grunnkapital30816 + { + [RegularExpression(@"^-?[0-9]{0,15}$")] + [Range(Double.MinValue,Double.MaxValue)] + [Required] + [XmlIgnore] + [JsonPropertyName("value")] + [JsonProperty(PropertyName = "value")] + public decimal? valueNullable { get; set; } + + [XmlText] + [System.Text.Json.Serialization.JsonIgnore] + [Newtonsoft.Json.JsonIgnore] + public decimal value + { + get => valueNullable ?? default; + set + { + this.valueNullable = value; + } + } + + [XmlAttribute("orid")] + [BindNever] + public string orid { get; set; } = "30816"; + + } + + public class GrunnkapitalFjoraret30817 + { + [RegularExpression(@"^-?[0-9]{0,15}$")] + [Range(Double.MinValue,Double.MaxValue)] + [Required] + [XmlIgnore] + [JsonPropertyName("value")] + [JsonProperty(PropertyName = "value")] + public decimal? valueNullable { get; set; } + + [XmlText] + [System.Text.Json.Serialization.JsonIgnore] + [Newtonsoft.Json.JsonIgnore] + public decimal value + { + get => valueNullable ?? default; + set + { + this.valueNullable = value; + } + } + + [XmlAttribute("orid")] + [BindNever] + public string orid { get; set; } = "30817"; + + } + + public class FormaalskapitalLovpaalagteRestriksjonerPoster + { + [XmlElement("note", Order = 1)] + [JsonProperty("note")] + [JsonPropertyName("note")] + public NoteFormalskapitalRestriksjonerLovpalagte33445 note { get; set; } + + public bool ShouldSerializenote() => note?.value is not null; + + [XmlElement("aarets", Order = 2)] + [JsonProperty("aarets")] + [JsonPropertyName("aarets")] + public FormalskapitalRestriksjonerLovpalagte33446 aarets { get; set; } + + public bool ShouldSerializeaarets() => aarets?.valueNullable is not null; + + [XmlElement("fjoraarets", Order = 3)] + [JsonProperty("fjoraarets")] + [JsonPropertyName("fjoraarets")] + public FormalskapitalRestriksjonerLovpalagteFjoraret33447 fjoraarets { get; set; } + + public bool ShouldSerializefjoraarets() => fjoraarets?.valueNullable is not null; + + } + + public class NoteFormalskapitalRestriksjonerLovpalagte33445 + { + [MinLength(1)] + [MaxLength(35)] + [XmlText()] + public string value { get; set; } + + [XmlAttribute("orid")] + [BindNever] + public string orid { get; set; } = "33445"; + + } + + public class FormalskapitalRestriksjonerLovpalagte33446 + { + [RegularExpression(@"^-?[0-9]{0,15}$")] + [Range(Double.MinValue,Double.MaxValue)] + [Required] + [XmlIgnore] + [JsonPropertyName("value")] + [JsonProperty(PropertyName = "value")] + public decimal? valueNullable { get; set; } + + [XmlText] + [System.Text.Json.Serialization.JsonIgnore] + [Newtonsoft.Json.JsonIgnore] + public decimal value + { + get => valueNullable ?? default; + set + { + this.valueNullable = value; + } + } + + [XmlAttribute("orid")] + [BindNever] + public string orid { get; set; } = "33446"; + + } + + public class FormalskapitalRestriksjonerLovpalagteFjoraret33447 + { + [RegularExpression(@"^-?[0-9]{0,15}$")] + [Range(Double.MinValue,Double.MaxValue)] + [Required] + [XmlIgnore] + [JsonPropertyName("value")] + [JsonProperty(PropertyName = "value")] + public decimal? valueNullable { get; set; } + + [XmlText] + [System.Text.Json.Serialization.JsonIgnore] + [Newtonsoft.Json.JsonIgnore] + public decimal value + { + get => valueNullable ?? default; + set + { + this.valueNullable = value; + } + } + + [XmlAttribute("orid")] + [BindNever] + public string orid { get; set; } = "33447"; + + } + + public class FormaalskapitalEksterntPaalagteRestriksjonerTilleggReduksjonEgenkapital + { + [XmlElement("note", Order = 1)] + [JsonProperty("note")] + [JsonPropertyName("note")] + public NoteFormalskapitalRestriksjonerEksterntPalagt33448 note { get; set; } + + public bool ShouldSerializenote() => note?.value is not null; + + [XmlElement("aarets", Order = 2)] + [JsonProperty("aarets")] + [JsonPropertyName("aarets")] + public FormalskapitalRestriksjonerEksterntPalagt33449 aarets { get; set; } + + public bool ShouldSerializeaarets() => aarets?.valueNullable is not null; + + [XmlElement("fjoraarets", Order = 3)] + [JsonProperty("fjoraarets")] + [JsonPropertyName("fjoraarets")] + public FormalskapitalRestriksjonerEksterntPalagtFjoraret33450 fjoraarets { get; set; } + + public bool ShouldSerializefjoraarets() => fjoraarets?.valueNullable is not null; + + } + + public class NoteFormalskapitalRestriksjonerEksterntPalagt33448 + { + [MinLength(1)] + [MaxLength(35)] + [XmlText()] + public string value { get; set; } + + [XmlAttribute("orid")] + [BindNever] + public string orid { get; set; } = "33448"; + + } + + public class FormalskapitalRestriksjonerEksterntPalagt33449 + { + [RegularExpression(@"^-?[0-9]{0,15}$")] + [Range(Double.MinValue,Double.MaxValue)] + [Required] + [XmlIgnore] + [JsonPropertyName("value")] + [JsonProperty(PropertyName = "value")] + public decimal? valueNullable { get; set; } + + [XmlText] + [System.Text.Json.Serialization.JsonIgnore] + [Newtonsoft.Json.JsonIgnore] + public decimal value + { + get => valueNullable ?? default; + set + { + this.valueNullable = value; + } + } + + [XmlAttribute("orid")] + [BindNever] + public string orid { get; set; } = "33449"; + + } + + public class FormalskapitalRestriksjonerEksterntPalagtFjoraret33450 + { + [RegularExpression(@"^-?[0-9]{0,15}$")] + [Range(Double.MinValue,Double.MaxValue)] + [Required] + [XmlIgnore] + [JsonPropertyName("value")] + [JsonProperty(PropertyName = "value")] + public decimal? valueNullable { get; set; } + + [XmlText] + [System.Text.Json.Serialization.JsonIgnore] + [Newtonsoft.Json.JsonIgnore] + public decimal value + { + get => valueNullable ?? default; + set + { + this.valueNullable = value; + } + } + + [XmlAttribute("orid")] + [BindNever] + public string orid { get; set; } = "33450"; + + } + + public class FormaalskapitalSelvpaalagteRestriksjonerPoster + { + [XmlElement("note", Order = 1)] + [JsonProperty("note")] + [JsonPropertyName("note")] + public NoteFormalskapitalRestriksjonerSelvpalagte33451 note { get; set; } + + public bool ShouldSerializenote() => note?.value is not null; + + [XmlElement("aarets", Order = 2)] + [JsonProperty("aarets")] + [JsonPropertyName("aarets")] + public FormalskapitalRestriksjonerSelvpalagte33452 aarets { get; set; } + + public bool ShouldSerializeaarets() => aarets?.valueNullable is not null; + + [XmlElement("fjoraarets", Order = 3)] + [JsonProperty("fjoraarets")] + [JsonPropertyName("fjoraarets")] + public FormalskapitalRestriksjonerSelvpalagteFjoraret33453 fjoraarets { get; set; } + + public bool ShouldSerializefjoraarets() => fjoraarets?.valueNullable is not null; + + } + + public class NoteFormalskapitalRestriksjonerSelvpalagte33451 + { + [MinLength(1)] + [MaxLength(35)] + [XmlText()] + public string value { get; set; } + + [XmlAttribute("orid")] + [BindNever] + public string orid { get; set; } = "33451"; + + } + + public class FormalskapitalRestriksjonerSelvpalagte33452 + { + [RegularExpression(@"^-?[0-9]{0,15}$")] + [Range(Double.MinValue,Double.MaxValue)] + [Required] + [XmlIgnore] + [JsonPropertyName("value")] + [JsonProperty(PropertyName = "value")] + public decimal? valueNullable { get; set; } + + [XmlText] + [System.Text.Json.Serialization.JsonIgnore] + [Newtonsoft.Json.JsonIgnore] + public decimal value + { + get => valueNullable ?? default; + set + { + this.valueNullable = value; + } + } + + [XmlAttribute("orid")] + [BindNever] + public string orid { get; set; } = "33452"; + + } + + public class FormalskapitalRestriksjonerSelvpalagteFjoraret33453 + { + [RegularExpression(@"^-?[0-9]{0,15}$")] + [Range(Double.MinValue,Double.MaxValue)] + [Required] + [XmlIgnore] + [JsonPropertyName("value")] + [JsonProperty(PropertyName = "value")] + public decimal? valueNullable { get; set; } + + [XmlText] + [System.Text.Json.Serialization.JsonIgnore] + [Newtonsoft.Json.JsonIgnore] + public decimal value + { + get => valueNullable ?? default; + set + { + this.valueNullable = value; + } + } + + [XmlAttribute("orid")] + [BindNever] + public string orid { get; set; } = "33453"; + + } + + public class AnnenFormaalskapitalTilleggReduksjonEgenkapital + { + [XmlElement("note", Order = 1)] + [JsonProperty("note")] + [JsonPropertyName("note")] + public NoteFormalskapitalAnnen33454 note { get; set; } + + public bool ShouldSerializenote() => note?.value is not null; + + [XmlElement("aarets", Order = 2)] + [JsonProperty("aarets")] + [JsonPropertyName("aarets")] + public FormalskapitalAnnen33455 aarets { get; set; } + + public bool ShouldSerializeaarets() => aarets?.valueNullable is not null; + + [XmlElement("fjoraarets", Order = 3)] + [JsonProperty("fjoraarets")] + [JsonPropertyName("fjoraarets")] + public FormalskapitalAnnenFjoraret33456 fjoraarets { get; set; } + + public bool ShouldSerializefjoraarets() => fjoraarets?.valueNullable is not null; + + } + + public class NoteFormalskapitalAnnen33454 + { + [MinLength(1)] + [MaxLength(35)] + [XmlText()] + public string value { get; set; } + + [XmlAttribute("orid")] + [BindNever] + public string orid { get; set; } = "33454"; + + } + + public class FormalskapitalAnnen33455 + { + [RegularExpression(@"^-?[0-9]{0,15}$")] + [Range(Double.MinValue,Double.MaxValue)] + [Required] + [XmlIgnore] + [JsonPropertyName("value")] + [JsonProperty(PropertyName = "value")] + public decimal? valueNullable { get; set; } + + [XmlText] + [System.Text.Json.Serialization.JsonIgnore] + [Newtonsoft.Json.JsonIgnore] + public decimal value + { + get => valueNullable ?? default; + set + { + this.valueNullable = value; + } + } + + [XmlAttribute("orid")] + [BindNever] + public string orid { get; set; } = "33455"; + + } + + public class FormalskapitalAnnenFjoraret33456 + { + [RegularExpression(@"^-?[0-9]{0,15}$")] + [Range(Double.MinValue,Double.MaxValue)] + [Required] + [XmlIgnore] + [JsonPropertyName("value")] + [JsonProperty(PropertyName = "value")] + public decimal? valueNullable { get; set; } + + [XmlText] + [System.Text.Json.Serialization.JsonIgnore] + [Newtonsoft.Json.JsonIgnore] + public decimal value + { + get => valueNullable ?? default; + set + { + this.valueNullable = value; + } + } + + [XmlAttribute("orid")] + [BindNever] + public string orid { get; set; } = "33456"; + + } + + public class BalanseEiendelerAnleggsmidler + { + [XmlElement("immaterielleEiendeler", Order = 1)] + [JsonProperty("immaterielleEiendeler")] + [JsonPropertyName("immaterielleEiendeler")] + public ImmaterielleEiendeler immaterielleEiendeler { get; set; } + + [XmlElement("bevaringsverdigeEiendeler", Order = 2)] + [JsonProperty("bevaringsverdigeEiendeler")] + [JsonPropertyName("bevaringsverdigeEiendeler")] + public BevaringsverdigeEiendeler bevaringsverdigeEiendeler { get; set; } + + [XmlElement("andreDriftsmidler", Order = 3)] + [JsonProperty("andreDriftsmidler")] + [JsonPropertyName("andreDriftsmidler")] + public AndreDriftsmidler andreDriftsmidler { get; set; } + + [XmlElement("finansielleAnleggsmidler", Order = 4)] + [JsonProperty("finansielleAnleggsmidler")] + [JsonPropertyName("finansielleAnleggsmidler")] + public FinansielleAnleggsmidler finansielleAnleggsmidler { get; set; } + + } + + public class ImmaterielleEiendeler + { + [XmlElement("konsesjonerPatenterLisenserVaremerkerRettigheter", Order = 1)] + [JsonProperty("konsesjonerPatenterLisenserVaremerkerRettigheter")] + [JsonPropertyName("konsesjonerPatenterLisenserVaremerkerRettigheter")] + public KonsesjonerPatenterLisenserVaremerkerRettigheter konsesjonerPatenterLisenserVaremerkerRettigheter { get; set; } + + [XmlElement("utsattSkattefordel", Order = 2)] + [JsonProperty("utsattSkattefordel")] + [JsonPropertyName("utsattSkattefordel")] + public UtsattSkattefordel utsattSkattefordel { get; set; } + + [XmlElement("goodwill", Order = 3)] + [JsonProperty("goodwill")] + [JsonPropertyName("goodwill")] + public Goodwill goodwill { get; set; } + + [XmlElement("sumImmaterielleEiendeler", Order = 4)] + [JsonProperty("sumImmaterielleEiendeler")] + [JsonPropertyName("sumImmaterielleEiendeler")] + public SumImmaterielleEiendeler sumImmaterielleEiendeler { get; set; } + + } + + public class KonsesjonerPatenterLisenserVaremerkerRettigheter + { + [XmlElement("note", Order = 1)] + [JsonProperty("note")] + [JsonPropertyName("note")] + public NotePatenterRettigheter18560 note { get; set; } + + public bool ShouldSerializenote() => note?.value is not null; + + [XmlElement("aarets", Order = 2)] + [JsonProperty("aarets")] + [JsonPropertyName("aarets")] + public PatenterRettigheter205 aarets { get; set; } + + public bool ShouldSerializeaarets() => aarets?.valueNullable is not null; + + [XmlElement("fjoraarets", Order = 3)] + [JsonProperty("fjoraarets")] + [JsonPropertyName("fjoraarets")] + public PatenterRettigheterFjoraret7075 fjoraarets { get; set; } + + public bool ShouldSerializefjoraarets() => fjoraarets?.valueNullable is not null; + + } + + public class NotePatenterRettigheter18560 + { + [XmlText()] + public string value { get; set; } + + [XmlAttribute("orid")] + [BindNever] + public string orid { get; set; } = "18560"; + + } + + public class PatenterRettigheter205 + { + [RegularExpression(@"^-?[0-9]{0,15}$")] + [Range(Double.MinValue,Double.MaxValue)] + [Required] + [XmlIgnore] + [JsonPropertyName("value")] + [JsonProperty(PropertyName = "value")] + public decimal? valueNullable { get; set; } + + [XmlText] + [System.Text.Json.Serialization.JsonIgnore] + [Newtonsoft.Json.JsonIgnore] + public decimal value + { + get => valueNullable ?? default; + set + { + this.valueNullable = value; + } + } + + [XmlAttribute("orid")] + [BindNever] + public string orid { get; set; } = "205"; + + } + + public class PatenterRettigheterFjoraret7075 + { + [RegularExpression(@"^-?[0-9]{0,15}$")] + [Range(Double.MinValue,Double.MaxValue)] + [Required] + [XmlIgnore] + [JsonPropertyName("value")] + [JsonProperty(PropertyName = "value")] + public decimal? valueNullable { get; set; } + + [XmlText] + [System.Text.Json.Serialization.JsonIgnore] + [Newtonsoft.Json.JsonIgnore] + public decimal value + { + get => valueNullable ?? default; + set + { + this.valueNullable = value; + } + } + + [XmlAttribute("orid")] + [BindNever] + public string orid { get; set; } = "7075"; + + } + + public class UtsattSkattefordel + { + [XmlElement("note", Order = 1)] + [JsonProperty("note")] + [JsonPropertyName("note")] + public NoteSkattefordelUtsatt18182 note { get; set; } + + public bool ShouldSerializenote() => note?.value is not null; + + [XmlElement("aarets", Order = 2)] + [JsonProperty("aarets")] + [JsonPropertyName("aarets")] + public SkattefordelUtsatt202 aarets { get; set; } + + public bool ShouldSerializeaarets() => aarets?.valueNullable is not null; + + [XmlElement("fjoraarets", Order = 3)] + [JsonProperty("fjoraarets")] + [JsonPropertyName("fjoraarets")] + public SkattefordelUtsattFjoraret7076 fjoraarets { get; set; } + + public bool ShouldSerializefjoraarets() => fjoraarets?.valueNullable is not null; + + } + + public class NoteSkattefordelUtsatt18182 + { + [MinLength(1)] + [MaxLength(35)] + [XmlText()] + public string value { get; set; } + + [XmlAttribute("orid")] + [BindNever] + public string orid { get; set; } = "18182"; + + } + + public class SkattefordelUtsatt202 + { + [RegularExpression(@"^-?[0-9]{0,15}$")] + [Range(Double.MinValue,Double.MaxValue)] + [Required] + [XmlIgnore] + [JsonPropertyName("value")] + [JsonProperty(PropertyName = "value")] + public decimal? valueNullable { get; set; } + + [XmlText] + [System.Text.Json.Serialization.JsonIgnore] + [Newtonsoft.Json.JsonIgnore] + public decimal value + { + get => valueNullable ?? default; + set + { + this.valueNullable = value; + } + } + + [XmlAttribute("orid")] + [BindNever] + public string orid { get; set; } = "202"; + + } + + public class SkattefordelUtsattFjoraret7076 + { + [RegularExpression(@"^-?[0-9]{0,15}$")] + [Range(Double.MinValue,Double.MaxValue)] + [Required] + [XmlIgnore] + [JsonPropertyName("value")] + [JsonProperty(PropertyName = "value")] + public decimal? valueNullable { get; set; } + + [XmlText] + [System.Text.Json.Serialization.JsonIgnore] + [Newtonsoft.Json.JsonIgnore] + public decimal value + { + get => valueNullable ?? default; + set + { + this.valueNullable = value; + } + } + + [XmlAttribute("orid")] + [BindNever] + public string orid { get; set; } = "7076"; + + } + + public class Goodwill + { + [XmlElement("note", Order = 1)] + [JsonProperty("note")] + [JsonPropertyName("note")] + public NoteForretningsverdiGoodwill18183 note { get; set; } + + public bool ShouldSerializenote() => note?.value is not null; + + [XmlElement("aarets", Order = 2)] + [JsonProperty("aarets")] + [JsonPropertyName("aarets")] + public ForretningsverdiGoodwill206 aarets { get; set; } + + public bool ShouldSerializeaarets() => aarets?.valueNullable is not null; + + [XmlElement("fjoraarets", Order = 3)] + [JsonProperty("fjoraarets")] + [JsonPropertyName("fjoraarets")] + public ForretningsverdiGoodwillFjoraret7077 fjoraarets { get; set; } + + public bool ShouldSerializefjoraarets() => fjoraarets?.valueNullable is not null; + + } + + public class NoteForretningsverdiGoodwill18183 + { + [MinLength(1)] + [MaxLength(35)] + [XmlText()] + public string value { get; set; } + + [XmlAttribute("orid")] + [BindNever] + public string orid { get; set; } = "18183"; + + } + + public class ForretningsverdiGoodwill206 + { + [RegularExpression(@"^-?[0-9]{0,15}$")] + [Range(Double.MinValue,Double.MaxValue)] + [Required] + [XmlIgnore] + [JsonPropertyName("value")] + [JsonProperty(PropertyName = "value")] + public decimal? valueNullable { get; set; } + + [XmlText] + [System.Text.Json.Serialization.JsonIgnore] + [Newtonsoft.Json.JsonIgnore] + public decimal value + { + get => valueNullable ?? default; + set + { + this.valueNullable = value; + } + } + + [XmlAttribute("orid")] + [BindNever] + public string orid { get; set; } = "206"; + + } + + public class ForretningsverdiGoodwillFjoraret7077 + { + [RegularExpression(@"^-?[0-9]{0,15}$")] + [Range(Double.MinValue,Double.MaxValue)] + [Required] + [XmlIgnore] + [JsonPropertyName("value")] + [JsonProperty(PropertyName = "value")] + public decimal? valueNullable { get; set; } + + [XmlText] + [System.Text.Json.Serialization.JsonIgnore] + [Newtonsoft.Json.JsonIgnore] + public decimal value + { + get => valueNullable ?? default; + set + { + this.valueNullable = value; + } + } + + [XmlAttribute("orid")] + [BindNever] + public string orid { get; set; } = "7077"; + + } + + public class SumImmaterielleEiendeler + { + [XmlElement("note", Order = 1)] + [JsonProperty("note")] + [JsonPropertyName("note")] + public NoteEiendelerImmaterielle18180 note { get; set; } + + public bool ShouldSerializenote() => note?.value is not null; + + [XmlElement("aarets", Order = 2)] + [JsonProperty("aarets")] + [JsonPropertyName("aarets")] + public EiendelerImmaterielle2400 aarets { get; set; } + + public bool ShouldSerializeaarets() => aarets?.valueNullable is not null; + + [XmlElement("fjoraarets", Order = 3)] + [JsonProperty("fjoraarets")] + [JsonPropertyName("fjoraarets")] + public EiendelerImmaterielleFjoraret8006 fjoraarets { get; set; } + + public bool ShouldSerializefjoraarets() => fjoraarets?.valueNullable is not null; + + } + + public class NoteEiendelerImmaterielle18180 + { + [MinLength(1)] + [MaxLength(35)] + [XmlText()] + public string value { get; set; } + + [XmlAttribute("orid")] + [BindNever] + public string orid { get; set; } = "18180"; + + } + + public class EiendelerImmaterielle2400 + { + [RegularExpression(@"^-?[0-9]{0,15}$")] + [Range(Double.MinValue,Double.MaxValue)] + [Required] + [XmlIgnore] + [JsonPropertyName("value")] + [JsonProperty(PropertyName = "value")] + public decimal? valueNullable { get; set; } + + [XmlText] + [System.Text.Json.Serialization.JsonIgnore] + [Newtonsoft.Json.JsonIgnore] + public decimal value + { + get => valueNullable ?? default; + set + { + this.valueNullable = value; + } + } + + [XmlAttribute("orid")] + [BindNever] + public string orid { get; set; } = "2400"; + + } + + public class EiendelerImmaterielleFjoraret8006 + { + [RegularExpression(@"^-?[0-9]{0,15}$")] + [Range(Double.MinValue,Double.MaxValue)] + [Required] + [XmlIgnore] + [JsonPropertyName("value")] + [JsonProperty(PropertyName = "value")] + public decimal? valueNullable { get; set; } + + [XmlText] + [System.Text.Json.Serialization.JsonIgnore] + [Newtonsoft.Json.JsonIgnore] + public decimal value + { + get => valueNullable ?? default; + set + { + this.valueNullable = value; + } + } + + [XmlAttribute("orid")] + [BindNever] + public string orid { get; set; } = "8006"; + + } + + public class BevaringsverdigeEiendeler + { + [XmlElement("tomterBygningerAnnenFastEiendom", Order = 1)] + [JsonProperty("tomterBygningerAnnenFastEiendom")] + [JsonPropertyName("tomterBygningerAnnenFastEiendom")] + public TomterBygningerAnnenFastEiendom tomterBygningerAnnenFastEiendom { get; set; } + + [XmlElement("driftsloesoereInventarVerktoeyKontormaskiner", Order = 2)] + [JsonProperty("driftsloesoereInventarVerktoeyKontormaskiner")] + [JsonPropertyName("driftsloesoereInventarVerktoeyKontormaskiner")] + public DriftsloesoereInventarVerktoeyKontormaskiner driftsloesoereInventarVerktoeyKontormaskiner { get; set; } + + [XmlElement("sumBevaringsverdigeEiendeler", Order = 3)] + [JsonProperty("sumBevaringsverdigeEiendeler")] + [JsonPropertyName("sumBevaringsverdigeEiendeler")] + public SumBevaringsverdigeEiendeler sumBevaringsverdigeEiendeler { get; set; } + + } + + public class TomterBygningerAnnenFastEiendom + { + [XmlElement("note", Order = 1)] + [JsonProperty("note")] + [JsonPropertyName("note")] + public NoteFastEiendom18178 note { get; set; } + + public bool ShouldSerializenote() => note?.value is not null; + + [XmlElement("aarets", Order = 2)] + [JsonProperty("aarets")] + [JsonPropertyName("aarets")] + public FastEiendom1976 aarets { get; set; } + + public bool ShouldSerializeaarets() => aarets?.valueNullable is not null; + + [XmlElement("fjoraarets", Order = 3)] + [JsonProperty("fjoraarets")] + [JsonPropertyName("fjoraarets")] + public FastEiendomFjoraret8007 fjoraarets { get; set; } + + public bool ShouldSerializefjoraarets() => fjoraarets?.valueNullable is not null; + + } + + public class NoteFastEiendom18178 + { + [MinLength(1)] + [MaxLength(35)] + [XmlText()] + public string value { get; set; } + + [XmlAttribute("orid")] + [BindNever] + public string orid { get; set; } = "18178"; + + } + + public class FastEiendom1976 + { + [RegularExpression(@"^-?[0-9]{0,15}$")] + [Range(Double.MinValue,Double.MaxValue)] + [Required] + [XmlIgnore] + [JsonPropertyName("value")] + [JsonProperty(PropertyName = "value")] + public decimal? valueNullable { get; set; } + + [XmlText] + [System.Text.Json.Serialization.JsonIgnore] + [Newtonsoft.Json.JsonIgnore] + public decimal value + { + get => valueNullable ?? default; + set + { + this.valueNullable = value; + } + } + + [XmlAttribute("orid")] + [BindNever] + public string orid { get; set; } = "1976"; + + } + + public class FastEiendomFjoraret8007 + { + [RegularExpression(@"^-?[0-9]{0,15}$")] + [Range(Double.MinValue,Double.MaxValue)] + [Required] + [XmlIgnore] + [JsonPropertyName("value")] + [JsonProperty(PropertyName = "value")] + public decimal? valueNullable { get; set; } + + [XmlText] + [System.Text.Json.Serialization.JsonIgnore] + [Newtonsoft.Json.JsonIgnore] + public decimal value + { + get => valueNullable ?? default; + set + { + this.valueNullable = value; + } + } + + [XmlAttribute("orid")] + [BindNever] + public string orid { get; set; } = "8007"; + + } + + public class DriftsloesoereInventarVerktoeyKontormaskiner + { + [XmlElement("note", Order = 1)] + [JsonProperty("note")] + [JsonPropertyName("note")] + public NoteKjoretoyInventarVerktoyMv18562 note { get; set; } + + public bool ShouldSerializenote() => note?.value is not null; + + [XmlElement("aarets", Order = 2)] + [JsonProperty("aarets")] + [JsonPropertyName("aarets")] + public KjoretoyInventarVerktoyMv7725 aarets { get; set; } + + public bool ShouldSerializeaarets() => aarets?.valueNullable is not null; + + [XmlElement("fjoraarets", Order = 3)] + [JsonProperty("fjoraarets")] + [JsonPropertyName("fjoraarets")] + public KjoretoyInventarVerktoyMvFjoraret8009 fjoraarets { get; set; } + + public bool ShouldSerializefjoraarets() => fjoraarets?.valueNullable is not null; + + } + + public class NoteKjoretoyInventarVerktoyMv18562 + { + [MinLength(1)] + [MaxLength(35)] + [XmlText()] + public string value { get; set; } + + [XmlAttribute("orid")] + [BindNever] + public string orid { get; set; } = "18562"; + + } + + public class KjoretoyInventarVerktoyMv7725 + { + [RegularExpression(@"^-?[0-9]{0,15}$")] + [Range(Double.MinValue,Double.MaxValue)] + [Required] + [XmlIgnore] + [JsonPropertyName("value")] + [JsonProperty(PropertyName = "value")] + public decimal? valueNullable { get; set; } + + [XmlText] + [System.Text.Json.Serialization.JsonIgnore] + [Newtonsoft.Json.JsonIgnore] + public decimal value + { + get => valueNullable ?? default; + set + { + this.valueNullable = value; + } + } + + [XmlAttribute("orid")] + [BindNever] + public string orid { get; set; } = "7725"; + + } + + public class KjoretoyInventarVerktoyMvFjoraret8009 + { + [RegularExpression(@"^-?[0-9]{0,15}$")] + [Range(Double.MinValue,Double.MaxValue)] + [Required] + [XmlIgnore] + [JsonPropertyName("value")] + [JsonProperty(PropertyName = "value")] + public decimal? valueNullable { get; set; } + + [XmlText] + [System.Text.Json.Serialization.JsonIgnore] + [Newtonsoft.Json.JsonIgnore] + public decimal value + { + get => valueNullable ?? default; + set + { + this.valueNullable = value; + } + } + + [XmlAttribute("orid")] + [BindNever] + public string orid { get; set; } = "8009"; + + } + + public class SumBevaringsverdigeEiendeler + { + [XmlElement("note", Order = 1)] + [JsonProperty("note")] + [JsonPropertyName("note")] + public NoteDriftsmidlerVarige18176 note { get; set; } + + public bool ShouldSerializenote() => note?.value is not null; + + [XmlElement("aarets", Order = 2)] + [JsonProperty("aarets")] + [JsonPropertyName("aarets")] + public DriftsmidlerVarige47 aarets { get; set; } + + public bool ShouldSerializeaarets() => aarets?.valueNullable is not null; + + [XmlElement("fjoraarets", Order = 3)] + [JsonProperty("fjoraarets")] + [JsonPropertyName("fjoraarets")] + public DriftsmidlerVarigeFjoraret8010 fjoraarets { get; set; } + + public bool ShouldSerializefjoraarets() => fjoraarets?.valueNullable is not null; + + } + + public class NoteDriftsmidlerVarige18176 + { + [MinLength(1)] + [MaxLength(35)] + [XmlText()] + public string value { get; set; } + + [XmlAttribute("orid")] + [BindNever] + public string orid { get; set; } = "18176"; + + } + + public class DriftsmidlerVarige47 + { + [RegularExpression(@"^-?[0-9]{0,15}$")] + [Range(Double.MinValue,Double.MaxValue)] + [Required] + [XmlIgnore] + [JsonPropertyName("value")] + [JsonProperty(PropertyName = "value")] + public decimal? valueNullable { get; set; } + + [XmlText] + [System.Text.Json.Serialization.JsonIgnore] + [Newtonsoft.Json.JsonIgnore] + public decimal value + { + get => valueNullable ?? default; + set + { + this.valueNullable = value; + } + } + + [XmlAttribute("orid")] + [BindNever] + public string orid { get; set; } = "47"; + + } + + public class DriftsmidlerVarigeFjoraret8010 + { + [RegularExpression(@"^-?[0-9]{0,15}$")] + [Range(Double.MinValue,Double.MaxValue)] + [Required] + [XmlIgnore] + [JsonPropertyName("value")] + [JsonProperty(PropertyName = "value")] + public decimal? valueNullable { get; set; } + + [XmlText] + [System.Text.Json.Serialization.JsonIgnore] + [Newtonsoft.Json.JsonIgnore] + public decimal value + { + get => valueNullable ?? default; + set + { + this.valueNullable = value; + } + } + + [XmlAttribute("orid")] + [BindNever] + public string orid { get; set; } = "8010"; + + } + + public class AndreDriftsmidler + { + [XmlElement("andreDriftsmidler", Order = 1)] + [JsonProperty("andreDriftsmidler")] + [JsonPropertyName("andreDriftsmidler")] + public AndreDriftsmidlerPoster andreDriftsmidler { get; set; } + + [XmlElement("sumAndreDriftsmidler", Order = 2)] + [JsonProperty("sumAndreDriftsmidler")] + [JsonPropertyName("sumAndreDriftsmidler")] + public SumAndreDriftsmidler sumAndreDriftsmidler { get; set; } + + } + + public class AndreDriftsmidlerPoster + { + [XmlElement("note", Order = 1)] + [JsonProperty("note")] + [JsonPropertyName("note")] + public NoteDriftsmidlerAndre18177 note { get; set; } + + public bool ShouldSerializenote() => note?.value is not null; + + [XmlElement("aarets", Order = 2)] + [JsonProperty("aarets")] + [JsonPropertyName("aarets")] + public DriftsmidlerAndre2836 aarets { get; set; } + + public bool ShouldSerializeaarets() => aarets?.valueNullable is not null; + + [XmlElement("fjoraarets", Order = 3)] + [JsonProperty("fjoraarets")] + [JsonPropertyName("fjoraarets")] + public DriftsmidlerAndreFjoraret7088 fjoraarets { get; set; } + + public bool ShouldSerializefjoraarets() => fjoraarets?.valueNullable is not null; + + } + + public class NoteDriftsmidlerAndre18177 + { + [MinLength(1)] + [MaxLength(35)] + [XmlText()] + public string value { get; set; } + + [XmlAttribute("orid")] + [BindNever] + public string orid { get; set; } = "18177"; + + } + + public class DriftsmidlerAndre2836 + { + [RegularExpression(@"^-?[0-9]{0,15}$")] + [Range(Double.MinValue,Double.MaxValue)] + [Required] + [XmlIgnore] + [JsonPropertyName("value")] + [JsonProperty(PropertyName = "value")] + public decimal? valueNullable { get; set; } + + [XmlText] + [System.Text.Json.Serialization.JsonIgnore] + [Newtonsoft.Json.JsonIgnore] + public decimal value + { + get => valueNullable ?? default; + set + { + this.valueNullable = value; + } + } + + [XmlAttribute("orid")] + [BindNever] + public string orid { get; set; } = "2836"; + + } + + public class DriftsmidlerAndreFjoraret7088 + { + [RegularExpression(@"^-?[0-9]{0,15}$")] + [Range(Double.MinValue,Double.MaxValue)] + [Required] + [XmlIgnore] + [JsonPropertyName("value")] + [JsonProperty(PropertyName = "value")] + public decimal? valueNullable { get; set; } + + [XmlText] + [System.Text.Json.Serialization.JsonIgnore] + [Newtonsoft.Json.JsonIgnore] + public decimal value + { + get => valueNullable ?? default; + set + { + this.valueNullable = value; + } + } + + [XmlAttribute("orid")] + [BindNever] + public string orid { get; set; } = "7088"; + + } + + public class SumAndreDriftsmidler + { + [XmlElement("note", Order = 1)] + [JsonProperty("note")] + [JsonPropertyName("note")] + public NoteDriftsmidlerAndre30979 note { get; set; } + + public bool ShouldSerializenote() => note?.value is not null; + + [XmlElement("aarets", Order = 2)] + [JsonProperty("aarets")] + [JsonPropertyName("aarets")] + public DriftsmidlerAndre30980 aarets { get; set; } + + public bool ShouldSerializeaarets() => aarets?.valueNullable is not null; + + [XmlElement("fjoraarets", Order = 3)] + [JsonProperty("fjoraarets")] + [JsonPropertyName("fjoraarets")] + public DriftsmidlerAndreFjoraret30981 fjoraarets { get; set; } + + public bool ShouldSerializefjoraarets() => fjoraarets?.valueNullable is not null; + + } + + public class NoteDriftsmidlerAndre30979 + { + [MinLength(1)] + [MaxLength(35)] + [XmlText()] + public string value { get; set; } + + [XmlAttribute("orid")] + [BindNever] + public string orid { get; set; } = "30979"; + + } + + public class DriftsmidlerAndre30980 + { + [RegularExpression(@"^-?[0-9]{0,15}$")] + [Range(Double.MinValue,Double.MaxValue)] + [Required] + [XmlIgnore] + [JsonPropertyName("value")] + [JsonProperty(PropertyName = "value")] + public decimal? valueNullable { get; set; } + + [XmlText] + [System.Text.Json.Serialization.JsonIgnore] + [Newtonsoft.Json.JsonIgnore] + public decimal value + { + get => valueNullable ?? default; + set + { + this.valueNullable = value; + } + } + + [XmlAttribute("orid")] + [BindNever] + public string orid { get; set; } = "30980"; + + } + + public class DriftsmidlerAndreFjoraret30981 + { + [RegularExpression(@"^-?[0-9]{0,15}$")] + [Range(Double.MinValue,Double.MaxValue)] + [Required] + [XmlIgnore] + [JsonPropertyName("value")] + [JsonProperty(PropertyName = "value")] + public decimal? valueNullable { get; set; } + + [XmlText] + [System.Text.Json.Serialization.JsonIgnore] + [Newtonsoft.Json.JsonIgnore] + public decimal value + { + get => valueNullable ?? default; + set + { + this.valueNullable = value; + } + } + + [XmlAttribute("orid")] + [BindNever] + public string orid { get; set; } = "30981"; + + } + + public class FinansielleAnleggsmidler + { + [XmlElement("investeringDatterselskap", Order = 1)] + [JsonProperty("investeringDatterselskap")] + [JsonPropertyName("investeringDatterselskap")] + public InvesteringDatterselskap investeringDatterselskap { get; set; } + + [XmlElement("investeringAksjerAndeler", Order = 2)] + [JsonProperty("investeringAksjerAndeler")] + [JsonPropertyName("investeringAksjerAndeler")] + public InvesteringAksjerAndeler investeringAksjerAndeler { get; set; } + + [XmlElement("obligasjoner", Order = 3)] + [JsonProperty("obligasjoner")] + [JsonPropertyName("obligasjoner")] + public Obligasjoner obligasjoner { get; set; } + + [XmlElement("andreFordringer", Order = 4)] + [JsonProperty("andreFordringer")] + [JsonPropertyName("andreFordringer")] + public AndreFordringerFinansielleAnleggsmidler andreFordringer { get; set; } + + [XmlElement("sumFinansielleAnleggsmidler", Order = 5)] + [JsonProperty("sumFinansielleAnleggsmidler")] + [JsonPropertyName("sumFinansielleAnleggsmidler")] + public SumFinansielleAnleggsmidler sumFinansielleAnleggsmidler { get; set; } + + [XmlElement("sumAnleggsmidler", Order = 6)] + [JsonProperty("sumAnleggsmidler")] + [JsonPropertyName("sumAnleggsmidler")] + public SumAnleggsmidler sumAnleggsmidler { get; set; } + + } + + public class InvesteringDatterselskap + { + [XmlElement("note", Order = 1)] + [JsonProperty("note")] + [JsonPropertyName("note")] + public NoteInvesteringerDatterselskap18563 note { get; set; } + + public bool ShouldSerializenote() => note?.value is not null; + + [XmlElement("aarets", Order = 2)] + [JsonProperty("aarets")] + [JsonPropertyName("aarets")] + public InvesteringerDatterselskap9686 aarets { get; set; } + + public bool ShouldSerializeaarets() => aarets?.valueNullable is not null; + + [XmlElement("fjoraarets", Order = 3)] + [JsonProperty("fjoraarets")] + [JsonPropertyName("fjoraarets")] + public InvesteringerDatterselskapFjoraret10289 fjoraarets { get; set; } + + public bool ShouldSerializefjoraarets() => fjoraarets?.valueNullable is not null; + + } + + public class NoteInvesteringerDatterselskap18563 + { + [MinLength(1)] + [MaxLength(35)] + [XmlText()] + public string value { get; set; } + + [XmlAttribute("orid")] + [BindNever] + public string orid { get; set; } = "18563"; + + } + + public class InvesteringerDatterselskap9686 + { + [RegularExpression(@"^-?[0-9]{0,15}$")] + [Range(Double.MinValue,Double.MaxValue)] + [Required] + [XmlIgnore] + [JsonPropertyName("value")] + [JsonProperty(PropertyName = "value")] + public decimal? valueNullable { get; set; } + + [XmlText] + [System.Text.Json.Serialization.JsonIgnore] + [Newtonsoft.Json.JsonIgnore] + public decimal value + { + get => valueNullable ?? default; + set + { + this.valueNullable = value; + } + } + + [XmlAttribute("orid")] + [BindNever] + public string orid { get; set; } = "9686"; + + } + + public class InvesteringerDatterselskapFjoraret10289 + { + [RegularExpression(@"^-?[0-9]{0,15}$")] + [Range(Double.MinValue,Double.MaxValue)] + [Required] + [XmlIgnore] + [JsonPropertyName("value")] + [JsonProperty(PropertyName = "value")] + public decimal? valueNullable { get; set; } + + [XmlText] + [System.Text.Json.Serialization.JsonIgnore] + [Newtonsoft.Json.JsonIgnore] + public decimal value + { + get => valueNullable ?? default; + set + { + this.valueNullable = value; + } + } + + [XmlAttribute("orid")] + [BindNever] + public string orid { get; set; } = "10289"; + + } + + public class InvesteringAksjerAndeler + { + [XmlElement("note", Order = 1)] + [JsonProperty("note")] + [JsonPropertyName("note")] + public NoteInvesteringerAksjerAndeler18568 note { get; set; } + + public bool ShouldSerializenote() => note?.value is not null; + + [XmlElement("aarets", Order = 2)] + [JsonProperty("aarets")] + [JsonPropertyName("aarets")] + public InvesteringerAksjerAndeler7100 aarets { get; set; } + + public bool ShouldSerializeaarets() => aarets?.valueNullable is not null; + + [XmlElement("fjoraarets", Order = 3)] + [JsonProperty("fjoraarets")] + [JsonPropertyName("fjoraarets")] + public InvesteringerAksjerAndelerFjoraret7101 fjoraarets { get; set; } + + public bool ShouldSerializefjoraarets() => fjoraarets?.valueNullable is not null; + + } + + public class NoteInvesteringerAksjerAndeler18568 + { + [MinLength(1)] + [MaxLength(35)] + [XmlText()] + public string value { get; set; } + + [XmlAttribute("orid")] + [BindNever] + public string orid { get; set; } = "18568"; + + } + + public class InvesteringerAksjerAndeler7100 + { + [RegularExpression(@"^-?[0-9]{0,15}$")] + [Range(Double.MinValue,Double.MaxValue)] + [Required] + [XmlIgnore] + [JsonPropertyName("value")] + [JsonProperty(PropertyName = "value")] + public decimal? valueNullable { get; set; } + + [XmlText] + [System.Text.Json.Serialization.JsonIgnore] + [Newtonsoft.Json.JsonIgnore] + public decimal value + { + get => valueNullable ?? default; + set + { + this.valueNullable = value; + } + } + + [XmlAttribute("orid")] + [BindNever] + public string orid { get; set; } = "7100"; + + } + + public class InvesteringerAksjerAndelerFjoraret7101 + { + [RegularExpression(@"^-?[0-9]{0,15}$")] + [Range(Double.MinValue,Double.MaxValue)] + [Required] + [XmlIgnore] + [JsonPropertyName("value")] + [JsonProperty(PropertyName = "value")] + public decimal? valueNullable { get; set; } + + [XmlText] + [System.Text.Json.Serialization.JsonIgnore] + [Newtonsoft.Json.JsonIgnore] + public decimal value + { + get => valueNullable ?? default; + set + { + this.valueNullable = value; + } + } + + [XmlAttribute("orid")] + [BindNever] + public string orid { get; set; } = "7101"; + + } + + public class Obligasjoner + { + [XmlElement("note", Order = 1)] + [JsonProperty("note")] + [JsonPropertyName("note")] + public NoteObligasjonerLangsiktige27582 note { get; set; } + + public bool ShouldSerializenote() => note?.value is not null; + + [XmlElement("aarets", Order = 2)] + [JsonProperty("aarets")] + [JsonPropertyName("aarets")] + public ObligasjonerLangsiktige27583 aarets { get; set; } + + public bool ShouldSerializeaarets() => aarets?.valueNullable is not null; + + [XmlElement("fjoraarets", Order = 3)] + [JsonProperty("fjoraarets")] + [JsonPropertyName("fjoraarets")] + public ObligasjonerLangsiktigeFjoraret27584 fjoraarets { get; set; } + + public bool ShouldSerializefjoraarets() => fjoraarets?.valueNullable is not null; + + } + + public class NoteObligasjonerLangsiktige27582 + { + [MinLength(1)] + [MaxLength(35)] + [XmlText()] + public string value { get; set; } + + [XmlAttribute("orid")] + [BindNever] + public string orid { get; set; } = "27582"; + + } + + public class ObligasjonerLangsiktige27583 + { + [RegularExpression(@"^-?[0-9]{0,15}$")] + [Range(Double.MinValue,Double.MaxValue)] + [Required] + [XmlIgnore] + [JsonPropertyName("value")] + [JsonProperty(PropertyName = "value")] + public decimal? valueNullable { get; set; } + + [XmlText] + [System.Text.Json.Serialization.JsonIgnore] + [Newtonsoft.Json.JsonIgnore] + public decimal value + { + get => valueNullable ?? default; + set + { + this.valueNullable = value; + } + } + + [XmlAttribute("orid")] + [BindNever] + public string orid { get; set; } = "27583"; + + } + + public class ObligasjonerLangsiktigeFjoraret27584 + { + [RegularExpression(@"^-?[0-9]{0,15}$")] + [Range(Double.MinValue,Double.MaxValue)] + [Required] + [XmlIgnore] + [JsonPropertyName("value")] + [JsonProperty(PropertyName = "value")] + public decimal? valueNullable { get; set; } + + [XmlText] + [System.Text.Json.Serialization.JsonIgnore] + [Newtonsoft.Json.JsonIgnore] + public decimal value + { + get => valueNullable ?? default; + set + { + this.valueNullable = value; + } + } + + [XmlAttribute("orid")] + [BindNever] + public string orid { get; set; } = "27584"; + + } + + public class AndreFordringerFinansielleAnleggsmidler + { + [XmlElement("note", Order = 1)] + [JsonProperty("note")] + [JsonPropertyName("note")] + public NoteFordringerAndreLangsiktige27578 note { get; set; } + + public bool ShouldSerializenote() => note?.value is not null; + + [XmlElement("aarets", Order = 2)] + [JsonProperty("aarets")] + [JsonPropertyName("aarets")] + public FordringerAndreLangsiktige203 aarets { get; set; } + + public bool ShouldSerializeaarets() => aarets?.valueNullable is not null; + + [XmlElement("fjoraarets", Order = 3)] + [JsonProperty("fjoraarets")] + [JsonPropertyName("fjoraarets")] + public FordringerAndreLangsiktigeFjoraret27585 fjoraarets { get; set; } + + public bool ShouldSerializefjoraarets() => fjoraarets?.valueNullable is not null; + + } + + public class NoteFordringerAndreLangsiktige27578 + { + [MinLength(1)] + [MaxLength(35)] + [XmlText()] + public string value { get; set; } + + [XmlAttribute("orid")] + [BindNever] + public string orid { get; set; } = "27578"; + + } + + public class FordringerAndreLangsiktige203 + { + [RegularExpression(@"^-?[0-9]{0,15}$")] + [Range(Double.MinValue,Double.MaxValue)] + [Required] + [XmlIgnore] + [JsonPropertyName("value")] + [JsonProperty(PropertyName = "value")] + public decimal? valueNullable { get; set; } + + [XmlText] + [System.Text.Json.Serialization.JsonIgnore] + [Newtonsoft.Json.JsonIgnore] + public decimal value + { + get => valueNullable ?? default; + set + { + this.valueNullable = value; + } + } + + [XmlAttribute("orid")] + [BindNever] + public string orid { get; set; } = "203"; + + } + + public class FordringerAndreLangsiktigeFjoraret27585 + { + [RegularExpression(@"^-?[0-9]{0,15}$")] + [Range(Double.MinValue,Double.MaxValue)] + [Required] + [XmlIgnore] + [JsonPropertyName("value")] + [JsonProperty(PropertyName = "value")] + public decimal? valueNullable { get; set; } + + [XmlText] + [System.Text.Json.Serialization.JsonIgnore] + [Newtonsoft.Json.JsonIgnore] + public decimal value + { + get => valueNullable ?? default; + set + { + this.valueNullable = value; + } + } + + [XmlAttribute("orid")] + [BindNever] + public string orid { get; set; } = "27585"; + + } + + public class SumFinansielleAnleggsmidler + { + [XmlElement("note", Order = 1)] + [JsonProperty("note")] + [JsonPropertyName("note")] + public NoteAnleggsmidlerFinansielle18372 note { get; set; } + + public bool ShouldSerializenote() => note?.value is not null; + + [XmlElement("aarets", Order = 2)] + [JsonProperty("aarets")] + [JsonPropertyName("aarets")] + public AnleggsmidlerFinansielle5267 aarets { get; set; } + + public bool ShouldSerializeaarets() => aarets?.valueNullable is not null; + + [XmlElement("fjoraarets", Order = 3)] + [JsonProperty("fjoraarets")] + [JsonPropertyName("fjoraarets")] + public AnleggsmidlerFinansielleFjoraret8014 fjoraarets { get; set; } + + public bool ShouldSerializefjoraarets() => fjoraarets?.valueNullable is not null; + + } + + public class NoteAnleggsmidlerFinansielle18372 + { + [MinLength(1)] + [MaxLength(35)] + [XmlText()] + public string value { get; set; } + + [XmlAttribute("orid")] + [BindNever] + public string orid { get; set; } = "18372"; + + } + + public class AnleggsmidlerFinansielle5267 + { + [RegularExpression(@"^-?[0-9]{0,15}$")] + [Range(Double.MinValue,Double.MaxValue)] + [Required] + [XmlIgnore] + [JsonPropertyName("value")] + [JsonProperty(PropertyName = "value")] + public decimal? valueNullable { get; set; } + + [XmlText] + [System.Text.Json.Serialization.JsonIgnore] + [Newtonsoft.Json.JsonIgnore] + public decimal value + { + get => valueNullable ?? default; + set + { + this.valueNullable = value; + } + } + + [XmlAttribute("orid")] + [BindNever] + public string orid { get; set; } = "5267"; + + } + + public class AnleggsmidlerFinansielleFjoraret8014 + { + [RegularExpression(@"^-?[0-9]{0,15}$")] + [Range(Double.MinValue,Double.MaxValue)] + [Required] + [XmlIgnore] + [JsonPropertyName("value")] + [JsonProperty(PropertyName = "value")] + public decimal? valueNullable { get; set; } + + [XmlText] + [System.Text.Json.Serialization.JsonIgnore] + [Newtonsoft.Json.JsonIgnore] + public decimal value + { + get => valueNullable ?? default; + set + { + this.valueNullable = value; + } + } + + [XmlAttribute("orid")] + [BindNever] + public string orid { get; set; } = "8014"; + + } + + public class SumAnleggsmidler + { + [XmlElement("note", Order = 1)] + [JsonProperty("note")] + [JsonPropertyName("note")] + public NoteAnleggsmidler18570 note { get; set; } + + public bool ShouldSerializenote() => note?.value is not null; + + [XmlElement("aarets", Order = 2)] + [JsonProperty("aarets")] + [JsonPropertyName("aarets")] + public Anleggsmidler217 aarets { get; set; } + + public bool ShouldSerializeaarets() => aarets?.valueNullable is not null; + + [XmlElement("fjoraarets", Order = 3)] + [JsonProperty("fjoraarets")] + [JsonPropertyName("fjoraarets")] + public AnleggsmidlerFjoraret7108 fjoraarets { get; set; } + + public bool ShouldSerializefjoraarets() => fjoraarets?.valueNullable is not null; + + } + + public class NoteAnleggsmidler18570 + { + [MinLength(1)] + [MaxLength(35)] + [XmlText()] + public string value { get; set; } + + [XmlAttribute("orid")] + [BindNever] + public string orid { get; set; } = "18570"; + + } + + public class Anleggsmidler217 + { + [RegularExpression(@"^-?[0-9]{0,15}$")] + [Range(Double.MinValue,Double.MaxValue)] + [Required] + [XmlIgnore] + [JsonPropertyName("value")] + [JsonProperty(PropertyName = "value")] + public decimal? valueNullable { get; set; } + + [XmlText] + [System.Text.Json.Serialization.JsonIgnore] + [Newtonsoft.Json.JsonIgnore] + public decimal value + { + get => valueNullable ?? default; + set + { + this.valueNullable = value; + } + } + + [XmlAttribute("orid")] + [BindNever] + public string orid { get; set; } = "217"; + + } + + public class AnleggsmidlerFjoraret7108 + { + [RegularExpression(@"^-?[0-9]{0,15}$")] + [Range(Double.MinValue,Double.MaxValue)] + [Required] + [XmlIgnore] + [JsonPropertyName("value")] + [JsonProperty(PropertyName = "value")] + public decimal? valueNullable { get; set; } + + [XmlText] + [System.Text.Json.Serialization.JsonIgnore] + [Newtonsoft.Json.JsonIgnore] + public decimal value + { + get => valueNullable ?? default; + set + { + this.valueNullable = value; + } + } + + [XmlAttribute("orid")] + [BindNever] + public string orid { get; set; } = "7108"; + + } + + public class BalanseEiendelerOmloepsmidler + { + [XmlElement("beholdninger", Order = 1)] + [JsonProperty("beholdninger")] + [JsonPropertyName("beholdninger")] + public Beholdninger beholdninger { get; set; } + + [XmlElement("fordringer", Order = 2)] + [JsonProperty("fordringer")] + [JsonPropertyName("fordringer")] + public Fordringer fordringer { get; set; } + + [XmlElement("investeringer", Order = 3)] + [JsonProperty("investeringer")] + [JsonPropertyName("investeringer")] + public Investeringer investeringer { get; set; } + + [XmlElement("bankinnskuddKontanter", Order = 4)] + [JsonProperty("bankinnskuddKontanter")] + [JsonPropertyName("bankinnskuddKontanter")] + public BankinnskuddKontanter bankinnskuddKontanter { get; set; } + + } + + public class Beholdninger + { + [XmlElement("lagerbeholdning", Order = 1)] + [JsonProperty("lagerbeholdning")] + [JsonPropertyName("lagerbeholdning")] + public Lagerbeholdning lagerbeholdning { get; set; } + + [XmlElement("sumBeholdninger", Order = 2)] + [JsonProperty("sumBeholdninger")] + [JsonPropertyName("sumBeholdninger")] + public SumBeholdninger sumBeholdninger { get; set; } + + } + + public class Lagerbeholdning + { + [XmlElement("note", Order = 1)] + [JsonProperty("note")] + [JsonPropertyName("note")] + public NoteLagerbeholdning30822 note { get; set; } + + public bool ShouldSerializenote() => note?.value is not null; + + [XmlElement("aarets", Order = 2)] + [JsonProperty("aarets")] + [JsonPropertyName("aarets")] + public Lagerbeholdning30823 aarets { get; set; } + + public bool ShouldSerializeaarets() => aarets?.valueNullable is not null; + + [XmlElement("fjoraarets", Order = 3)] + [JsonProperty("fjoraarets")] + [JsonPropertyName("fjoraarets")] + public LagerbeholdningFjoraret30824 fjoraarets { get; set; } + + public bool ShouldSerializefjoraarets() => fjoraarets?.valueNullable is not null; + + } + + public class NoteLagerbeholdning30822 + { + [MinLength(1)] + [MaxLength(35)] + [XmlText()] + public string value { get; set; } + + [XmlAttribute("orid")] + [BindNever] + public string orid { get; set; } = "30822"; + + } + + public class Lagerbeholdning30823 + { + [RegularExpression(@"^-?[0-9]{0,15}$")] + [Range(Double.MinValue,Double.MaxValue)] + [Required] + [XmlIgnore] + [JsonPropertyName("value")] + [JsonProperty(PropertyName = "value")] + public decimal? valueNullable { get; set; } + + [XmlText] + [System.Text.Json.Serialization.JsonIgnore] + [Newtonsoft.Json.JsonIgnore] + public decimal value + { + get => valueNullable ?? default; + set + { + this.valueNullable = value; + } + } + + [XmlAttribute("orid")] + [BindNever] + public string orid { get; set; } = "30823"; + + } + + public class LagerbeholdningFjoraret30824 + { + [RegularExpression(@"^-?[0-9]{0,15}$")] + [Range(Double.MinValue,Double.MaxValue)] + [Required] + [XmlIgnore] + [JsonPropertyName("value")] + [JsonProperty(PropertyName = "value")] + public decimal? valueNullable { get; set; } + + [XmlText] + [System.Text.Json.Serialization.JsonIgnore] + [Newtonsoft.Json.JsonIgnore] + public decimal value + { + get => valueNullable ?? default; + set + { + this.valueNullable = value; + } + } + + [XmlAttribute("orid")] + [BindNever] + public string orid { get; set; } = "30824"; + + } + + public class SumBeholdninger + { + [XmlElement("note", Order = 1)] + [JsonProperty("note")] + [JsonPropertyName("note")] + public NoteLagerbeholdning18571 note { get; set; } + + public bool ShouldSerializenote() => note?.value is not null; + + [XmlElement("aarets", Order = 2)] + [JsonProperty("aarets")] + [JsonPropertyName("aarets")] + public Lagerbeholdning326 aarets { get; set; } + + public bool ShouldSerializeaarets() => aarets?.valueNullable is not null; + + [XmlElement("fjoraarets", Order = 3)] + [JsonProperty("fjoraarets")] + [JsonPropertyName("fjoraarets")] + public LagerbeholdningFjoraret797 fjoraarets { get; set; } + + public bool ShouldSerializefjoraarets() => fjoraarets?.valueNullable is not null; + + } + + public class NoteLagerbeholdning18571 + { + [MinLength(1)] + [MaxLength(35)] + [XmlText()] + public string value { get; set; } + + [XmlAttribute("orid")] + [BindNever] + public string orid { get; set; } = "18571"; + + } + + public class Lagerbeholdning326 + { + [RegularExpression(@"^-?[0-9]{0,15}$")] + [Range(Double.MinValue,Double.MaxValue)] + [Required] + [XmlIgnore] + [JsonPropertyName("value")] + [JsonProperty(PropertyName = "value")] + public decimal? valueNullable { get; set; } + + [XmlText] + [System.Text.Json.Serialization.JsonIgnore] + [Newtonsoft.Json.JsonIgnore] + public decimal value + { + get => valueNullable ?? default; + set + { + this.valueNullable = value; + } + } + + [XmlAttribute("orid")] + [BindNever] + public string orid { get; set; } = "326"; + + } + + public class LagerbeholdningFjoraret797 + { + [RegularExpression(@"^-?[0-9]{0,15}$")] + [Range(Double.MinValue,Double.MaxValue)] + [Required] + [XmlIgnore] + [JsonPropertyName("value")] + [JsonProperty(PropertyName = "value")] + public decimal? valueNullable { get; set; } + + [XmlText] + [System.Text.Json.Serialization.JsonIgnore] + [Newtonsoft.Json.JsonIgnore] + public decimal value + { + get => valueNullable ?? default; + set + { + this.valueNullable = value; + } + } + + [XmlAttribute("orid")] + [BindNever] + public string orid { get; set; } = "797"; + + } + + public class Fordringer + { + [XmlElement("kundefordringer", Order = 1)] + [JsonProperty("kundefordringer")] + [JsonPropertyName("kundefordringer")] + public Kundefordringer kundefordringer { get; set; } + + [XmlElement("andreFordringer", Order = 2)] + [JsonProperty("andreFordringer")] + [JsonPropertyName("andreFordringer")] + public AndreFordringer andreFordringer { get; set; } + + [XmlElement("sumFordringer", Order = 3)] + [JsonProperty("sumFordringer")] + [JsonPropertyName("sumFordringer")] + public SumFordringer sumFordringer { get; set; } + + } + + public class Kundefordringer + { + [XmlElement("note", Order = 1)] + [JsonProperty("note")] + [JsonPropertyName("note")] + public NoteFordringerKunder18384 note { get; set; } + + public bool ShouldSerializenote() => note?.value is not null; + + [XmlElement("aarets", Order = 2)] + [JsonProperty("aarets")] + [JsonPropertyName("aarets")] + public FordringerKunder116 aarets { get; set; } + + public bool ShouldSerializeaarets() => aarets?.valueNullable is not null; + + [XmlElement("fjoraarets", Order = 3)] + [JsonProperty("fjoraarets")] + [JsonPropertyName("fjoraarets")] + public FordringerKunderFjoraret6921 fjoraarets { get; set; } + + public bool ShouldSerializefjoraarets() => fjoraarets?.valueNullable is not null; + + } + + public class NoteFordringerKunder18384 + { + [MinLength(1)] + [MaxLength(35)] + [XmlText()] + public string value { get; set; } + + [XmlAttribute("orid")] + [BindNever] + public string orid { get; set; } = "18384"; + + } + + public class FordringerKunder116 + { + [RegularExpression(@"^-?[0-9]{0,15}$")] + [Range(Double.MinValue,Double.MaxValue)] + [Required] + [XmlIgnore] + [JsonPropertyName("value")] + [JsonProperty(PropertyName = "value")] + public decimal? valueNullable { get; set; } + + [XmlText] + [System.Text.Json.Serialization.JsonIgnore] + [Newtonsoft.Json.JsonIgnore] + public decimal value + { + get => valueNullable ?? default; + set + { + this.valueNullable = value; + } + } + + [XmlAttribute("orid")] + [BindNever] + public string orid { get; set; } = "116"; + + } + + public class FordringerKunderFjoraret6921 + { + [RegularExpression(@"^-?[0-9]{0,15}$")] + [Range(Double.MinValue,Double.MaxValue)] + [Required] + [XmlIgnore] + [JsonPropertyName("value")] + [JsonProperty(PropertyName = "value")] + public decimal? valueNullable { get; set; } + + [XmlText] + [System.Text.Json.Serialization.JsonIgnore] + [Newtonsoft.Json.JsonIgnore] + public decimal value + { + get => valueNullable ?? default; + set + { + this.valueNullable = value; + } + } + + [XmlAttribute("orid")] + [BindNever] + public string orid { get; set; } = "6921"; + + } + + public class AndreFordringer + { + [XmlElement("note", Order = 1)] + [JsonProperty("note")] + [JsonPropertyName("note")] + public NoteFordringerAndreKortsiktig18572 note { get; set; } + + public bool ShouldSerializenote() => note?.value is not null; + + [XmlElement("aarets", Order = 2)] + [JsonProperty("aarets")] + [JsonPropertyName("aarets")] + public FordringerAndreKortsiktig282 aarets { get; set; } + + public bool ShouldSerializeaarets() => aarets?.valueNullable is not null; + + [XmlElement("fjoraarets", Order = 3)] + [JsonProperty("fjoraarets")] + [JsonPropertyName("fjoraarets")] + public FordringerAndreKortsiktigFjoraret7112 fjoraarets { get; set; } + + public bool ShouldSerializefjoraarets() => fjoraarets?.valueNullable is not null; + + } + + public class NoteFordringerAndreKortsiktig18572 + { + [MinLength(1)] + [MaxLength(35)] + [XmlText()] + public string value { get; set; } + + [XmlAttribute("orid")] + [BindNever] + public string orid { get; set; } = "18572"; + + } + + public class FordringerAndreKortsiktig282 + { + [RegularExpression(@"^-?[0-9]{0,15}$")] + [Range(Double.MinValue,Double.MaxValue)] + [Required] + [XmlIgnore] + [JsonPropertyName("value")] + [JsonProperty(PropertyName = "value")] + public decimal? valueNullable { get; set; } + + [XmlText] + [System.Text.Json.Serialization.JsonIgnore] + [Newtonsoft.Json.JsonIgnore] + public decimal value + { + get => valueNullable ?? default; + set + { + this.valueNullable = value; + } + } + + [XmlAttribute("orid")] + [BindNever] + public string orid { get; set; } = "282"; + + } + + public class FordringerAndreKortsiktigFjoraret7112 + { + [RegularExpression(@"^-?[0-9]{0,15}$")] + [Range(Double.MinValue,Double.MaxValue)] + [Required] + [XmlIgnore] + [JsonPropertyName("value")] + [JsonProperty(PropertyName = "value")] + public decimal? valueNullable { get; set; } + + [XmlText] + [System.Text.Json.Serialization.JsonIgnore] + [Newtonsoft.Json.JsonIgnore] + public decimal value + { + get => valueNullable ?? default; + set + { + this.valueNullable = value; + } + } + + [XmlAttribute("orid")] + [BindNever] + public string orid { get; set; } = "7112"; + + } + + public class SumFordringer + { + [XmlElement("note", Order = 1)] + [JsonProperty("note")] + [JsonPropertyName("note")] + public NoteFordringer18389 note { get; set; } + + public bool ShouldSerializenote() => note?.value is not null; + + [XmlElement("aarets", Order = 2)] + [JsonProperty("aarets")] + [JsonPropertyName("aarets")] + public Fordringer80 aarets { get; set; } + + public bool ShouldSerializeaarets() => aarets?.valueNullable is not null; + + [XmlElement("fjoraarets", Order = 3)] + [JsonProperty("fjoraarets")] + [JsonPropertyName("fjoraarets")] + public FordringerFjoraret8015 fjoraarets { get; set; } + + public bool ShouldSerializefjoraarets() => fjoraarets?.valueNullable is not null; + + } + + public class NoteFordringer18389 + { + [MinLength(1)] + [MaxLength(35)] + [XmlText()] + public string value { get; set; } + + [XmlAttribute("orid")] + [BindNever] + public string orid { get; set; } = "18389"; + + } + + public class Fordringer80 + { + [RegularExpression(@"^-?[0-9]{0,15}$")] + [Range(Double.MinValue,Double.MaxValue)] + [Required] + [XmlIgnore] + [JsonPropertyName("value")] + [JsonProperty(PropertyName = "value")] + public decimal? valueNullable { get; set; } + + [XmlText] + [System.Text.Json.Serialization.JsonIgnore] + [Newtonsoft.Json.JsonIgnore] + public decimal value + { + get => valueNullable ?? default; + set + { + this.valueNullable = value; + } + } + + [XmlAttribute("orid")] + [BindNever] + public string orid { get; set; } = "80"; + + } + + public class FordringerFjoraret8015 + { + [RegularExpression(@"^-?[0-9]{0,15}$")] + [Range(Double.MinValue,Double.MaxValue)] + [Required] + [XmlIgnore] + [JsonPropertyName("value")] + [JsonProperty(PropertyName = "value")] + public decimal? valueNullable { get; set; } + + [XmlText] + [System.Text.Json.Serialization.JsonIgnore] + [Newtonsoft.Json.JsonIgnore] + public decimal value + { + get => valueNullable ?? default; + set + { + this.valueNullable = value; + } + } + + [XmlAttribute("orid")] + [BindNever] + public string orid { get; set; } = "8015"; + + } + + public class Investeringer + { + [XmlElement("markedsbaserteAksjer", Order = 1)] + [JsonProperty("markedsbaserteAksjer")] + [JsonPropertyName("markedsbaserteAksjer")] + public MarkedsbaserteAksjer markedsbaserteAksjer { get; set; } + + [XmlElement("andreMarkedsbaserteFinansielleInstrumenter", Order = 2)] + [JsonProperty("andreMarkedsbaserteFinansielleInstrumenter")] + [JsonPropertyName("andreMarkedsbaserteFinansielleInstrumenter")] + public AndreMarkedsbaserteFinansielleInstrumenter andreMarkedsbaserteFinansielleInstrumenter { get; set; } + + [XmlElement("andreFinansielleInstrumenter", Order = 3)] + [JsonProperty("andreFinansielleInstrumenter")] + [JsonPropertyName("andreFinansielleInstrumenter")] + public AndreFinansielleInstrumenter andreFinansielleInstrumenter { get; set; } + + [XmlElement("sumInvesteringer", Order = 4)] + [JsonProperty("sumInvesteringer")] + [JsonPropertyName("sumInvesteringer")] + public SumInvesteringer sumInvesteringer { get; set; } + + } + + public class MarkedsbaserteAksjer + { + [XmlElement("note", Order = 1)] + [JsonProperty("note")] + [JsonPropertyName("note")] + public NoteAksjerMvMarkedsbaserte18575 note { get; set; } + + public bool ShouldSerializenote() => note?.value is not null; + + [XmlElement("aarets", Order = 2)] + [JsonProperty("aarets")] + [JsonPropertyName("aarets")] + public AksjerMvMarkedsbaserte7117 aarets { get; set; } + + public bool ShouldSerializeaarets() => aarets?.valueNullable is not null; + + [XmlElement("fjoraarets", Order = 3)] + [JsonProperty("fjoraarets")] + [JsonPropertyName("fjoraarets")] + public AksjerMvMarkedsbaserteFjoraret7118 fjoraarets { get; set; } + + public bool ShouldSerializefjoraarets() => fjoraarets?.valueNullable is not null; + + } + + public class NoteAksjerMvMarkedsbaserte18575 + { + [MinLength(1)] + [MaxLength(35)] + [XmlText()] + public string value { get; set; } + + [XmlAttribute("orid")] + [BindNever] + public string orid { get; set; } = "18575"; + + } + + public class AksjerMvMarkedsbaserte7117 + { + [RegularExpression(@"^-?[0-9]{0,15}$")] + [Range(Double.MinValue,Double.MaxValue)] + [Required] + [XmlIgnore] + [JsonPropertyName("value")] + [JsonProperty(PropertyName = "value")] + public decimal? valueNullable { get; set; } + + [XmlText] + [System.Text.Json.Serialization.JsonIgnore] + [Newtonsoft.Json.JsonIgnore] + public decimal value + { + get => valueNullable ?? default; + set + { + this.valueNullable = value; + } + } + + [XmlAttribute("orid")] + [BindNever] + public string orid { get; set; } = "7117"; + + } + + public class AksjerMvMarkedsbaserteFjoraret7118 + { + [RegularExpression(@"^-?[0-9]{0,15}$")] + [Range(Double.MinValue,Double.MaxValue)] + [Required] + [XmlIgnore] + [JsonPropertyName("value")] + [JsonProperty(PropertyName = "value")] + public decimal? valueNullable { get; set; } + + [XmlText] + [System.Text.Json.Serialization.JsonIgnore] + [Newtonsoft.Json.JsonIgnore] + public decimal value + { + get => valueNullable ?? default; + set + { + this.valueNullable = value; + } + } + + [XmlAttribute("orid")] + [BindNever] + public string orid { get; set; } = "7118"; + + } + + public class AndreMarkedsbaserteFinansielleInstrumenter + { + [XmlElement("note", Order = 1)] + [JsonProperty("note")] + [JsonPropertyName("note")] + public NoteFinansielleInstrumenterMarkedsbaserteAndre18577 note { get; set; } + + public bool ShouldSerializenote() => note?.value is not null; + + [XmlElement("aarets", Order = 2)] + [JsonProperty("aarets")] + [JsonPropertyName("aarets")] + public FinansielleInstrumenterMarkedsbaserteAndre7731 aarets { get; set; } + + public bool ShouldSerializeaarets() => aarets?.valueNullable is not null; + + [XmlElement("fjoraarets", Order = 3)] + [JsonProperty("fjoraarets")] + [JsonPropertyName("fjoraarets")] + public FinansielleInstrumenterMarkedsbaserteAndreFjoraret8017 fjoraarets { get; set; } + + public bool ShouldSerializefjoraarets() => fjoraarets?.valueNullable is not null; + + } + + public class NoteFinansielleInstrumenterMarkedsbaserteAndre18577 + { + [MinLength(1)] + [MaxLength(35)] + [XmlText()] + public string value { get; set; } + + [XmlAttribute("orid")] + [BindNever] + public string orid { get; set; } = "18577"; + + } + + public class FinansielleInstrumenterMarkedsbaserteAndre7731 + { + [RegularExpression(@"^-?[0-9]{0,15}$")] + [Range(Double.MinValue,Double.MaxValue)] + [Required] + [XmlIgnore] + [JsonPropertyName("value")] + [JsonProperty(PropertyName = "value")] + public decimal? valueNullable { get; set; } + + [XmlText] + [System.Text.Json.Serialization.JsonIgnore] + [Newtonsoft.Json.JsonIgnore] + public decimal value + { + get => valueNullable ?? default; + set + { + this.valueNullable = value; + } + } + + [XmlAttribute("orid")] + [BindNever] + public string orid { get; set; } = "7731"; + + } + + public class FinansielleInstrumenterMarkedsbaserteAndreFjoraret8017 + { + [RegularExpression(@"^-?[0-9]{0,15}$")] + [Range(Double.MinValue,Double.MaxValue)] + [Required] + [XmlIgnore] + [JsonPropertyName("value")] + [JsonProperty(PropertyName = "value")] + public decimal? valueNullable { get; set; } + + [XmlText] + [System.Text.Json.Serialization.JsonIgnore] + [Newtonsoft.Json.JsonIgnore] + public decimal value + { + get => valueNullable ?? default; + set + { + this.valueNullable = value; + } + } + + [XmlAttribute("orid")] + [BindNever] + public string orid { get; set; } = "8017"; + + } + + public class AndreFinansielleInstrumenter + { + [XmlElement("note", Order = 1)] + [JsonProperty("note")] + [JsonPropertyName("note")] + public NoteFinansielleInstrumenterAndre18578 note { get; set; } + + public bool ShouldSerializenote() => note?.value is not null; + + [XmlElement("aarets", Order = 2)] + [JsonProperty("aarets")] + [JsonPropertyName("aarets")] + public FinansielleInstrumenterAndre6429 aarets { get; set; } + + public bool ShouldSerializeaarets() => aarets?.valueNullable is not null; + + [XmlElement("fjoraarets", Order = 3)] + [JsonProperty("fjoraarets")] + [JsonPropertyName("fjoraarets")] + public FinansielleInstrumenterAndreFjoraret7123 fjoraarets { get; set; } + + public bool ShouldSerializefjoraarets() => fjoraarets?.valueNullable is not null; + + } + + public class NoteFinansielleInstrumenterAndre18578 + { + [MinLength(1)] + [MaxLength(35)] + [XmlText()] + public string value { get; set; } + + [XmlAttribute("orid")] + [BindNever] + public string orid { get; set; } = "18578"; + + } + + public class FinansielleInstrumenterAndre6429 + { + [RegularExpression(@"^-?[0-9]{0,15}$")] + [Range(Double.MinValue,Double.MaxValue)] + [Required] + [XmlIgnore] + [JsonPropertyName("value")] + [JsonProperty(PropertyName = "value")] + public decimal? valueNullable { get; set; } + + [XmlText] + [System.Text.Json.Serialization.JsonIgnore] + [Newtonsoft.Json.JsonIgnore] + public decimal value + { + get => valueNullable ?? default; + set + { + this.valueNullable = value; + } + } + + [XmlAttribute("orid")] + [BindNever] + public string orid { get; set; } = "6429"; + + } + + public class FinansielleInstrumenterAndreFjoraret7123 + { + [RegularExpression(@"^-?[0-9]{0,15}$")] + [Range(Double.MinValue,Double.MaxValue)] + [Required] + [XmlIgnore] + [JsonPropertyName("value")] + [JsonProperty(PropertyName = "value")] + public decimal? valueNullable { get; set; } + + [XmlText] + [System.Text.Json.Serialization.JsonIgnore] + [Newtonsoft.Json.JsonIgnore] + public decimal value + { + get => valueNullable ?? default; + set + { + this.valueNullable = value; + } + } + + [XmlAttribute("orid")] + [BindNever] + public string orid { get; set; } = "7123"; + + } + + public class SumInvesteringer + { + [XmlElement("note", Order = 1)] + [JsonProperty("note")] + [JsonPropertyName("note")] + public NoteInvesteringer18579 note { get; set; } + + public bool ShouldSerializenote() => note?.value is not null; + + [XmlElement("aarets", Order = 2)] + [JsonProperty("aarets")] + [JsonPropertyName("aarets")] + public Investeringer6601 aarets { get; set; } + + public bool ShouldSerializeaarets() => aarets?.valueNullable is not null; + + [XmlElement("fjoraarets", Order = 3)] + [JsonProperty("fjoraarets")] + [JsonPropertyName("fjoraarets")] + public InvesteringerFjoraret8018 fjoraarets { get; set; } + + public bool ShouldSerializefjoraarets() => fjoraarets?.valueNullable is not null; + + } + + public class NoteInvesteringer18579 + { + [MinLength(1)] + [MaxLength(35)] + [XmlText()] + public string value { get; set; } + + [XmlAttribute("orid")] + [BindNever] + public string orid { get; set; } = "18579"; + + } + + public class Investeringer6601 + { + [RegularExpression(@"^-?[0-9]{0,15}$")] + [Range(Double.MinValue,Double.MaxValue)] + [Required] + [XmlIgnore] + [JsonPropertyName("value")] + [JsonProperty(PropertyName = "value")] + public decimal? valueNullable { get; set; } + + [XmlText] + [System.Text.Json.Serialization.JsonIgnore] + [Newtonsoft.Json.JsonIgnore] + public decimal value + { + get => valueNullable ?? default; + set + { + this.valueNullable = value; + } + } + + [XmlAttribute("orid")] + [BindNever] + public string orid { get; set; } = "6601"; + + } + + public class InvesteringerFjoraret8018 + { + [RegularExpression(@"^-?[0-9]{0,15}$")] + [Range(Double.MinValue,Double.MaxValue)] + [Required] + [XmlIgnore] + [JsonPropertyName("value")] + [JsonProperty(PropertyName = "value")] + public decimal? valueNullable { get; set; } + + [XmlText] + [System.Text.Json.Serialization.JsonIgnore] + [Newtonsoft.Json.JsonIgnore] + public decimal value + { + get => valueNullable ?? default; + set + { + this.valueNullable = value; + } + } + + [XmlAttribute("orid")] + [BindNever] + public string orid { get; set; } = "8018"; + + } + + public class BankinnskuddKontanter + { + [XmlElement("bankinnskuddKontanter", Order = 1)] + [JsonProperty("bankinnskuddKontanter")] + [JsonPropertyName("bankinnskuddKontanter")] + public BankinnskuddKontanterPoster bankinnskuddKontanter { get; set; } + + [XmlElement("sumBankinnskuddKontanter", Order = 2)] + [JsonProperty("sumBankinnskuddKontanter")] + [JsonPropertyName("sumBankinnskuddKontanter")] + public SumBankinnskuddKontanter sumBankinnskuddKontanter { get; set; } + + [XmlElement("sumOmloepsmidler", Order = 3)] + [JsonProperty("sumOmloepsmidler")] + [JsonPropertyName("sumOmloepsmidler")] + public SumOmloepsmidler sumOmloepsmidler { get; set; } + + [XmlElement("sumEiendeler", Order = 4)] + [JsonProperty("sumEiendeler")] + [JsonPropertyName("sumEiendeler")] + public SumEiendeler sumEiendeler { get; set; } + + } + + public class BankinnskuddKontanterPoster + { + [XmlElement("note", Order = 1)] + [JsonProperty("note")] + [JsonPropertyName("note")] + public NoteKontanterBankinnskudd18390 note { get; set; } + + public bool ShouldSerializenote() => note?.value is not null; + + [XmlElement("aarets", Order = 2)] + [JsonProperty("aarets")] + [JsonPropertyName("aarets")] + public KontanterBankinnskudd786 aarets { get; set; } + + public bool ShouldSerializeaarets() => aarets?.valueNullable is not null; + + [XmlElement("fjoraarets", Order = 3)] + [JsonProperty("fjoraarets")] + [JsonPropertyName("fjoraarets")] + public KontanterBankinnskuddFjoraret8019 fjoraarets { get; set; } + + public bool ShouldSerializefjoraarets() => fjoraarets?.valueNullable is not null; + + } + + public class NoteKontanterBankinnskudd18390 + { + [MinLength(1)] + [MaxLength(35)] + [XmlText()] + public string value { get; set; } + + [XmlAttribute("orid")] + [BindNever] + public string orid { get; set; } = "18390"; + + } + + public class KontanterBankinnskudd786 + { + [RegularExpression(@"^-?[0-9]{0,15}$")] + [Range(Double.MinValue,Double.MaxValue)] + [Required] + [XmlIgnore] + [JsonPropertyName("value")] + [JsonProperty(PropertyName = "value")] + public decimal? valueNullable { get; set; } + + [XmlText] + [System.Text.Json.Serialization.JsonIgnore] + [Newtonsoft.Json.JsonIgnore] + public decimal value + { + get => valueNullable ?? default; + set + { + this.valueNullable = value; + } + } + + [XmlAttribute("orid")] + [BindNever] + public string orid { get; set; } = "786"; + + } + + public class KontanterBankinnskuddFjoraret8019 + { + [RegularExpression(@"^-?[0-9]{0,15}$")] + [Range(Double.MinValue,Double.MaxValue)] + [Required] + [XmlIgnore] + [JsonPropertyName("value")] + [JsonProperty(PropertyName = "value")] + public decimal? valueNullable { get; set; } + + [XmlText] + [System.Text.Json.Serialization.JsonIgnore] + [Newtonsoft.Json.JsonIgnore] + public decimal value + { + get => valueNullable ?? default; + set + { + this.valueNullable = value; + } + } + + [XmlAttribute("orid")] + [BindNever] + public string orid { get; set; } = "8019"; + + } + + public class SumBankinnskuddKontanter + { + [XmlElement("note", Order = 1)] + [JsonProperty("note")] + [JsonPropertyName("note")] + public NoteKontanterBankinnskuddSum29041 note { get; set; } + + public bool ShouldSerializenote() => note?.value is not null; + + [XmlElement("aarets", Order = 2)] + [JsonProperty("aarets")] + [JsonPropertyName("aarets")] + public KontanterBankinnskuddSum29042 aarets { get; set; } + + public bool ShouldSerializeaarets() => aarets?.valueNullable is not null; + + [XmlElement("fjoraarets", Order = 3)] + [JsonProperty("fjoraarets")] + [JsonPropertyName("fjoraarets")] + public KontanterBankinnskuddSumFjoraret29043 fjoraarets { get; set; } + + public bool ShouldSerializefjoraarets() => fjoraarets?.valueNullable is not null; + + } + + public class NoteKontanterBankinnskuddSum29041 + { + [MinLength(1)] + [MaxLength(35)] + [XmlText()] + public string value { get; set; } + + [XmlAttribute("orid")] + [BindNever] + public string orid { get; set; } = "29041"; + + } + + public class KontanterBankinnskuddSum29042 + { + [RegularExpression(@"^-?[0-9]{0,15}$")] + [Range(Double.MinValue,Double.MaxValue)] + [Required] + [XmlIgnore] + [JsonPropertyName("value")] + [JsonProperty(PropertyName = "value")] + public decimal? valueNullable { get; set; } + + [XmlText] + [System.Text.Json.Serialization.JsonIgnore] + [Newtonsoft.Json.JsonIgnore] + public decimal value + { + get => valueNullable ?? default; + set + { + this.valueNullable = value; + } + } + + [XmlAttribute("orid")] + [BindNever] + public string orid { get; set; } = "29042"; + + } + + public class KontanterBankinnskuddSumFjoraret29043 + { + [RegularExpression(@"^-?[0-9]{0,15}$")] + [Range(Double.MinValue,Double.MaxValue)] + [Required] + [XmlIgnore] + [JsonPropertyName("value")] + [JsonProperty(PropertyName = "value")] + public decimal? valueNullable { get; set; } + + [XmlText] + [System.Text.Json.Serialization.JsonIgnore] + [Newtonsoft.Json.JsonIgnore] + public decimal value + { + get => valueNullable ?? default; + set + { + this.valueNullable = value; + } + } + + [XmlAttribute("orid")] + [BindNever] + public string orid { get; set; } = "29043"; + + } + + public class SumOmloepsmidler + { + [XmlElement("note", Order = 1)] + [JsonProperty("note")] + [JsonPropertyName("note")] + public NoteOmlopsmidler18580 note { get; set; } + + public bool ShouldSerializenote() => note?.value is not null; + + [XmlElement("aarets", Order = 2)] + [JsonProperty("aarets")] + [JsonPropertyName("aarets")] + public Omlopsmidler194 aarets { get; set; } + + public bool ShouldSerializeaarets() => aarets?.valueNullable is not null; + + [XmlElement("fjoraarets", Order = 3)] + [JsonProperty("fjoraarets")] + [JsonPropertyName("fjoraarets")] + public OmlopsmidlerFjoraret7126 fjoraarets { get; set; } + + public bool ShouldSerializefjoraarets() => fjoraarets?.valueNullable is not null; + + } + + public class NoteOmlopsmidler18580 + { + [MinLength(1)] + [MaxLength(35)] + [XmlText()] + public string value { get; set; } + + [XmlAttribute("orid")] + [BindNever] + public string orid { get; set; } = "18580"; + + } + + public class Omlopsmidler194 + { + [RegularExpression(@"^-?[0-9]{0,15}$")] + [Range(Double.MinValue,Double.MaxValue)] + [Required] + [XmlIgnore] + [JsonPropertyName("value")] + [JsonProperty(PropertyName = "value")] + public decimal? valueNullable { get; set; } + + [XmlText] + [System.Text.Json.Serialization.JsonIgnore] + [Newtonsoft.Json.JsonIgnore] + public decimal value + { + get => valueNullable ?? default; + set + { + this.valueNullable = value; + } + } + + [XmlAttribute("orid")] + [BindNever] + public string orid { get; set; } = "194"; + + } + + public class OmlopsmidlerFjoraret7126 + { + [RegularExpression(@"^-?[0-9]{0,15}$")] + [Range(Double.MinValue,Double.MaxValue)] + [Required] + [XmlIgnore] + [JsonPropertyName("value")] + [JsonProperty(PropertyName = "value")] + public decimal? valueNullable { get; set; } + + [XmlText] + [System.Text.Json.Serialization.JsonIgnore] + [Newtonsoft.Json.JsonIgnore] + public decimal value + { + get => valueNullable ?? default; + set + { + this.valueNullable = value; + } + } + + [XmlAttribute("orid")] + [BindNever] + public string orid { get; set; } = "7126"; + + } + + public class SumEiendeler + { + [XmlElement("note", Order = 1)] + [JsonProperty("note")] + [JsonPropertyName("note")] + public NoteEiendeler18167 note { get; set; } + + public bool ShouldSerializenote() => note?.value is not null; + + [XmlElement("aarets", Order = 2)] + [JsonProperty("aarets")] + [JsonPropertyName("aarets")] + public Eiendeler219 aarets { get; set; } + + public bool ShouldSerializeaarets() => aarets?.valueNullable is not null; + + [XmlElement("fjoraarets", Order = 3)] + [JsonProperty("fjoraarets")] + [JsonPropertyName("fjoraarets")] + public EiendelerFjoraret7127 fjoraarets { get; set; } + + public bool ShouldSerializefjoraarets() => fjoraarets?.valueNullable is not null; + + } + + public class NoteEiendeler18167 + { + [MinLength(1)] + [MaxLength(35)] + [XmlText()] + public string value { get; set; } + + [XmlAttribute("orid")] + [BindNever] + public string orid { get; set; } = "18167"; + + } + + public class Eiendeler219 + { + [RegularExpression(@"^-?[0-9]{0,15}$")] + [Range(Double.MinValue,Double.MaxValue)] + [Required] + [XmlIgnore] + [JsonPropertyName("value")] + [JsonProperty(PropertyName = "value")] + public decimal? valueNullable { get; set; } + + [XmlText] + [System.Text.Json.Serialization.JsonIgnore] + [Newtonsoft.Json.JsonIgnore] + public decimal value + { + get => valueNullable ?? default; + set + { + this.valueNullable = value; + } + } + + [XmlAttribute("orid")] + [BindNever] + public string orid { get; set; } = "219"; + + } + + public class EiendelerFjoraret7127 + { + [RegularExpression(@"^-?[0-9]{0,15}$")] + [Range(Double.MinValue,Double.MaxValue)] + [Required] + [XmlIgnore] + [JsonPropertyName("value")] + [JsonProperty(PropertyName = "value")] + public decimal? valueNullable { get; set; } + + [XmlText] + [System.Text.Json.Serialization.JsonIgnore] + [Newtonsoft.Json.JsonIgnore] + public decimal value + { + get => valueNullable ?? default; + set + { + this.valueNullable = value; + } + } + + [XmlAttribute("orid")] + [BindNever] + public string orid { get; set; } = "7127"; + + } + + public class BalanseFormaalskapital + { + [XmlElement("grunnkapital", Order = 1)] + [JsonProperty("grunnkapital")] + [JsonPropertyName("grunnkapital")] + public Grunnkapital grunnkapital { get; set; } + + [XmlElement("formaalskapitalLovpaalagteRestriksjoner", Order = 2)] + [JsonProperty("formaalskapitalLovpaalagteRestriksjoner")] + [JsonPropertyName("formaalskapitalLovpaalagteRestriksjoner")] + public FormaalskapitalLovpaalagteRestriksjoner formaalskapitalLovpaalagteRestriksjoner { get; set; } + + [XmlElement("formaalskapitalEksterntPaalagteRestriksjoner", Order = 3)] + [JsonProperty("formaalskapitalEksterntPaalagteRestriksjoner")] + [JsonPropertyName("formaalskapitalEksterntPaalagteRestriksjoner")] + public FormaalskapitalEksterntPaalagteRestriksjoner formaalskapitalEksterntPaalagteRestriksjoner { get; set; } + + [XmlElement("formaalskapitalSelvpaalagteRestriksjoner", Order = 4)] + [JsonProperty("formaalskapitalSelvpaalagteRestriksjoner")] + [JsonPropertyName("formaalskapitalSelvpaalagteRestriksjoner")] + public FormaalskapitalSelvpaalagteRestriksjoner formaalskapitalSelvpaalagteRestriksjoner { get; set; } + + } + + public class Grunnkapital + { + [XmlElement("grunnkapital", Order = 1)] + [JsonProperty("grunnkapital")] + [JsonPropertyName("grunnkapital")] + public GrunnkapitalPoster grunnkapital { get; set; } + + [XmlElement("annenInnskuttFormaalskapital", Order = 2)] + [JsonProperty("annenInnskuttFormaalskapital")] + [JsonPropertyName("annenInnskuttFormaalskapital")] + public AnnenInnskuttFormaalskapital annenInnskuttFormaalskapital { get; set; } + + [XmlElement("sumInnskuttFormaalskapital", Order = 3)] + [JsonProperty("sumInnskuttFormaalskapital")] + [JsonPropertyName("sumInnskuttFormaalskapital")] + public SumInnskuttFormaalskapital sumInnskuttFormaalskapital { get; set; } + + } + + public class GrunnkapitalPoster + { + [XmlElement("note", Order = 1)] + [JsonProperty("note")] + [JsonPropertyName("note")] + public NoteGrunnkapital30819 note { get; set; } + + public bool ShouldSerializenote() => note?.value is not null; + + [XmlElement("aarets", Order = 2)] + [JsonProperty("aarets")] + [JsonPropertyName("aarets")] + public Grunnkapital30820 aarets { get; set; } + + public bool ShouldSerializeaarets() => aarets?.valueNullable is not null; + + [XmlElement("fjoraarets", Order = 3)] + [JsonProperty("fjoraarets")] + [JsonPropertyName("fjoraarets")] + public GrunnkapitalFjoraret30821 fjoraarets { get; set; } + + public bool ShouldSerializefjoraarets() => fjoraarets?.valueNullable is not null; + + } + + public class NoteGrunnkapital30819 + { + [MinLength(1)] + [MaxLength(35)] + [XmlText()] + public string value { get; set; } + + [XmlAttribute("orid")] + [BindNever] + public string orid { get; set; } = "30819"; + + } + + public class Grunnkapital30820 + { + [RegularExpression(@"^-?[0-9]{0,15}$")] + [Range(Double.MinValue,Double.MaxValue)] + [Required] + [XmlIgnore] + [JsonPropertyName("value")] + [JsonProperty(PropertyName = "value")] + public decimal? valueNullable { get; set; } + + [XmlText] + [System.Text.Json.Serialization.JsonIgnore] + [Newtonsoft.Json.JsonIgnore] + public decimal value + { + get => valueNullable ?? default; + set + { + this.valueNullable = value; + } + } + + [XmlAttribute("orid")] + [BindNever] + public string orid { get; set; } = "30820"; + + } + + public class GrunnkapitalFjoraret30821 + { + [RegularExpression(@"^-?[0-9]{0,15}$")] + [Range(Double.MinValue,Double.MaxValue)] + [Required] + [XmlIgnore] + [JsonPropertyName("value")] + [JsonProperty(PropertyName = "value")] + public decimal? valueNullable { get; set; } + + [XmlText] + [System.Text.Json.Serialization.JsonIgnore] + [Newtonsoft.Json.JsonIgnore] + public decimal value + { + get => valueNullable ?? default; + set + { + this.valueNullable = value; + } + } + + [XmlAttribute("orid")] + [BindNever] + public string orid { get; set; } = "30821"; + + } + + public class AnnenInnskuttFormaalskapital + { + [XmlElement("note", Order = 1)] + [JsonProperty("note")] + [JsonPropertyName("note")] + public NoteFormalskapitalInnskuttAnnen33457 note { get; set; } + + public bool ShouldSerializenote() => note?.value is not null; + + [XmlElement("aarets", Order = 2)] + [JsonProperty("aarets")] + [JsonPropertyName("aarets")] + public FormalskapitalInnskuttAnnen33458 aarets { get; set; } + + public bool ShouldSerializeaarets() => aarets?.valueNullable is not null; + + [XmlElement("fjoraarets", Order = 3)] + [JsonProperty("fjoraarets")] + [JsonPropertyName("fjoraarets")] + public FormalskapitalInnskuttAnnenFjoraret33459 fjoraarets { get; set; } + + public bool ShouldSerializefjoraarets() => fjoraarets?.valueNullable is not null; + + } + + public class NoteFormalskapitalInnskuttAnnen33457 + { + [MinLength(1)] + [MaxLength(35)] + [XmlText()] + public string value { get; set; } + + [XmlAttribute("orid")] + [BindNever] + public string orid { get; set; } = "33457"; + + } + + public class FormalskapitalInnskuttAnnen33458 + { + [RegularExpression(@"^-?[0-9]{0,15}$")] + [Range(Double.MinValue,Double.MaxValue)] + [Required] + [XmlIgnore] + [JsonPropertyName("value")] + [JsonProperty(PropertyName = "value")] + public decimal? valueNullable { get; set; } + + [XmlText] + [System.Text.Json.Serialization.JsonIgnore] + [Newtonsoft.Json.JsonIgnore] + public decimal value + { + get => valueNullable ?? default; + set + { + this.valueNullable = value; + } + } + + [XmlAttribute("orid")] + [BindNever] + public string orid { get; set; } = "33458"; + + } + + public class FormalskapitalInnskuttAnnenFjoraret33459 + { + [RegularExpression(@"^-?[0-9]{0,15}$")] + [Range(Double.MinValue,Double.MaxValue)] + [Required] + [XmlIgnore] + [JsonPropertyName("value")] + [JsonProperty(PropertyName = "value")] + public decimal? valueNullable { get; set; } + + [XmlText] + [System.Text.Json.Serialization.JsonIgnore] + [Newtonsoft.Json.JsonIgnore] + public decimal value + { + get => valueNullable ?? default; + set + { + this.valueNullable = value; + } + } + + [XmlAttribute("orid")] + [BindNever] + public string orid { get; set; } = "33459"; + + } + + public class SumInnskuttFormaalskapital + { + [XmlElement("note", Order = 1)] + [JsonProperty("note")] + [JsonPropertyName("note")] + public NoteFormalskapitalInnskuttSum33460 note { get; set; } + + public bool ShouldSerializenote() => note?.value is not null; + + [XmlElement("aarets", Order = 2)] + [JsonProperty("aarets")] + [JsonPropertyName("aarets")] + public FormalskapitalInnskuttSum33461 aarets { get; set; } + + public bool ShouldSerializeaarets() => aarets?.valueNullable is not null; + + [XmlElement("fjoraarets", Order = 3)] + [JsonProperty("fjoraarets")] + [JsonPropertyName("fjoraarets")] + public AktiviteterOppfyllerOrganisasjonensFormalFjoraret33426 fjoraarets { get; set; } + + public bool ShouldSerializefjoraarets() => fjoraarets?.valueNullable is not null; + + } + + public class NoteFormalskapitalInnskuttSum33460 + { + [MinLength(1)] + [MaxLength(35)] + [XmlText()] + public string value { get; set; } + + [XmlAttribute("orid")] + [BindNever] + public string orid { get; set; } = "33460"; + + } + + public class FormalskapitalInnskuttSum33461 + { + [RegularExpression(@"^-?[0-9]{0,15}$")] + [Range(Double.MinValue,Double.MaxValue)] + [Required] + [XmlIgnore] + [JsonPropertyName("value")] + [JsonProperty(PropertyName = "value")] + public decimal? valueNullable { get; set; } + + [XmlText] + [System.Text.Json.Serialization.JsonIgnore] + [Newtonsoft.Json.JsonIgnore] + public decimal value + { + get => valueNullable ?? default; + set + { + this.valueNullable = value; + } + } + + [XmlAttribute("orid")] + [BindNever] + public string orid { get; set; } = "33461"; + + } + + public class FormaalskapitalLovpaalagteRestriksjoner + { + [XmlElement("annenFormaalskapitalLovpaalagteRestriksjoner", Order = 1)] + [JsonProperty("annenFormaalskapitalLovpaalagteRestriksjoner")] + [JsonPropertyName("annenFormaalskapitalLovpaalagteRestriksjoner")] + public AnnenFormaalskapitalLovpaalagteRestriksjoner annenFormaalskapitalLovpaalagteRestriksjoner { get; set; } + + [XmlElement("sumOpptjentFormaalskapitalLovpaalagteRestriksjoner", Order = 2)] + [JsonProperty("sumOpptjentFormaalskapitalLovpaalagteRestriksjoner")] + [JsonPropertyName("sumOpptjentFormaalskapitalLovpaalagteRestriksjoner")] + public SumOpptjentFormaalskapitalLovpaalagteRestriksjoner sumOpptjentFormaalskapitalLovpaalagteRestriksjoner { get; set; } + + } + + public class AnnenFormaalskapitalLovpaalagteRestriksjoner + { + [XmlElement("note", Order = 1)] + [JsonProperty("note")] + [JsonPropertyName("note")] + public NoteFormalskapitalAnnenRestriksjonerLovpalagte33463 note { get; set; } + + public bool ShouldSerializenote() => note?.value is not null; + + [XmlElement("aarets", Order = 2)] + [JsonProperty("aarets")] + [JsonPropertyName("aarets")] + public FormalskapitalAnnenRestriksjonerLovpalagte33464 aarets { get; set; } + + public bool ShouldSerializeaarets() => aarets?.valueNullable is not null; + + [XmlElement("fjoraarets", Order = 3)] + [JsonProperty("fjoraarets")] + [JsonPropertyName("fjoraarets")] + public FormalskapitalAnnenRestriksjonerLovpalagteFjoraret33465 fjoraarets { get; set; } + + public bool ShouldSerializefjoraarets() => fjoraarets?.valueNullable is not null; + + } + + public class NoteFormalskapitalAnnenRestriksjonerLovpalagte33463 + { + [MinLength(1)] + [MaxLength(35)] + [XmlText()] + public string value { get; set; } + + [XmlAttribute("orid")] + [BindNever] + public string orid { get; set; } = "33463"; + + } + + public class FormalskapitalAnnenRestriksjonerLovpalagte33464 + { + [RegularExpression(@"^-?[0-9]{0,15}$")] + [Range(Double.MinValue,Double.MaxValue)] + [Required] + [XmlIgnore] + [JsonPropertyName("value")] + [JsonProperty(PropertyName = "value")] + public decimal? valueNullable { get; set; } + + [XmlText] + [System.Text.Json.Serialization.JsonIgnore] + [Newtonsoft.Json.JsonIgnore] + public decimal value + { + get => valueNullable ?? default; + set + { + this.valueNullable = value; + } + } + + [XmlAttribute("orid")] + [BindNever] + public string orid { get; set; } = "33464"; + + } + + public class FormalskapitalAnnenRestriksjonerLovpalagteFjoraret33465 + { + [RegularExpression(@"^-?[0-9]{0,15}$")] + [Range(Double.MinValue,Double.MaxValue)] + [Required] + [XmlIgnore] + [JsonPropertyName("value")] + [JsonProperty(PropertyName = "value")] + public decimal? valueNullable { get; set; } + + [XmlText] + [System.Text.Json.Serialization.JsonIgnore] + [Newtonsoft.Json.JsonIgnore] + public decimal value + { + get => valueNullable ?? default; + set + { + this.valueNullable = value; + } + } + + [XmlAttribute("orid")] + [BindNever] + public string orid { get; set; } = "33465"; + + } + + public class SumOpptjentFormaalskapitalLovpaalagteRestriksjoner + { + [XmlElement("note", Order = 1)] + [JsonProperty("note")] + [JsonPropertyName("note")] + public NoteFormalskapitalOpptjentSumRestriksjonerLovpalagte33466 note { get; set; } + + public bool ShouldSerializenote() => note?.value is not null; + + [XmlElement("aarets", Order = 2)] + [JsonProperty("aarets")] + [JsonPropertyName("aarets")] + public FormalskapitalOpptjentSumRestriksjonerLovpalagte33467 aarets { get; set; } + + public bool ShouldSerializeaarets() => aarets?.valueNullable is not null; + + [XmlElement("fjoraarets", Order = 3)] + [JsonProperty("fjoraarets")] + [JsonPropertyName("fjoraarets")] + public FormalskapitalOpptjentSumRestriksjonerLovpalagteFjoraret33468 fjoraarets { get; set; } + + public bool ShouldSerializefjoraarets() => fjoraarets?.valueNullable is not null; + + } + + public class NoteFormalskapitalOpptjentSumRestriksjonerLovpalagte33466 + { + [MinLength(1)] + [MaxLength(35)] + [XmlText()] + public string value { get; set; } + + [XmlAttribute("orid")] + [BindNever] + public string orid { get; set; } = "33466"; + + } + + public class FormalskapitalOpptjentSumRestriksjonerLovpalagte33467 + { + [RegularExpression(@"^-?[0-9]{0,15}$")] + [Range(Double.MinValue,Double.MaxValue)] + [Required] + [XmlIgnore] + [JsonPropertyName("value")] + [JsonProperty(PropertyName = "value")] + public decimal? valueNullable { get; set; } + + [XmlText] + [System.Text.Json.Serialization.JsonIgnore] + [Newtonsoft.Json.JsonIgnore] + public decimal value + { + get => valueNullable ?? default; + set + { + this.valueNullable = value; + } + } + + [XmlAttribute("orid")] + [BindNever] + public string orid { get; set; } = "33467"; + + } + + public class FormalskapitalOpptjentSumRestriksjonerLovpalagteFjoraret33468 + { + [RegularExpression(@"^-?[0-9]{0,15}$")] + [Range(Double.MinValue,Double.MaxValue)] + [Required] + [XmlIgnore] + [JsonPropertyName("value")] + [JsonProperty(PropertyName = "value")] + public decimal? valueNullable { get; set; } + + [XmlText] + [System.Text.Json.Serialization.JsonIgnore] + [Newtonsoft.Json.JsonIgnore] + public decimal value + { + get => valueNullable ?? default; + set + { + this.valueNullable = value; + } + } + + [XmlAttribute("orid")] + [BindNever] + public string orid { get; set; } = "33468"; + + } + + public class FormaalskapitalEksterntPaalagteRestriksjoner + { + [XmlElement("annenFormaalskapitalEksterntPaalagteRestriksjoner", Order = 1)] + [JsonProperty("annenFormaalskapitalEksterntPaalagteRestriksjoner")] + [JsonPropertyName("annenFormaalskapitalEksterntPaalagteRestriksjoner")] + public AnnenFormaalskapitalEksterntPaalagteRestriksjoner annenFormaalskapitalEksterntPaalagteRestriksjoner { get; set; } + + [XmlElement("sumFormaalskapitalEksterntPaalagteRestriksjoner", Order = 2)] + [JsonProperty("sumFormaalskapitalEksterntPaalagteRestriksjoner")] + [JsonPropertyName("sumFormaalskapitalEksterntPaalagteRestriksjoner")] + public SumFormaalskapitalEksterntPaalagteRestriksjoner sumFormaalskapitalEksterntPaalagteRestriksjoner { get; set; } + + } + + public class AnnenFormaalskapitalEksterntPaalagteRestriksjoner + { + [XmlElement("note", Order = 1)] + [JsonProperty("note")] + [JsonPropertyName("note")] + public NoteFormalskapitalAnnenRestriksjonerEksterntPalagte33469 note { get; set; } + + public bool ShouldSerializenote() => note?.value is not null; + + [XmlElement("aarets", Order = 2)] + [JsonProperty("aarets")] + [JsonPropertyName("aarets")] + public FormalskapitalAnnenRestriksjonerEksterntPalagte33470 aarets { get; set; } + + public bool ShouldSerializeaarets() => aarets?.valueNullable is not null; + + [XmlElement("fjoraarets", Order = 3)] + [JsonProperty("fjoraarets")] + [JsonPropertyName("fjoraarets")] + public FormalskapitalAnnenRestriksjonerEksterntPalagteFjoraret33471 fjoraarets { get; set; } + + public bool ShouldSerializefjoraarets() => fjoraarets?.valueNullable is not null; + + } + + public class NoteFormalskapitalAnnenRestriksjonerEksterntPalagte33469 + { + [MinLength(1)] + [MaxLength(35)] + [XmlText()] + public string value { get; set; } + + [XmlAttribute("orid")] + [BindNever] + public string orid { get; set; } = "33469"; + + } + + public class FormalskapitalAnnenRestriksjonerEksterntPalagte33470 + { + [RegularExpression(@"^-?[0-9]{0,15}$")] + [Range(Double.MinValue,Double.MaxValue)] + [Required] + [XmlIgnore] + [JsonPropertyName("value")] + [JsonProperty(PropertyName = "value")] + public decimal? valueNullable { get; set; } + + [XmlText] + [System.Text.Json.Serialization.JsonIgnore] + [Newtonsoft.Json.JsonIgnore] + public decimal value + { + get => valueNullable ?? default; + set + { + this.valueNullable = value; + } + } + + [XmlAttribute("orid")] + [BindNever] + public string orid { get; set; } = "33470"; + + } + + public class FormalskapitalAnnenRestriksjonerEksterntPalagteFjoraret33471 + { + [RegularExpression(@"^-?[0-9]{0,15}$")] + [Range(Double.MinValue,Double.MaxValue)] + [Required] + [XmlIgnore] + [JsonPropertyName("value")] + [JsonProperty(PropertyName = "value")] + public decimal? valueNullable { get; set; } + + [XmlText] + [System.Text.Json.Serialization.JsonIgnore] + [Newtonsoft.Json.JsonIgnore] + public decimal value + { + get => valueNullable ?? default; + set + { + this.valueNullable = value; + } + } + + [XmlAttribute("orid")] + [BindNever] + public string orid { get; set; } = "33471"; + + } + + public class SumFormaalskapitalEksterntPaalagteRestriksjoner + { + [XmlElement("note", Order = 1)] + [JsonProperty("note")] + [JsonPropertyName("note")] + public NoteFormalskapitalSumRestriksjonerEksterntPalagte33472 note { get; set; } + + public bool ShouldSerializenote() => note?.value is not null; + + [XmlElement("aarets", Order = 2)] + [JsonProperty("aarets")] + [JsonPropertyName("aarets")] + public FormalskapitalSumRestriksjonerEksterntPalagte33473 aarets { get; set; } + + public bool ShouldSerializeaarets() => aarets?.valueNullable is not null; + + [XmlElement("fjoraarets", Order = 3)] + [JsonProperty("fjoraarets")] + [JsonPropertyName("fjoraarets")] + public FormalskapitalSumRestriksjonerEksterntPalagteFjoraret33474 fjoraarets { get; set; } + + public bool ShouldSerializefjoraarets() => fjoraarets?.valueNullable is not null; + + } + + public class NoteFormalskapitalSumRestriksjonerEksterntPalagte33472 + { + [MinLength(1)] + [MaxLength(35)] + [XmlText()] + public string value { get; set; } + + [XmlAttribute("orid")] + [BindNever] + public string orid { get; set; } = "33472"; + + } + + public class FormalskapitalSumRestriksjonerEksterntPalagte33473 + { + [RegularExpression(@"^-?[0-9]{0,15}$")] + [Range(Double.MinValue,Double.MaxValue)] + [Required] + [XmlIgnore] + [JsonPropertyName("value")] + [JsonProperty(PropertyName = "value")] + public decimal? valueNullable { get; set; } + + [XmlText] + [System.Text.Json.Serialization.JsonIgnore] + [Newtonsoft.Json.JsonIgnore] + public decimal value + { + get => valueNullable ?? default; + set + { + this.valueNullable = value; + } + } + + [XmlAttribute("orid")] + [BindNever] + public string orid { get; set; } = "33473"; + + } + + public class FormalskapitalSumRestriksjonerEksterntPalagteFjoraret33474 + { + [RegularExpression(@"^-?[0-9]{0,15}$")] + [Range(Double.MinValue,Double.MaxValue)] + [Required] + [XmlIgnore] + [JsonPropertyName("value")] + [JsonProperty(PropertyName = "value")] + public decimal? valueNullable { get; set; } + + [XmlText] + [System.Text.Json.Serialization.JsonIgnore] + [Newtonsoft.Json.JsonIgnore] + public decimal value + { + get => valueNullable ?? default; + set + { + this.valueNullable = value; + } + } + + [XmlAttribute("orid")] + [BindNever] + public string orid { get; set; } = "33474"; + + } + + public class FormaalskapitalSelvpaalagteRestriksjoner + { + [XmlElement("annenFormaalskapitalSelvpaalagteRestriksjoner", Order = 1)] + [JsonProperty("annenFormaalskapitalSelvpaalagteRestriksjoner")] + [JsonPropertyName("annenFormaalskapitalSelvpaalagteRestriksjoner")] + public AnnenFormaalskapitalSelvpaalagteRestriksjoner annenFormaalskapitalSelvpaalagteRestriksjoner { get; set; } + + [XmlElement("sumFormaalskapitalSelvpaalagteRestriksjoner", Order = 2)] + [JsonProperty("sumFormaalskapitalSelvpaalagteRestriksjoner")] + [JsonPropertyName("sumFormaalskapitalSelvpaalagteRestriksjoner")] + public SumFormaalskapitalSelvpaalagteRestriksjoner sumFormaalskapitalSelvpaalagteRestriksjoner { get; set; } + + [XmlElement("annenFormaalskapital", Order = 3)] + [JsonProperty("annenFormaalskapital")] + [JsonPropertyName("annenFormaalskapital")] + public AnnenFormaalskapital annenFormaalskapital { get; set; } + + [XmlElement("minoritetsinteresser", Order = 4)] + [JsonProperty("minoritetsinteresser")] + [JsonPropertyName("minoritetsinteresser")] + public MinoritetsinteresserFormaalskapitalSelvpaalagteRestriksjoner minoritetsinteresser { get; set; } + + [XmlElement("sumFormaalskapital", Order = 5)] + [JsonProperty("sumFormaalskapital")] + [JsonPropertyName("sumFormaalskapital")] + public SumFormaalskapital sumFormaalskapital { get; set; } + + } + + public class AnnenFormaalskapitalSelvpaalagteRestriksjoner + { + [XmlElement("note", Order = 1)] + [JsonProperty("note")] + [JsonPropertyName("note")] + public NoteFormalskapitalAnnenRestriksjonerSelpalagte33475 note { get; set; } + + public bool ShouldSerializenote() => note?.value is not null; + + [XmlElement("aarets", Order = 2)] + [JsonProperty("aarets")] + [JsonPropertyName("aarets")] + public FormalskapitalAnnenRestriksjonerSelvpalagte33476 aarets { get; set; } + + public bool ShouldSerializeaarets() => aarets?.valueNullable is not null; + + [XmlElement("fjoraarets", Order = 3)] + [JsonProperty("fjoraarets")] + [JsonPropertyName("fjoraarets")] + public FormalskapitalAnnenRestriksjonerSelvpalagteFjoraret33477 fjoraarets { get; set; } + + public bool ShouldSerializefjoraarets() => fjoraarets?.valueNullable is not null; + + } + + public class NoteFormalskapitalAnnenRestriksjonerSelpalagte33475 + { + [MinLength(1)] + [MaxLength(35)] + [XmlText()] + public string value { get; set; } + + [XmlAttribute("orid")] + [BindNever] + public string orid { get; set; } = "33475"; + + } + + public class FormalskapitalAnnenRestriksjonerSelvpalagte33476 + { + [RegularExpression(@"^-?[0-9]{0,15}$")] + [Range(Double.MinValue,Double.MaxValue)] + [Required] + [XmlIgnore] + [JsonPropertyName("value")] + [JsonProperty(PropertyName = "value")] + public decimal? valueNullable { get; set; } + + [XmlText] + [System.Text.Json.Serialization.JsonIgnore] + [Newtonsoft.Json.JsonIgnore] + public decimal value + { + get => valueNullable ?? default; + set + { + this.valueNullable = value; + } + } + + [XmlAttribute("orid")] + [BindNever] + public string orid { get; set; } = "33476"; + + } + + public class FormalskapitalAnnenRestriksjonerSelvpalagteFjoraret33477 + { + [RegularExpression(@"^-?[0-9]{0,15}$")] + [Range(Double.MinValue,Double.MaxValue)] + [Required] + [XmlIgnore] + [JsonPropertyName("value")] + [JsonProperty(PropertyName = "value")] + public decimal? valueNullable { get; set; } + + [XmlText] + [System.Text.Json.Serialization.JsonIgnore] + [Newtonsoft.Json.JsonIgnore] + public decimal value + { + get => valueNullable ?? default; + set + { + this.valueNullable = value; + } + } + + [XmlAttribute("orid")] + [BindNever] + public string orid { get; set; } = "33477"; + + } + + public class SumFormaalskapitalSelvpaalagteRestriksjoner + { + [XmlElement("note", Order = 1)] + [JsonProperty("note")] + [JsonPropertyName("note")] + public NoteFormalskapitalSumRestriksjonerSelvpalagte33478 note { get; set; } + + public bool ShouldSerializenote() => note?.value is not null; + + [XmlElement("aarets", Order = 2)] + [JsonProperty("aarets")] + [JsonPropertyName("aarets")] + public FormalskapitalSumRestriksjonerSelvpalagte33479 aarets { get; set; } + + public bool ShouldSerializeaarets() => aarets?.valueNullable is not null; + + [XmlElement("fjoraarets", Order = 3)] + [JsonProperty("fjoraarets")] + [JsonPropertyName("fjoraarets")] + public FormalskapitalSumRestriksjonerSelvpalagteFjoraret33480 fjoraarets { get; set; } + + public bool ShouldSerializefjoraarets() => fjoraarets?.valueNullable is not null; + + } + + public class NoteFormalskapitalSumRestriksjonerSelvpalagte33478 + { + [MinLength(1)] + [MaxLength(35)] + [XmlText()] + public string value { get; set; } + + [XmlAttribute("orid")] + [BindNever] + public string orid { get; set; } = "33478"; + + } + + public class FormalskapitalSumRestriksjonerSelvpalagte33479 + { + [RegularExpression(@"^-?[0-9]{0,15}$")] + [Range(Double.MinValue,Double.MaxValue)] + [Required] + [XmlIgnore] + [JsonPropertyName("value")] + [JsonProperty(PropertyName = "value")] + public decimal? valueNullable { get; set; } + + [XmlText] + [System.Text.Json.Serialization.JsonIgnore] + [Newtonsoft.Json.JsonIgnore] + public decimal value + { + get => valueNullable ?? default; + set + { + this.valueNullable = value; + } + } + + [XmlAttribute("orid")] + [BindNever] + public string orid { get; set; } = "33479"; + + } + + public class FormalskapitalSumRestriksjonerSelvpalagteFjoraret33480 + { + [RegularExpression(@"^-?[0-9]{0,15}$")] + [Range(Double.MinValue,Double.MaxValue)] + [Required] + [XmlIgnore] + [JsonPropertyName("value")] + [JsonProperty(PropertyName = "value")] + public decimal? valueNullable { get; set; } + + [XmlText] + [System.Text.Json.Serialization.JsonIgnore] + [Newtonsoft.Json.JsonIgnore] + public decimal value + { + get => valueNullable ?? default; + set + { + this.valueNullable = value; + } + } + + [XmlAttribute("orid")] + [BindNever] + public string orid { get; set; } = "33480"; + + } + + public class AnnenFormaalskapital + { + [XmlElement("note", Order = 1)] + [JsonProperty("note")] + [JsonPropertyName("note")] + public NoteFormalskapitalAnnen33481 note { get; set; } + + public bool ShouldSerializenote() => note?.value is not null; + + [XmlElement("aarets", Order = 2)] + [JsonProperty("aarets")] + [JsonPropertyName("aarets")] + public FormalskapitalAnnen33482 aarets { get; set; } + + public bool ShouldSerializeaarets() => aarets?.valueNullable is not null; + + [XmlElement("fjoraarets", Order = 3)] + [JsonProperty("fjoraarets")] + [JsonPropertyName("fjoraarets")] + public FormalskapitalAnnenFjoraret33483 fjoraarets { get; set; } + + public bool ShouldSerializefjoraarets() => fjoraarets?.valueNullable is not null; + + } + + public class NoteFormalskapitalAnnen33481 + { + [MinLength(1)] + [MaxLength(35)] + [XmlText()] + public string value { get; set; } + + [XmlAttribute("orid")] + [BindNever] + public string orid { get; set; } = "33481"; + + } + + public class FormalskapitalAnnen33482 + { + [RegularExpression(@"^-?[0-9]{0,15}$")] + [Range(Double.MinValue,Double.MaxValue)] + [Required] + [XmlIgnore] + [JsonPropertyName("value")] + [JsonProperty(PropertyName = "value")] + public decimal? valueNullable { get; set; } + + [XmlText] + [System.Text.Json.Serialization.JsonIgnore] + [Newtonsoft.Json.JsonIgnore] + public decimal value + { + get => valueNullable ?? default; + set + { + this.valueNullable = value; + } + } + + [XmlAttribute("orid")] + [BindNever] + public string orid { get; set; } = "33482"; + + } + + public class FormalskapitalAnnenFjoraret33483 + { + [RegularExpression(@"^-?[0-9]{0,15}$")] + [Range(Double.MinValue,Double.MaxValue)] + [Required] + [XmlIgnore] + [JsonPropertyName("value")] + [JsonProperty(PropertyName = "value")] + public decimal? valueNullable { get; set; } + + [XmlText] + [System.Text.Json.Serialization.JsonIgnore] + [Newtonsoft.Json.JsonIgnore] + public decimal value + { + get => valueNullable ?? default; + set + { + this.valueNullable = value; + } + } + + [XmlAttribute("orid")] + [BindNever] + public string orid { get; set; } = "33483"; + + } + + public class MinoritetsinteresserFormaalskapitalSelvpaalagteRestriksjoner + { + [XmlElement("note", Order = 1)] + [JsonProperty("note")] + [JsonPropertyName("note")] + public NoteMinoritetsinteresser29044 note { get; set; } + + public bool ShouldSerializenote() => note?.value is not null; + + [XmlElement("aarets", Order = 2)] + [JsonProperty("aarets")] + [JsonPropertyName("aarets")] + public Minoritetsinteresser29045 aarets { get; set; } + + public bool ShouldSerializeaarets() => aarets?.valueNullable is not null; + + [XmlElement("fjoraarets", Order = 3)] + [JsonProperty("fjoraarets")] + [JsonPropertyName("fjoraarets")] + public MinoritetsinteresserFjoraret29046 fjoraarets { get; set; } + + public bool ShouldSerializefjoraarets() => fjoraarets?.valueNullable is not null; + + } + + public class NoteMinoritetsinteresser29044 + { + [MinLength(1)] + [MaxLength(35)] + [XmlText()] + public string value { get; set; } + + [XmlAttribute("orid")] + [BindNever] + public string orid { get; set; } = "29044"; + + } + + public class Minoritetsinteresser29045 + { + [RegularExpression(@"^-?[0-9]{0,15}$")] + [Range(Double.MinValue,Double.MaxValue)] + [Required] + [XmlIgnore] + [JsonPropertyName("value")] + [JsonProperty(PropertyName = "value")] + public decimal? valueNullable { get; set; } + + [XmlText] + [System.Text.Json.Serialization.JsonIgnore] + [Newtonsoft.Json.JsonIgnore] + public decimal value + { + get => valueNullable ?? default; + set + { + this.valueNullable = value; + } + } + + [XmlAttribute("orid")] + [BindNever] + public string orid { get; set; } = "29045"; + + } + + public class MinoritetsinteresserFjoraret29046 + { + [RegularExpression(@"^-?[0-9]{0,15}$")] + [Range(Double.MinValue,Double.MaxValue)] + [Required] + [XmlIgnore] + [JsonPropertyName("value")] + [JsonProperty(PropertyName = "value")] + public decimal? valueNullable { get; set; } + + [XmlText] + [System.Text.Json.Serialization.JsonIgnore] + [Newtonsoft.Json.JsonIgnore] + public decimal value + { + get => valueNullable ?? default; + set + { + this.valueNullable = value; + } + } + + [XmlAttribute("orid")] + [BindNever] + public string orid { get; set; } = "29046"; + + } + + public class SumFormaalskapital + { + [XmlElement("note", Order = 1)] + [JsonProperty("note")] + [JsonPropertyName("note")] + public NoteFormalskapitalSum33484 note { get; set; } + + public bool ShouldSerializenote() => note?.value is not null; + + [XmlElement("aarets", Order = 2)] + [JsonProperty("aarets")] + [JsonPropertyName("aarets")] + public FormalskapitalSum33485 aarets { get; set; } + + public bool ShouldSerializeaarets() => aarets?.valueNullable is not null; + + [XmlElement("fjoraarets", Order = 3)] + [JsonProperty("fjoraarets")] + [JsonPropertyName("fjoraarets")] + public FormalskapitalSumFjoraret33486 fjoraarets { get; set; } + + public bool ShouldSerializefjoraarets() => fjoraarets?.valueNullable is not null; + + } + + public class NoteFormalskapitalSum33484 + { + [MinLength(1)] + [MaxLength(35)] + [XmlText()] + public string value { get; set; } + + [XmlAttribute("orid")] + [BindNever] + public string orid { get; set; } = "33484"; + + } + + public class FormalskapitalSum33485 + { + [RegularExpression(@"^-?[0-9]{0,15}$")] + [Range(Double.MinValue,Double.MaxValue)] + [Required] + [XmlIgnore] + [JsonPropertyName("value")] + [JsonProperty(PropertyName = "value")] + public decimal? valueNullable { get; set; } + + [XmlText] + [System.Text.Json.Serialization.JsonIgnore] + [Newtonsoft.Json.JsonIgnore] + public decimal value + { + get => valueNullable ?? default; + set + { + this.valueNullable = value; + } + } + + [XmlAttribute("orid")] + [BindNever] + public string orid { get; set; } = "33485"; + + } + + public class FormalskapitalSumFjoraret33486 + { + [RegularExpression(@"^-?[0-9]{0,15}$")] + [Range(Double.MinValue,Double.MaxValue)] + [Required] + [XmlIgnore] + [JsonPropertyName("value")] + [JsonProperty(PropertyName = "value")] + public decimal? valueNullable { get; set; } + + [XmlText] + [System.Text.Json.Serialization.JsonIgnore] + [Newtonsoft.Json.JsonIgnore] + public decimal value + { + get => valueNullable ?? default; + set + { + this.valueNullable = value; + } + } + + [XmlAttribute("orid")] + [BindNever] + public string orid { get; set; } = "33486"; + + } + + public class BalanseGjeld + { + [XmlElement("avsetningerForForpliktelser", Order = 1)] + [JsonProperty("avsetningerForForpliktelser")] + [JsonPropertyName("avsetningerForForpliktelser")] + public AvsetningerForForpliktelser avsetningerForForpliktelser { get; set; } + + [XmlElement("annenLangsiktigGjeld", Order = 2)] + [JsonProperty("annenLangsiktigGjeld")] + [JsonPropertyName("annenLangsiktigGjeld")] + public AnnenLangsiktigGjeld annenLangsiktigGjeld { get; set; } + + [XmlElement("kortsiktigGjeld", Order = 3)] + [JsonProperty("kortsiktigGjeld")] + [JsonPropertyName("kortsiktigGjeld")] + public KortsiktigGjeld kortsiktigGjeld { get; set; } + + } + + public class AvsetningerForForpliktelser + { + [XmlElement("pensjonsforpliktelser", Order = 1)] + [JsonProperty("pensjonsforpliktelser")] + [JsonPropertyName("pensjonsforpliktelser")] + public Pensjonsforpliktelser pensjonsforpliktelser { get; set; } + + [XmlElement("utsattSkatt", Order = 2)] + [JsonProperty("utsattSkatt")] + [JsonPropertyName("utsattSkatt")] + public UtsattSkatt utsattSkatt { get; set; } + + [XmlElement("andreAvsetningerForpliktelser", Order = 3)] + [JsonProperty("andreAvsetningerForpliktelser")] + [JsonPropertyName("andreAvsetningerForpliktelser")] + public AndreAvsetningerForpliktelser andreAvsetningerForpliktelser { get; set; } + + [XmlElement("sumAvsetningerForpliktelser", Order = 4)] + [JsonProperty("sumAvsetningerForpliktelser")] + [JsonPropertyName("sumAvsetningerForpliktelser")] + public SumAvsetningerForpliktelser sumAvsetningerForpliktelser { get; set; } + + } + + public class Pensjonsforpliktelser + { + [XmlElement("note", Order = 1)] + [JsonProperty("note")] + [JsonPropertyName("note")] + public NotePensjonsforpliktelser18149 note { get; set; } + + public bool ShouldSerializenote() => note?.value is not null; + + [XmlElement("aarets", Order = 2)] + [JsonProperty("aarets")] + [JsonPropertyName("aarets")] + public Pensjonsforpliktelser238 aarets { get; set; } + + public bool ShouldSerializeaarets() => aarets?.valueNullable is not null; + + [XmlElement("fjoraarets", Order = 3)] + [JsonProperty("fjoraarets")] + [JsonPropertyName("fjoraarets")] + public PensjonsforpliktelserFjoraret6685 fjoraarets { get; set; } + + public bool ShouldSerializefjoraarets() => fjoraarets?.valueNullable is not null; + + } + + public class NotePensjonsforpliktelser18149 + { + [MinLength(1)] + [MaxLength(35)] + [XmlText()] + public string value { get; set; } + + [XmlAttribute("orid")] + [BindNever] + public string orid { get; set; } = "18149"; + + } + + public class Pensjonsforpliktelser238 + { + [RegularExpression(@"^-?[0-9]{0,15}$")] + [Range(Double.MinValue,Double.MaxValue)] + [Required] + [XmlIgnore] + [JsonPropertyName("value")] + [JsonProperty(PropertyName = "value")] + public decimal? valueNullable { get; set; } + + [XmlText] + [System.Text.Json.Serialization.JsonIgnore] + [Newtonsoft.Json.JsonIgnore] + public decimal value + { + get => valueNullable ?? default; + set + { + this.valueNullable = value; + } + } + + [XmlAttribute("orid")] + [BindNever] + public string orid { get; set; } = "238"; + + } + + public class PensjonsforpliktelserFjoraret6685 + { + [RegularExpression(@"^-?[0-9]{0,15}$")] + [Range(Double.MinValue,Double.MaxValue)] + [Required] + [XmlIgnore] + [JsonPropertyName("value")] + [JsonProperty(PropertyName = "value")] + public decimal? valueNullable { get; set; } + + [XmlText] + [System.Text.Json.Serialization.JsonIgnore] + [Newtonsoft.Json.JsonIgnore] + public decimal value + { + get => valueNullable ?? default; + set + { + this.valueNullable = value; + } + } + + [XmlAttribute("orid")] + [BindNever] + public string orid { get; set; } = "6685"; + + } + + public class UtsattSkatt + { + [XmlElement("note", Order = 1)] + [JsonProperty("note")] + [JsonPropertyName("note")] + public NoteSkattUtsatt18148 note { get; set; } + + public bool ShouldSerializenote() => note?.value is not null; + + [XmlElement("aarets", Order = 2)] + [JsonProperty("aarets")] + [JsonPropertyName("aarets")] + public SkattUtsatt237 aarets { get; set; } + + public bool ShouldSerializeaarets() => aarets?.valueNullable is not null; + + [XmlElement("fjoraarets", Order = 3)] + [JsonProperty("fjoraarets")] + [JsonPropertyName("fjoraarets")] + public SkattUtsattFjoraret7143 fjoraarets { get; set; } + + public bool ShouldSerializefjoraarets() => fjoraarets?.valueNullable is not null; + + } + + public class NoteSkattUtsatt18148 + { + [MinLength(1)] + [MaxLength(35)] + [XmlText()] + public string value { get; set; } + + [XmlAttribute("orid")] + [BindNever] + public string orid { get; set; } = "18148"; + + } + + public class SkattUtsatt237 + { + [RegularExpression(@"^-?[0-9]{0,15}$")] + [Range(Double.MinValue,Double.MaxValue)] + [Required] + [XmlIgnore] + [JsonPropertyName("value")] + [JsonProperty(PropertyName = "value")] + public decimal? valueNullable { get; set; } + + [XmlText] + [System.Text.Json.Serialization.JsonIgnore] + [Newtonsoft.Json.JsonIgnore] + public decimal value + { + get => valueNullable ?? default; + set + { + this.valueNullable = value; + } + } + + [XmlAttribute("orid")] + [BindNever] + public string orid { get; set; } = "237"; + + } + + public class SkattUtsattFjoraret7143 + { + [RegularExpression(@"^-?[0-9]{0,15}$")] + [Range(Double.MinValue,Double.MaxValue)] + [Required] + [XmlIgnore] + [JsonPropertyName("value")] + [JsonProperty(PropertyName = "value")] + public decimal? valueNullable { get; set; } + + [XmlText] + [System.Text.Json.Serialization.JsonIgnore] + [Newtonsoft.Json.JsonIgnore] + public decimal value + { + get => valueNullable ?? default; + set + { + this.valueNullable = value; + } + } + + [XmlAttribute("orid")] + [BindNever] + public string orid { get; set; } = "7143"; + + } + + public class AndreAvsetningerForpliktelser + { + [XmlElement("note", Order = 1)] + [JsonProperty("note")] + [JsonPropertyName("note")] + public NoteAvsetningerForpliktelserLangsiktig18582 note { get; set; } + + public bool ShouldSerializenote() => note?.value is not null; + + [XmlElement("aarets", Order = 2)] + [JsonProperty("aarets")] + [JsonPropertyName("aarets")] + public AvsetningerForpliktelserLangsiktig7157 aarets { get; set; } + + public bool ShouldSerializeaarets() => aarets?.valueNullable is not null; + + [XmlElement("fjoraarets", Order = 3)] + [JsonProperty("fjoraarets")] + [JsonPropertyName("fjoraarets")] + public AvsetningerForpliktelserLangsiktigFjoraret7146 fjoraarets { get; set; } + + public bool ShouldSerializefjoraarets() => fjoraarets?.valueNullable is not null; + + } + + public class NoteAvsetningerForpliktelserLangsiktig18582 + { + [MinLength(1)] + [MaxLength(35)] + [XmlText()] + public string value { get; set; } + + [XmlAttribute("orid")] + [BindNever] + public string orid { get; set; } = "18582"; + + } + + public class AvsetningerForpliktelserLangsiktig7157 + { + [RegularExpression(@"^-?[0-9]{0,15}$")] + [Range(Double.MinValue,Double.MaxValue)] + [Required] + [XmlIgnore] + [JsonPropertyName("value")] + [JsonProperty(PropertyName = "value")] + public decimal? valueNullable { get; set; } + + [XmlText] + [System.Text.Json.Serialization.JsonIgnore] + [Newtonsoft.Json.JsonIgnore] + public decimal value + { + get => valueNullable ?? default; + set + { + this.valueNullable = value; + } + } + + [XmlAttribute("orid")] + [BindNever] + public string orid { get; set; } = "7157"; + + } + + public class AvsetningerForpliktelserLangsiktigFjoraret7146 + { + [RegularExpression(@"^-?[0-9]{0,15}$")] + [Range(Double.MinValue,Double.MaxValue)] + [Required] + [XmlIgnore] + [JsonPropertyName("value")] + [JsonProperty(PropertyName = "value")] + public decimal? valueNullable { get; set; } + + [XmlText] + [System.Text.Json.Serialization.JsonIgnore] + [Newtonsoft.Json.JsonIgnore] + public decimal value + { + get => valueNullable ?? default; + set + { + this.valueNullable = value; + } + } + + [XmlAttribute("orid")] + [BindNever] + public string orid { get; set; } = "7146"; + + } + + public class SumAvsetningerForpliktelser + { + [XmlElement("note", Order = 1)] + [JsonProperty("note")] + [JsonPropertyName("note")] + public NoteAvsetningerForpliktelser18144 note { get; set; } + + public bool ShouldSerializenote() => note?.value is not null; + + [XmlElement("aarets", Order = 2)] + [JsonProperty("aarets")] + [JsonPropertyName("aarets")] + public AvsetningerForpliktelser7231 aarets { get; set; } + + public bool ShouldSerializeaarets() => aarets?.valueNullable is not null; + + [XmlElement("fjoraarets", Order = 3)] + [JsonProperty("fjoraarets")] + [JsonPropertyName("fjoraarets")] + public AvsetningerForpliktelserFjoraret7230 fjoraarets { get; set; } + + public bool ShouldSerializefjoraarets() => fjoraarets?.valueNullable is not null; + + } + + public class NoteAvsetningerForpliktelser18144 + { + [MinLength(1)] + [MaxLength(35)] + [XmlText()] + public string value { get; set; } + + [XmlAttribute("orid")] + [BindNever] + public string orid { get; set; } = "18144"; + + } + + public class AvsetningerForpliktelser7231 + { + [RegularExpression(@"^-?[0-9]{0,15}$")] + [Range(Double.MinValue,Double.MaxValue)] + [Required] + [XmlIgnore] + [JsonPropertyName("value")] + [JsonProperty(PropertyName = "value")] + public decimal? valueNullable { get; set; } + + [XmlText] + [System.Text.Json.Serialization.JsonIgnore] + [Newtonsoft.Json.JsonIgnore] + public decimal value + { + get => valueNullable ?? default; + set + { + this.valueNullable = value; + } + } + + [XmlAttribute("orid")] + [BindNever] + public string orid { get; set; } = "7231"; + + } + + public class AvsetningerForpliktelserFjoraret7230 + { + [RegularExpression(@"^-?[0-9]{0,15}$")] + [Range(Double.MinValue,Double.MaxValue)] + [Required] + [XmlIgnore] + [JsonPropertyName("value")] + [JsonProperty(PropertyName = "value")] + public decimal? valueNullable { get; set; } + + [XmlText] + [System.Text.Json.Serialization.JsonIgnore] + [Newtonsoft.Json.JsonIgnore] + public decimal value + { + get => valueNullable ?? default; + set + { + this.valueNullable = value; + } + } + + [XmlAttribute("orid")] + [BindNever] + public string orid { get; set; } = "7230"; + + } + + public class AnnenLangsiktigGjeld + { + [XmlElement("gjeldKredittinstitusjoner", Order = 1)] + [JsonProperty("gjeldKredittinstitusjoner")] + [JsonPropertyName("gjeldKredittinstitusjoner")] + public GjeldKredittinstitusjoner gjeldKredittinstitusjoner { get; set; } + + [XmlElement("oevrigLangsiktigGjeld", Order = 2)] + [JsonProperty("oevrigLangsiktigGjeld")] + [JsonPropertyName("oevrigLangsiktigGjeld")] + public OevrigLangsiktigGjeld oevrigLangsiktigGjeld { get; set; } + + [XmlElement("sumAnnenLangsiktigGjeld", Order = 3)] + [JsonProperty("sumAnnenLangsiktigGjeld")] + [JsonPropertyName("sumAnnenLangsiktigGjeld")] + public SumAnnenLangsiktigGjeld sumAnnenLangsiktigGjeld { get; set; } + + [XmlElement("sumLangsiktigGjeld", Order = 4)] + [JsonProperty("sumLangsiktigGjeld")] + [JsonPropertyName("sumLangsiktigGjeld")] + public SumLangsiktigGjeld sumLangsiktigGjeld { get; set; } + + } + + public class GjeldKredittinstitusjoner + { + [XmlElement("note", Order = 1)] + [JsonProperty("note")] + [JsonPropertyName("note")] + public NoteGjeldKredittinstitusjoner18164 note { get; set; } + + public bool ShouldSerializenote() => note?.value is not null; + + [XmlElement("aarets", Order = 2)] + [JsonProperty("aarets")] + [JsonPropertyName("aarets")] + public GjeldKredittinstitusjoner7150 aarets { get; set; } + + public bool ShouldSerializeaarets() => aarets?.valueNullable is not null; + + [XmlElement("fjoraarets", Order = 3)] + [JsonProperty("fjoraarets")] + [JsonPropertyName("fjoraarets")] + public GjeldKredittinstitusjonerFjoraret7151 fjoraarets { get; set; } + + public bool ShouldSerializefjoraarets() => fjoraarets?.valueNullable is not null; + + } + + public class NoteGjeldKredittinstitusjoner18164 + { + [MinLength(1)] + [MaxLength(35)] + [XmlText()] + public string value { get; set; } + + [XmlAttribute("orid")] + [BindNever] + public string orid { get; set; } = "18164"; + + } + + public class GjeldKredittinstitusjoner7150 + { + [RegularExpression(@"^-?[0-9]{0,15}$")] + [Range(Double.MinValue,Double.MaxValue)] + [Required] + [XmlIgnore] + [JsonPropertyName("value")] + [JsonProperty(PropertyName = "value")] + public decimal? valueNullable { get; set; } + + [XmlText] + [System.Text.Json.Serialization.JsonIgnore] + [Newtonsoft.Json.JsonIgnore] + public decimal value + { + get => valueNullable ?? default; + set + { + this.valueNullable = value; + } + } + + [XmlAttribute("orid")] + [BindNever] + public string orid { get; set; } = "7150"; + + } + + public class GjeldKredittinstitusjonerFjoraret7151 + { + [RegularExpression(@"^-?[0-9]{0,15}$")] + [Range(Double.MinValue,Double.MaxValue)] + [Required] + [XmlIgnore] + [JsonPropertyName("value")] + [JsonProperty(PropertyName = "value")] + public decimal? valueNullable { get; set; } + + [XmlText] + [System.Text.Json.Serialization.JsonIgnore] + [Newtonsoft.Json.JsonIgnore] + public decimal value + { + get => valueNullable ?? default; + set + { + this.valueNullable = value; + } + } + + [XmlAttribute("orid")] + [BindNever] + public string orid { get; set; } = "7151"; + + } + + public class OevrigLangsiktigGjeld + { + [XmlElement("note", Order = 1)] + [JsonProperty("note")] + [JsonPropertyName("note")] + public NoteGjeldAnnenLangsiktig18584 note { get; set; } + + public bool ShouldSerializenote() => note?.value is not null; + + [XmlElement("aarets", Order = 2)] + [JsonProperty("aarets")] + [JsonPropertyName("aarets")] + public GjeldAnnenLangsiktig242 aarets { get; set; } + + public bool ShouldSerializeaarets() => aarets?.valueNullable is not null; + + [XmlElement("fjoraarets", Order = 3)] + [JsonProperty("fjoraarets")] + [JsonPropertyName("fjoraarets")] + public GjeldAnnenLangsiktigFjoraret7155 fjoraarets { get; set; } + + public bool ShouldSerializefjoraarets() => fjoraarets?.valueNullable is not null; + + } + + public class NoteGjeldAnnenLangsiktig18584 + { + [MinLength(1)] + [MaxLength(35)] + [XmlText()] + public string value { get; set; } + + [XmlAttribute("orid")] + [BindNever] + public string orid { get; set; } = "18584"; + + } + + public class GjeldAnnenLangsiktig242 + { + [RegularExpression(@"^-?[0-9]{0,15}$")] + [Range(Double.MinValue,Double.MaxValue)] + [Required] + [XmlIgnore] + [JsonPropertyName("value")] + [JsonProperty(PropertyName = "value")] + public decimal? valueNullable { get; set; } + + [XmlText] + [System.Text.Json.Serialization.JsonIgnore] + [Newtonsoft.Json.JsonIgnore] + public decimal value + { + get => valueNullable ?? default; + set + { + this.valueNullable = value; + } + } + + [XmlAttribute("orid")] + [BindNever] + public string orid { get; set; } = "242"; + + } + + public class GjeldAnnenLangsiktigFjoraret7155 + { + [RegularExpression(@"^-?[0-9]{0,15}$")] + [Range(Double.MinValue,Double.MaxValue)] + [Required] + [XmlIgnore] + [JsonPropertyName("value")] + [JsonProperty(PropertyName = "value")] + public decimal? valueNullable { get; set; } + + [XmlText] + [System.Text.Json.Serialization.JsonIgnore] + [Newtonsoft.Json.JsonIgnore] + public decimal value + { + get => valueNullable ?? default; + set + { + this.valueNullable = value; + } + } + + [XmlAttribute("orid")] + [BindNever] + public string orid { get; set; } = "7155"; + + } + + public class SumAnnenLangsiktigGjeld + { + [XmlElement("note", Order = 1)] + [JsonProperty("note")] + [JsonPropertyName("note")] + public NoteGjeldAnnenLangsiktigSum25018 note { get; set; } + + public bool ShouldSerializenote() => note?.value is not null; + + [XmlElement("aarets", Order = 2)] + [JsonProperty("aarets")] + [JsonPropertyName("aarets")] + public GjeldAnnenLangsiktigSum25019 aarets { get; set; } + + public bool ShouldSerializeaarets() => aarets?.valueNullable is not null; + + [XmlElement("fjoraarets", Order = 3)] + [JsonProperty("fjoraarets")] + [JsonPropertyName("fjoraarets")] + public GjeldAnnenLangsiktigSumFjoraret25020 fjoraarets { get; set; } + + public bool ShouldSerializefjoraarets() => fjoraarets?.valueNullable is not null; + + } + + public class NoteGjeldAnnenLangsiktigSum25018 + { + [MinLength(1)] + [MaxLength(35)] + [XmlText()] + public string value { get; set; } + + [XmlAttribute("orid")] + [BindNever] + public string orid { get; set; } = "25018"; + + } + + public class GjeldAnnenLangsiktigSum25019 + { + [RegularExpression(@"^-?[0-9]{0,15}$")] + [Range(Double.MinValue,Double.MaxValue)] + [Required] + [XmlIgnore] + [JsonPropertyName("value")] + [JsonProperty(PropertyName = "value")] + public decimal? valueNullable { get; set; } + + [XmlText] + [System.Text.Json.Serialization.JsonIgnore] + [Newtonsoft.Json.JsonIgnore] + public decimal value + { + get => valueNullable ?? default; + set + { + this.valueNullable = value; + } + } + + [XmlAttribute("orid")] + [BindNever] + public string orid { get; set; } = "25019"; + + } + + public class GjeldAnnenLangsiktigSumFjoraret25020 + { + [RegularExpression(@"^-?[0-9]{0,15}$")] + [Range(Double.MinValue,Double.MaxValue)] + [Required] + [XmlIgnore] + [JsonPropertyName("value")] + [JsonProperty(PropertyName = "value")] + public decimal? valueNullable { get; set; } + + [XmlText] + [System.Text.Json.Serialization.JsonIgnore] + [Newtonsoft.Json.JsonIgnore] + public decimal value + { + get => valueNullable ?? default; + set + { + this.valueNullable = value; + } + } + + [XmlAttribute("orid")] + [BindNever] + public string orid { get; set; } = "25020"; + + } + + public class SumLangsiktigGjeld + { + [XmlElement("note", Order = 1)] + [JsonProperty("note")] + [JsonPropertyName("note")] + public NoteGjeldLangsiktig18585 note { get; set; } + + public bool ShouldSerializenote() => note?.value is not null; + + [XmlElement("aarets", Order = 2)] + [JsonProperty("aarets")] + [JsonPropertyName("aarets")] + public GjeldLangsiktig86 aarets { get; set; } + + public bool ShouldSerializeaarets() => aarets?.valueNullable is not null; + + [XmlElement("fjoraarets", Order = 3)] + [JsonProperty("fjoraarets")] + [JsonPropertyName("fjoraarets")] + public GjeldLangsiktigFjoraret7156 fjoraarets { get; set; } + + public bool ShouldSerializefjoraarets() => fjoraarets?.valueNullable is not null; + + } + + public class NoteGjeldLangsiktig18585 + { + [MinLength(1)] + [MaxLength(35)] + [XmlText()] + public string value { get; set; } + + [XmlAttribute("orid")] + [BindNever] + public string orid { get; set; } = "18585"; + + } + + public class GjeldLangsiktig86 + { + [RegularExpression(@"^-?[0-9]{0,15}$")] + [Range(Double.MinValue,Double.MaxValue)] + [Required] + [XmlIgnore] + [JsonPropertyName("value")] + [JsonProperty(PropertyName = "value")] + public decimal? valueNullable { get; set; } + + [XmlText] + [System.Text.Json.Serialization.JsonIgnore] + [Newtonsoft.Json.JsonIgnore] + public decimal value + { + get => valueNullable ?? default; + set + { + this.valueNullable = value; + } + } + + [XmlAttribute("orid")] + [BindNever] + public string orid { get; set; } = "86"; + + } + + public class GjeldLangsiktigFjoraret7156 + { + [RegularExpression(@"^-?[0-9]{0,15}$")] + [Range(Double.MinValue,Double.MaxValue)] + [Required] + [XmlIgnore] + [JsonPropertyName("value")] + [JsonProperty(PropertyName = "value")] + public decimal? valueNullable { get; set; } + + [XmlText] + [System.Text.Json.Serialization.JsonIgnore] + [Newtonsoft.Json.JsonIgnore] + public decimal value + { + get => valueNullable ?? default; + set + { + this.valueNullable = value; + } + } + + [XmlAttribute("orid")] + [BindNever] + public string orid { get; set; } = "7156"; + + } + + public class KortsiktigGjeld + { + [XmlElement("gjeldKredittinstitusjoner", Order = 1)] + [JsonProperty("gjeldKredittinstitusjoner")] + [JsonPropertyName("gjeldKredittinstitusjoner")] + public GjeldKredittinstitusjonerPoster gjeldKredittinstitusjoner { get; set; } + + [XmlElement("leverandoergjeld", Order = 2)] + [JsonProperty("leverandoergjeld")] + [JsonPropertyName("leverandoergjeld")] + public Leverandoergjeld leverandoergjeld { get; set; } + + [XmlElement("betalbarSkatt", Order = 3)] + [JsonProperty("betalbarSkatt")] + [JsonPropertyName("betalbarSkatt")] + public BetalbarSkatt betalbarSkatt { get; set; } + + [XmlElement("skyldigeOffentligeAvgifter", Order = 4)] + [JsonProperty("skyldigeOffentligeAvgifter")] + [JsonPropertyName("skyldigeOffentligeAvgifter")] + public SkyldigeOffentligeAvgifter skyldigeOffentligeAvgifter { get; set; } + + [XmlElement("annenKortsiktigGjeld", Order = 5)] + [JsonProperty("annenKortsiktigGjeld")] + [JsonPropertyName("annenKortsiktigGjeld")] + public AnnenKortsiktigGjeld annenKortsiktigGjeld { get; set; } + + [XmlElement("sumKortsiktigGjeld", Order = 6)] + [JsonProperty("sumKortsiktigGjeld")] + [JsonPropertyName("sumKortsiktigGjeld")] + public SumKortsiktigGjeld sumKortsiktigGjeld { get; set; } + + [XmlElement("sumGjeld", Order = 7)] + [JsonProperty("sumGjeld")] + [JsonPropertyName("sumGjeld")] + public SumGjeld sumGjeld { get; set; } + + [XmlElement("sumFormaalskapitalGjeld", Order = 8)] + [JsonProperty("sumFormaalskapitalGjeld")] + [JsonPropertyName("sumFormaalskapitalGjeld")] + public SumFormaalskapitalGjeldS sumFormaalskapitalGjeld { get; set; } + + } + + public class GjeldKredittinstitusjonerPoster + { + [XmlElement("note", Order = 1)] + [JsonProperty("note")] + [JsonPropertyName("note")] + public NoteGjeldKredittinstitusjonerKortsiktig18587 note { get; set; } + + public bool ShouldSerializenote() => note?.value is not null; + + [XmlElement("aarets", Order = 2)] + [JsonProperty("aarets")] + [JsonPropertyName("aarets")] + public GjeldKredittinstitusjonerKortsiktig10926 aarets { get; set; } + + public bool ShouldSerializeaarets() => aarets?.valueNullable is not null; + + [XmlElement("fjoraarets", Order = 3)] + [JsonProperty("fjoraarets")] + [JsonPropertyName("fjoraarets")] + public GjeldKredittinstitusjonerKortsiktigFjoraret13203 fjoraarets { get; set; } + + public bool ShouldSerializefjoraarets() => fjoraarets?.valueNullable is not null; + + } + + public class NoteGjeldKredittinstitusjonerKortsiktig18587 + { + [MinLength(1)] + [MaxLength(35)] + [XmlText()] + public string value { get; set; } + + [XmlAttribute("orid")] + [BindNever] + public string orid { get; set; } = "18587"; + + } + + public class GjeldKredittinstitusjonerKortsiktig10926 + { + [RegularExpression(@"^-?[0-9]{0,15}$")] + [Range(Double.MinValue,Double.MaxValue)] + [Required] + [XmlIgnore] + [JsonPropertyName("value")] + [JsonProperty(PropertyName = "value")] + public decimal? valueNullable { get; set; } + + [XmlText] + [System.Text.Json.Serialization.JsonIgnore] + [Newtonsoft.Json.JsonIgnore] + public decimal value + { + get => valueNullable ?? default; + set + { + this.valueNullable = value; + } + } + + [XmlAttribute("orid")] + [BindNever] + public string orid { get; set; } = "10926"; + + } + + public class GjeldKredittinstitusjonerKortsiktigFjoraret13203 + { + [RegularExpression(@"^-?[0-9]{0,15}$")] + [Range(Double.MinValue,Double.MaxValue)] + [Required] + [XmlIgnore] + [JsonPropertyName("value")] + [JsonProperty(PropertyName = "value")] + public decimal? valueNullable { get; set; } + + [XmlText] + [System.Text.Json.Serialization.JsonIgnore] + [Newtonsoft.Json.JsonIgnore] + public decimal value + { + get => valueNullable ?? default; + set + { + this.valueNullable = value; + } + } + + [XmlAttribute("orid")] + [BindNever] + public string orid { get; set; } = "13203"; + + } + + public class Leverandoergjeld + { + [XmlElement("note", Order = 1)] + [JsonProperty("note")] + [JsonPropertyName("note")] + public NoteLeverandorgjeld18588 note { get; set; } + + public bool ShouldSerializenote() => note?.value is not null; + + [XmlElement("aarets", Order = 2)] + [JsonProperty("aarets")] + [JsonPropertyName("aarets")] + public Leverandorgjeld220 aarets { get; set; } + + public bool ShouldSerializeaarets() => aarets?.valueNullable is not null; + + [XmlElement("fjoraarets", Order = 3)] + [JsonProperty("fjoraarets")] + [JsonPropertyName("fjoraarets")] + public LeverandorgjeldFjoraret7162 fjoraarets { get; set; } + + public bool ShouldSerializefjoraarets() => fjoraarets?.valueNullable is not null; + + } + + public class NoteLeverandorgjeld18588 + { + [MinLength(1)] + [MaxLength(35)] + [XmlText()] + public string value { get; set; } + + [XmlAttribute("orid")] + [BindNever] + public string orid { get; set; } = "18588"; + + } + + public class Leverandorgjeld220 + { + [RegularExpression(@"^-?[0-9]{0,15}$")] + [Range(Double.MinValue,Double.MaxValue)] + [Required] + [XmlIgnore] + [JsonPropertyName("value")] + [JsonProperty(PropertyName = "value")] + public decimal? valueNullable { get; set; } + + [XmlText] + [System.Text.Json.Serialization.JsonIgnore] + [Newtonsoft.Json.JsonIgnore] + public decimal value + { + get => valueNullable ?? default; + set + { + this.valueNullable = value; + } + } + + [XmlAttribute("orid")] + [BindNever] + public string orid { get; set; } = "220"; + + } + + public class LeverandorgjeldFjoraret7162 + { + [RegularExpression(@"^-?[0-9]{0,15}$")] + [Range(Double.MinValue,Double.MaxValue)] + [Required] + [XmlIgnore] + [JsonPropertyName("value")] + [JsonProperty(PropertyName = "value")] + public decimal? valueNullable { get; set; } + + [XmlText] + [System.Text.Json.Serialization.JsonIgnore] + [Newtonsoft.Json.JsonIgnore] + public decimal value + { + get => valueNullable ?? default; + set + { + this.valueNullable = value; + } + } + + [XmlAttribute("orid")] + [BindNever] + public string orid { get; set; } = "7162"; + + } + + public class BetalbarSkatt + { + [XmlElement("note", Order = 1)] + [JsonProperty("note")] + [JsonPropertyName("note")] + public NoteSkattBetalbar18589 note { get; set; } + + public bool ShouldSerializenote() => note?.value is not null; + + [XmlElement("aarets", Order = 2)] + [JsonProperty("aarets")] + [JsonPropertyName("aarets")] + public SkattBetalbar2483 aarets { get; set; } + + public bool ShouldSerializeaarets() => aarets?.valueNullable is not null; + + [XmlElement("fjoraarets", Order = 3)] + [JsonProperty("fjoraarets")] + [JsonPropertyName("fjoraarets")] + public SkattBetalbarFjoraret10293 fjoraarets { get; set; } + + public bool ShouldSerializefjoraarets() => fjoraarets?.valueNullable is not null; + + } + + public class NoteSkattBetalbar18589 + { + [MinLength(1)] + [MaxLength(35)] + [XmlText()] + public string value { get; set; } + + [XmlAttribute("orid")] + [BindNever] + public string orid { get; set; } = "18589"; + + } + + public class SkattBetalbar2483 + { + [RegularExpression(@"^-?[0-9]{0,15}$")] + [Range(Double.MinValue,Double.MaxValue)] + [Required] + [XmlIgnore] + [JsonPropertyName("value")] + [JsonProperty(PropertyName = "value")] + public decimal? valueNullable { get; set; } + + [XmlText] + [System.Text.Json.Serialization.JsonIgnore] + [Newtonsoft.Json.JsonIgnore] + public decimal value + { + get => valueNullable ?? default; + set + { + this.valueNullable = value; + } + } + + [XmlAttribute("orid")] + [BindNever] + public string orid { get; set; } = "2483"; + + } + + public class SkattBetalbarFjoraret10293 + { + [RegularExpression(@"^-?[0-9]{0,15}$")] + [Range(Double.MinValue,Double.MaxValue)] + [Required] + [XmlIgnore] + [JsonPropertyName("value")] + [JsonProperty(PropertyName = "value")] + public decimal? valueNullable { get; set; } + + [XmlText] + [System.Text.Json.Serialization.JsonIgnore] + [Newtonsoft.Json.JsonIgnore] + public decimal value + { + get => valueNullable ?? default; + set + { + this.valueNullable = value; + } + } + + [XmlAttribute("orid")] + [BindNever] + public string orid { get; set; } = "10293"; + + } + + public class SkyldigeOffentligeAvgifter + { + [XmlElement("note", Order = 1)] + [JsonProperty("note")] + [JsonPropertyName("note")] + public NoteAvgifterOffentligeSkyldig18590 note { get; set; } + + public bool ShouldSerializenote() => note?.value is not null; + + [XmlElement("aarets", Order = 2)] + [JsonProperty("aarets")] + [JsonPropertyName("aarets")] + public AvgifterOffentligeSkyldig225 aarets { get; set; } + + public bool ShouldSerializeaarets() => aarets?.valueNullable is not null; + + [XmlElement("fjoraarets", Order = 3)] + [JsonProperty("fjoraarets")] + [JsonPropertyName("fjoraarets")] + public AvgifterOffentligeSkyldigFjoraret7170 fjoraarets { get; set; } + + public bool ShouldSerializefjoraarets() => fjoraarets?.valueNullable is not null; + + } + + public class NoteAvgifterOffentligeSkyldig18590 + { + [MinLength(1)] + [MaxLength(35)] + [XmlText()] + public string value { get; set; } + + [XmlAttribute("orid")] + [BindNever] + public string orid { get; set; } = "18590"; + + } + + public class AvgifterOffentligeSkyldig225 + { + [RegularExpression(@"^-?[0-9]{0,15}$")] + [Range(Double.MinValue,Double.MaxValue)] + [Required] + [XmlIgnore] + [JsonPropertyName("value")] + [JsonProperty(PropertyName = "value")] + public decimal? valueNullable { get; set; } + + [XmlText] + [System.Text.Json.Serialization.JsonIgnore] + [Newtonsoft.Json.JsonIgnore] + public decimal value + { + get => valueNullable ?? default; + set + { + this.valueNullable = value; + } + } + + [XmlAttribute("orid")] + [BindNever] + public string orid { get; set; } = "225"; + + } + + public class AvgifterOffentligeSkyldigFjoraret7170 + { + [RegularExpression(@"^-?[0-9]{0,15}$")] + [Range(Double.MinValue,Double.MaxValue)] + [Required] + [XmlIgnore] + [JsonPropertyName("value")] + [JsonProperty(PropertyName = "value")] + public decimal? valueNullable { get; set; } + + [XmlText] + [System.Text.Json.Serialization.JsonIgnore] + [Newtonsoft.Json.JsonIgnore] + public decimal value + { + get => valueNullable ?? default; + set + { + this.valueNullable = value; + } + } + + [XmlAttribute("orid")] + [BindNever] + public string orid { get; set; } = "7170"; + + } + + public class AnnenKortsiktigGjeld + { + [XmlElement("note", Order = 1)] + [JsonProperty("note")] + [JsonPropertyName("note")] + public NoteGjeldAnnenKortsiktig18592 note { get; set; } + + public bool ShouldSerializenote() => note?.value is not null; + + [XmlElement("aarets", Order = 2)] + [JsonProperty("aarets")] + [JsonPropertyName("aarets")] + public GjeldAnnenKortsiktig236 aarets { get; set; } + + public bool ShouldSerializeaarets() => aarets?.valueNullable is not null; + + [XmlElement("fjoraarets", Order = 3)] + [JsonProperty("fjoraarets")] + [JsonPropertyName("fjoraarets")] + public GjeldAnnenKortsiktigFjoraret7182 fjoraarets { get; set; } + + public bool ShouldSerializefjoraarets() => fjoraarets?.valueNullable is not null; + + } + + public class NoteGjeldAnnenKortsiktig18592 + { + [MinLength(1)] + [MaxLength(35)] + [XmlText()] + public string value { get; set; } + + [XmlAttribute("orid")] + [BindNever] + public string orid { get; set; } = "18592"; + + } + + public class GjeldAnnenKortsiktig236 + { + [RegularExpression(@"^-?[0-9]{0,15}$")] + [Range(Double.MinValue,Double.MaxValue)] + [Required] + [XmlIgnore] + [JsonPropertyName("value")] + [JsonProperty(PropertyName = "value")] + public decimal? valueNullable { get; set; } + + [XmlText] + [System.Text.Json.Serialization.JsonIgnore] + [Newtonsoft.Json.JsonIgnore] + public decimal value + { + get => valueNullable ?? default; + set + { + this.valueNullable = value; + } + } + + [XmlAttribute("orid")] + [BindNever] + public string orid { get; set; } = "236"; + + } + + public class GjeldAnnenKortsiktigFjoraret7182 + { + [RegularExpression(@"^-?[0-9]{0,15}$")] + [Range(Double.MinValue,Double.MaxValue)] + [Required] + [XmlIgnore] + [JsonPropertyName("value")] + [JsonProperty(PropertyName = "value")] + public decimal? valueNullable { get; set; } + + [XmlText] + [System.Text.Json.Serialization.JsonIgnore] + [Newtonsoft.Json.JsonIgnore] + public decimal value + { + get => valueNullable ?? default; + set + { + this.valueNullable = value; + } + } + + [XmlAttribute("orid")] + [BindNever] + public string orid { get; set; } = "7182"; + + } + + public class SumKortsiktigGjeld + { + [XmlElement("note", Order = 1)] + [JsonProperty("note")] + [JsonPropertyName("note")] + public NoteGjeldKortsiktig18593 note { get; set; } + + public bool ShouldSerializenote() => note?.value is not null; + + [XmlElement("aarets", Order = 2)] + [JsonProperty("aarets")] + [JsonPropertyName("aarets")] + public GjeldKortsiktig85 aarets { get; set; } + + public bool ShouldSerializeaarets() => aarets?.valueNullable is not null; + + [XmlElement("fjoraarets", Order = 3)] + [JsonProperty("fjoraarets")] + [JsonPropertyName("fjoraarets")] + public GjeldKortsiktigFjoraret7183 fjoraarets { get; set; } + + public bool ShouldSerializefjoraarets() => fjoraarets?.valueNullable is not null; + + } + + public class NoteGjeldKortsiktig18593 + { + [MinLength(1)] + [MaxLength(35)] + [XmlText()] + public string value { get; set; } + + [XmlAttribute("orid")] + [BindNever] + public string orid { get; set; } = "18593"; + + } + + public class GjeldKortsiktig85 + { + [RegularExpression(@"^-?[0-9]{0,15}$")] + [Range(Double.MinValue,Double.MaxValue)] + [Required] + [XmlIgnore] + [JsonPropertyName("value")] + [JsonProperty(PropertyName = "value")] + public decimal? valueNullable { get; set; } + + [XmlText] + [System.Text.Json.Serialization.JsonIgnore] + [Newtonsoft.Json.JsonIgnore] + public decimal value + { + get => valueNullable ?? default; + set + { + this.valueNullable = value; + } + } + + [XmlAttribute("orid")] + [BindNever] + public string orid { get; set; } = "85"; + + } + + public class GjeldKortsiktigFjoraret7183 + { + [RegularExpression(@"^-?[0-9]{0,15}$")] + [Range(Double.MinValue,Double.MaxValue)] + [Required] + [XmlIgnore] + [JsonPropertyName("value")] + [JsonProperty(PropertyName = "value")] + public decimal? valueNullable { get; set; } + + [XmlText] + [System.Text.Json.Serialization.JsonIgnore] + [Newtonsoft.Json.JsonIgnore] + public decimal value + { + get => valueNullable ?? default; + set + { + this.valueNullable = value; + } + } + + [XmlAttribute("orid")] + [BindNever] + public string orid { get; set; } = "7183"; + + } + + public class SumGjeld + { + [XmlElement("note", Order = 1)] + [JsonProperty("note")] + [JsonPropertyName("note")] + public NoteGjeld18138 note { get; set; } + + public bool ShouldSerializenote() => note?.value is not null; + + [XmlElement("aarets", Order = 2)] + [JsonProperty("aarets")] + [JsonPropertyName("aarets")] + public Gjeld1119 aarets { get; set; } + + public bool ShouldSerializeaarets() => aarets?.valueNullable is not null; + + [XmlElement("fjoraarets", Order = 3)] + [JsonProperty("fjoraarets")] + [JsonPropertyName("fjoraarets")] + public GjeldFjoraret7184 fjoraarets { get; set; } + + public bool ShouldSerializefjoraarets() => fjoraarets?.valueNullable is not null; + + } + + public class NoteGjeld18138 + { + [MinLength(1)] + [MaxLength(35)] + [XmlText()] + public string value { get; set; } + + [XmlAttribute("orid")] + [BindNever] + public string orid { get; set; } = "18138"; + + } + + public class Gjeld1119 + { + [RegularExpression(@"^-?[0-9]{0,15}$")] + [Range(Double.MinValue,Double.MaxValue)] + [Required] + [XmlIgnore] + [JsonPropertyName("value")] + [JsonProperty(PropertyName = "value")] + public decimal? valueNullable { get; set; } + + [XmlText] + [System.Text.Json.Serialization.JsonIgnore] + [Newtonsoft.Json.JsonIgnore] + public decimal value + { + get => valueNullable ?? default; + set + { + this.valueNullable = value; + } + } + + [XmlAttribute("orid")] + [BindNever] + public string orid { get; set; } = "1119"; + + } + + public class GjeldFjoraret7184 + { + [RegularExpression(@"^-?[0-9]{0,15}$")] + [Range(Double.MinValue,Double.MaxValue)] + [Required] + [XmlIgnore] + [JsonPropertyName("value")] + [JsonProperty(PropertyName = "value")] + public decimal? valueNullable { get; set; } + + [XmlText] + [System.Text.Json.Serialization.JsonIgnore] + [Newtonsoft.Json.JsonIgnore] + public decimal value + { + get => valueNullable ?? default; + set + { + this.valueNullable = value; + } + } + + [XmlAttribute("orid")] + [BindNever] + public string orid { get; set; } = "7184"; + + } + + public class SumFormaalskapitalGjeldS + { + [XmlElement("note", Order = 1)] + [JsonProperty("note")] + [JsonPropertyName("note")] + public NoteGjeldEgenkapital18122 note { get; set; } + + public bool ShouldSerializenote() => note?.value is not null; + + [XmlElement("aarets", Order = 2)] + [JsonProperty("aarets")] + [JsonPropertyName("aarets")] + public GjeldEgenkapital251 aarets { get; set; } + + public bool ShouldSerializeaarets() => aarets?.valueNullable is not null; + + [XmlElement("fjoraarets", Order = 3)] + [JsonProperty("fjoraarets")] + [JsonPropertyName("fjoraarets")] + public GjeldEgenkapitalFjoraret7185 fjoraarets { get; set; } + + public bool ShouldSerializefjoraarets() => fjoraarets?.valueNullable is not null; + + } + + public class NoteGjeldEgenkapital18122 + { + [MinLength(1)] + [MaxLength(35)] + [XmlText()] + public string value { get; set; } + + [XmlAttribute("orid")] + [BindNever] + public string orid { get; set; } = "18122"; + + } + + public class GjeldEgenkapital251 + { + [RegularExpression(@"^-?[0-9]{0,15}$")] + [Range(Double.MinValue,Double.MaxValue)] + [Required] + [XmlIgnore] + [JsonPropertyName("value")] + [JsonProperty(PropertyName = "value")] + public decimal? valueNullable { get; set; } + + [XmlText] + [System.Text.Json.Serialization.JsonIgnore] + [Newtonsoft.Json.JsonIgnore] + public decimal value + { + get => valueNullable ?? default; + set + { + this.valueNullable = value; + } + } + + [XmlAttribute("orid")] + [BindNever] + public string orid { get; set; } = "251"; + + } + + public class GjeldEgenkapitalFjoraret7185 + { + [RegularExpression(@"^-?[0-9]{0,15}$")] + [Range(Double.MinValue,Double.MaxValue)] + [Required] + [XmlIgnore] + [JsonPropertyName("value")] + [JsonProperty(PropertyName = "value")] + public decimal? valueNullable { get; set; } + + [XmlText] + [System.Text.Json.Serialization.JsonIgnore] + [Newtonsoft.Json.JsonIgnore] + public decimal value + { + get => valueNullable ?? default; + set + { + this.valueNullable = value; + } + } + + [XmlAttribute("orid")] + [BindNever] + public string orid { get; set; } = "7185"; + + } + + public class PosterUtenomBalansen + { + [XmlElement("garantistillelser", Order = 1)] + [JsonProperty("garantistillelser")] + [JsonPropertyName("garantistillelser")] + public Garantistillelser garantistillelser { get; set; } + + [XmlElement("pantstillelser", Order = 2)] + [JsonProperty("pantstillelser")] + [JsonPropertyName("pantstillelser")] + public Pantstillelser pantstillelser { get; set; } + + } + + public class Garantistillelser + { + [XmlElement("note", Order = 1)] + [JsonProperty("note")] + [JsonPropertyName("note")] + public NoteGarantistillelse18594 note { get; set; } + + public bool ShouldSerializenote() => note?.value is not null; + + [XmlElement("aarets", Order = 2)] + [JsonProperty("aarets")] + [JsonPropertyName("aarets")] + public Garantistillelse16920 aarets { get; set; } + + public bool ShouldSerializeaarets() => aarets?.valueNullable is not null; + + [XmlElement("fjoraarets", Order = 3)] + [JsonProperty("fjoraarets")] + [JsonPropertyName("fjoraarets")] + public GarantistillelseFjoraret16921 fjoraarets { get; set; } + + public bool ShouldSerializefjoraarets() => fjoraarets?.valueNullable is not null; + + } + + public class NoteGarantistillelse18594 + { + [MinLength(1)] + [MaxLength(35)] + [XmlText()] + public string value { get; set; } + + [XmlAttribute("orid")] + [BindNever] + public string orid { get; set; } = "18594"; + + } + + public class Garantistillelse16920 + { + [RegularExpression(@"^-?[0-9]{0,15}$")] + [Range(Double.MinValue,Double.MaxValue)] + [Required] + [XmlIgnore] + [JsonPropertyName("value")] + [JsonProperty(PropertyName = "value")] + public decimal? valueNullable { get; set; } + + [XmlText] + [System.Text.Json.Serialization.JsonIgnore] + [Newtonsoft.Json.JsonIgnore] + public decimal value + { + get => valueNullable ?? default; + set + { + this.valueNullable = value; + } + } + + [XmlAttribute("orid")] + [BindNever] + public string orid { get; set; } = "16920"; + + } + + public class GarantistillelseFjoraret16921 + { + [RegularExpression(@"^-?[0-9]{0,15}$")] + [Range(Double.MinValue,Double.MaxValue)] + [Required] + [XmlIgnore] + [JsonPropertyName("value")] + [JsonProperty(PropertyName = "value")] + public decimal? valueNullable { get; set; } + + [XmlText] + [System.Text.Json.Serialization.JsonIgnore] + [Newtonsoft.Json.JsonIgnore] + public decimal value + { + get => valueNullable ?? default; + set + { + this.valueNullable = value; + } + } + + [XmlAttribute("orid")] + [BindNever] + public string orid { get; set; } = "16921"; + + } + + public class Pantstillelser + { + [XmlElement("note", Order = 1)] + [JsonProperty("note")] + [JsonPropertyName("note")] + public NotePantstillelser18595 note { get; set; } + + public bool ShouldSerializenote() => note?.value is not null; + + [XmlElement("aarets", Order = 2)] + [JsonProperty("aarets")] + [JsonPropertyName("aarets")] + public Pantstillelser16922 aarets { get; set; } + + public bool ShouldSerializeaarets() => aarets?.valueNullable is not null; + + [XmlElement("fjoraarets", Order = 3)] + [JsonProperty("fjoraarets")] + [JsonPropertyName("fjoraarets")] + public PantstillelserFjoraret16923 fjoraarets { get; set; } + + public bool ShouldSerializefjoraarets() => fjoraarets?.valueNullable is not null; + + } + + public class NotePantstillelser18595 + { + [MinLength(1)] + [MaxLength(35)] + [XmlText()] + public string value { get; set; } + + [XmlAttribute("orid")] + [BindNever] + public string orid { get; set; } = "18595"; + + } + + public class Pantstillelser16922 + { + [RegularExpression(@"^-?[0-9]{0,15}$")] + [Range(Double.MinValue,Double.MaxValue)] + [Required] + [XmlIgnore] + [JsonPropertyName("value")] + [JsonProperty(PropertyName = "value")] + public decimal? valueNullable { get; set; } + + [XmlText] + [System.Text.Json.Serialization.JsonIgnore] + [Newtonsoft.Json.JsonIgnore] + public decimal value + { + get => valueNullable ?? default; + set + { + this.valueNullable = value; + } + } + + [XmlAttribute("orid")] + [BindNever] + public string orid { get; set; } = "16922"; + + } + + public class PantstillelserFjoraret16923 + { + [RegularExpression(@"^-?[0-9]{0,15}$")] + [Range(Double.MinValue,Double.MaxValue)] + [Required] + [XmlIgnore] + [JsonPropertyName("value")] + [JsonProperty(PropertyName = "value")] + public decimal? valueNullable { get; set; } + + [XmlText] + [System.Text.Json.Serialization.JsonIgnore] + [Newtonsoft.Json.JsonIgnore] + public decimal value + { + get => valueNullable ?? default; + set + { + this.valueNullable = value; + } + } + + [XmlAttribute("orid")] + [BindNever] + public string orid { get; set; } = "16923"; + + } +} diff --git a/testdata/Model/CSharp/Gitea/3430-39615.cs b/testdata/Model/CSharp/Gitea/3430-39615.cs new file mode 100644 index 00000000000..e6bc043070d --- /dev/null +++ b/testdata/Model/CSharp/Gitea/3430-39615.cs @@ -0,0 +1,542 @@ +#nullable disable +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using System.Linq; +using System.Text.Json.Serialization; +using System.Xml.Serialization; +using Microsoft.AspNetCore.Mvc.ModelBinding; +using Newtonsoft.Json; +namespace Altinn.App.Models +{ + [XmlRoot(ElementName="melding")] + public class RR0010H_M + { + [XmlAttribute("dataFormatProvider")] + [BindNever] + public string dataFormatProvider { get; set; } = "SERES"; + + [XmlAttribute("dataFormatId")] + [BindNever] + public string dataFormatId { get; set; } = "3430"; + + [XmlAttribute("dataFormatVersion")] + [BindNever] + public string dataFormatVersion { get; set; } = "48617"; + + [XmlElement("Innsender", Order = 1)] + [JsonProperty("Innsender")] + [JsonPropertyName("Innsender")] + public Innsender Innsender { get; set; } + + [XmlElement("Skjemainnhold", Order = 2)] + [JsonProperty("Skjemainnhold")] + [JsonPropertyName("Skjemainnhold")] + public Skjemainnhold Skjemainnhold { get; set; } + + } + + public class Innsender + { + [XmlElement("enhet", Order = 1)] + [JsonProperty("enhet")] + [JsonPropertyName("enhet")] + public Enhet enhet { get; set; } + + [XmlElement("kontaktperson", Order = 2)] + [JsonProperty("kontaktperson")] + [JsonPropertyName("kontaktperson")] + public List kontaktperson { get; set; } + + [XmlElement("opplysningerInnsending", Order = 3)] + [JsonProperty("opplysningerInnsending")] + [JsonPropertyName("opplysningerInnsending")] + public OpplysningerInnsending opplysningerInnsending { get; set; } + + } + + public class Enhet + { + [XmlElement("organisasjonsnummer", Order = 1)] + [JsonProperty("organisasjonsnummer")] + [JsonPropertyName("organisasjonsnummer")] + public EnhetOrganisasjonsnummer18 organisasjonsnummer { get; set; } + + public bool ShouldSerializeorganisasjonsnummer() => organisasjonsnummer?.value is not null; + + [XmlElement("organisasjonsform", Order = 2)] + [JsonProperty("organisasjonsform")] + [JsonPropertyName("organisasjonsform")] + public EnhetOrganisasjonsform756 organisasjonsform { get; set; } + + public bool ShouldSerializeorganisasjonsform() => organisasjonsform?.value is not null; + + [XmlElement("navn", Order = 3)] + [JsonProperty("navn")] + [JsonPropertyName("navn")] + public EnhetNavn1 navn { get; set; } + + public bool ShouldSerializenavn() => navn?.value is not null; + + } + + public class EnhetOrganisasjonsnummer18 + { + [MinLength(9)] + [MaxLength(9)] + [XmlText()] + public string value { get; set; } + + [XmlAttribute("orid")] + [BindNever] + public string orid { get; set; } = "18"; + + } + + public class EnhetOrganisasjonsform756 + { + [MinLength(1)] + [MaxLength(35)] + [XmlText()] + public string value { get; set; } + + [XmlAttribute("orid")] + [BindNever] + public string orid { get; set; } = "756"; + + } + + public class EnhetNavn1 + { + [MinLength(1)] + [MaxLength(175)] + [XmlText()] + public string value { get; set; } + + [XmlAttribute("orid")] + [BindNever] + public string orid { get; set; } = "1"; + + } + + public class Kontaktperson + { + [XmlAttribute("altinnRowId")] + [JsonPropertyName("altinnRowId")] + [System.Text.Json.Serialization.JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)] + [Newtonsoft.Json.JsonIgnore] + public Guid AltinnRowId { get; set; } + + public bool ShouldSerializeAltinnRowId() => AltinnRowId != default; + + [XmlElement("e-post", Order = 1)] + [JsonProperty("e-post")] + [JsonPropertyName("e-post")] + public KontaktpersonEPost19022 epost { get; set; } + + public bool ShouldSerializeepost() => epost?.value is not null; + + } + + public class KontaktpersonEPost19022 + { + [MinLength(1)] + [MaxLength(70)] + [XmlText()] + public string value { get; set; } + + [XmlAttribute("orid")] + [BindNever] + public string orid { get; set; } = "19022"; + + } + + public class OpplysningerInnsending + { + [XmlElement("fraSluttbrukersystem", Order = 1)] + [JsonProperty("fraSluttbrukersystem")] + [JsonPropertyName("fraSluttbrukersystem")] + public ArsregnskapSysteminnsending35139 fraSluttbrukersystem { get; set; } + + public bool ShouldSerializefraSluttbrukersystem() => fraSluttbrukersystem?.value is not null; + + [XmlElement("landTilLand", Order = 2)] + [JsonProperty("landTilLand")] + [JsonPropertyName("landTilLand")] + public ArsregnskapLandTilLand35172 landTilLand { get; set; } + + public bool ShouldSerializelandTilLand() => landTilLand?.valueNullable is not null; + + } + + public class ArsregnskapSysteminnsending35139 + { + [XmlText()] + public string value { get; set; } + + [XmlAttribute("orid")] + [BindNever] + public string orid { get; set; } = "35139"; + + } + + public class ArsregnskapLandTilLand35172 + { + [Required] + [XmlIgnore] + [JsonPropertyName("value")] + [JsonProperty(PropertyName = "value")] + public bool? valueNullable { get; set; } + + [XmlText] + [System.Text.Json.Serialization.JsonIgnore] + [Newtonsoft.Json.JsonIgnore] + public bool value + { + get => valueNullable ?? default; + set + { + this.valueNullable = value; + } + } + + [XmlAttribute("orid")] + [BindNever] + public string orid { get; set; } = "35172"; + + } + + public class Skjemainnhold + { + [XmlElement("regnskapsperiode", Order = 1)] + [JsonProperty("regnskapsperiode")] + [JsonPropertyName("regnskapsperiode")] + public Regnskapsperiode regnskapsperiode { get; set; } + + [XmlElement("konsern", Order = 2)] + [JsonProperty("konsern")] + [JsonPropertyName("konsern")] + public Konsern konsern { get; set; } + + [XmlElement("regnskapsprinsipper", Order = 3)] + [JsonProperty("regnskapsprinsipper")] + [JsonPropertyName("regnskapsprinsipper")] + public Regnskapsprinsipper regnskapsprinsipper { get; set; } + + [XmlElement("fastsettelse", Order = 4)] + [JsonProperty("fastsettelse")] + [JsonPropertyName("fastsettelse")] + public Fastsettelse fastsettelse { get; set; } + + } + + public class Regnskapsperiode + { + [XmlElement("regnskapsstart", Order = 1)] + [JsonProperty("regnskapsstart")] + [JsonPropertyName("regnskapsstart")] + public RegnskapStartdato17103 regnskapsstart { get; set; } + + public bool ShouldSerializeregnskapsstart() => regnskapsstart?.value is not null; + + [XmlElement("regnskapsslutt", Order = 2)] + [JsonProperty("regnskapsslutt")] + [JsonPropertyName("regnskapsslutt")] + public RegnskapAvslutningsdato17104 regnskapsslutt { get; set; } + + public bool ShouldSerializeregnskapsslutt() => regnskapsslutt?.value is not null; + + [XmlElement("regnskapsaar", Order = 3)] + [JsonProperty("regnskapsaar")] + [JsonPropertyName("regnskapsaar")] + public RegnskapAr17102 regnskapsaar { get; set; } + + public bool ShouldSerializeregnskapsaar() => regnskapsaar?.value is not null; + + } + + public class RegnskapStartdato17103 + { + [RegularExpression(@"^[0-9]{4}-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])$")] + [XmlText()] + public string value { get; set; } + + [XmlAttribute("orid")] + [BindNever] + public string orid { get; set; } = "17103"; + + } + + public class RegnskapAvslutningsdato17104 + { + [RegularExpression(@"^[0-9]{4}-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])$")] + [XmlText()] + public string value { get; set; } + + [XmlAttribute("orid")] + [BindNever] + public string orid { get; set; } = "17104"; + + } + + public class RegnskapAr17102 + { + [RegularExpression(@"^[0-9]{4}$")] + [XmlText()] + public string value { get; set; } + + [XmlAttribute("orid")] + [BindNever] + public string orid { get; set; } = "17102"; + + } + + public class Konsern + { + [XmlElement("morselskap", Order = 1)] + [JsonProperty("morselskap")] + [JsonPropertyName("morselskap")] + public Morselskap4168 morselskap { get; set; } + + public bool ShouldSerializemorselskap() => morselskap?.value is not null; + + [XmlElement("konsernregnskap", Order = 2)] + [JsonProperty("konsernregnskap")] + [JsonPropertyName("konsernregnskap")] + public KonsernregnskapVedlegg25943 konsernregnskap { get; set; } + + public bool ShouldSerializekonsernregnskap() => konsernregnskap?.value is not null; + + [XmlElement("utenlandskKonsern", Order = 3)] + [JsonProperty("utenlandskKonsern")] + [JsonPropertyName("utenlandskKonsern")] + public UtenlandskKonsern36640 utenlandskKonsern { get; set; } + + public bool ShouldSerializeutenlandskKonsern() => utenlandskKonsern?.value is not null; + + } + + public class Morselskap4168 + { + [XmlText()] + public string value { get; set; } + + [XmlAttribute("orid")] + [BindNever] + public string orid { get; set; } = "4168"; + + } + + public class KonsernregnskapVedlegg25943 + { + [XmlText()] + public string value { get; set; } + + [XmlAttribute("orid")] + [BindNever] + public string orid { get; set; } = "25943"; + + } + + public class UtenlandskKonsern36640 + { + [XmlText()] + public string value { get; set; } + + [XmlAttribute("orid")] + [BindNever] + public string orid { get; set; } = "36640"; + + } + + public class Regnskapsprinsipper + { + [XmlElement("smaaForetak", Order = 1)] + [JsonProperty("smaaForetak")] + [JsonPropertyName("smaaForetak")] + public RegnskapsreglerSmaForetak8079 smaaForetak { get; set; } + + public bool ShouldSerializesmaaForetak() => smaaForetak?.value is not null; + + [XmlElement("regnskapsreglerSelskap", Order = 2)] + [JsonProperty("regnskapsreglerSelskap")] + [JsonPropertyName("regnskapsreglerSelskap")] + public RegnskapsoppsettIFRS25021 regnskapsreglerSelskap { get; set; } + + public bool ShouldSerializeregnskapsreglerSelskap() => regnskapsreglerSelskap?.value is not null; + + [XmlElement("forenkletIfrs", Order = 3)] + [JsonProperty("forenkletIfrs")] + [JsonPropertyName("forenkletIfrs")] + public ForenkletIFRS36639 forenkletIfrs { get; set; } + + public bool ShouldSerializeforenkletIfrs() => forenkletIfrs?.value is not null; + + [XmlElement("regnskapsreglerKonsern", Order = 4)] + [JsonProperty("regnskapsreglerKonsern")] + [JsonPropertyName("regnskapsreglerKonsern")] + public RegnskapsoppsettKonsernIFRS25944 regnskapsreglerKonsern { get; set; } + + public bool ShouldSerializeregnskapsreglerKonsern() => regnskapsreglerKonsern?.value is not null; + + [XmlElement("forenkletIfrsKonsern", Order = 5)] + [JsonProperty("forenkletIfrsKonsern")] + [JsonPropertyName("forenkletIfrsKonsern")] + public ForenkletIFRSKonsern36641 forenkletIfrsKonsern { get; set; } + + public bool ShouldSerializeforenkletIfrsKonsern() => forenkletIfrsKonsern?.value is not null; + + [XmlElement("aarsregnskapIkkeRevideres", Order = 6)] + [JsonProperty("aarsregnskapIkkeRevideres")] + [JsonPropertyName("aarsregnskapIkkeRevideres")] + public ArsregnskapIkkeRevisjonBesluttet34669 aarsregnskapIkkeRevideres { get; set; } + + public bool ShouldSerializeaarsregnskapIkkeRevideres() => aarsregnskapIkkeRevideres?.value is not null; + + [XmlElement("aarsregnskapUtarbeidetAutorisertRegnskapsfoerer", Order = 7)] + [JsonProperty("aarsregnskapUtarbeidetAutorisertRegnskapsfoerer")] + [JsonPropertyName("aarsregnskapUtarbeidetAutorisertRegnskapsfoerer")] + public ArsregnskapUtarbeidelseAvAutorisertRegnskapsforer34670 aarsregnskapUtarbeidetAutorisertRegnskapsfoerer { get; set; } + + public bool ShouldSerializeaarsregnskapUtarbeidetAutorisertRegnskapsfoerer() => aarsregnskapUtarbeidetAutorisertRegnskapsfoerer?.value is not null; + + [XmlElement("tjenestebistandEksternAutorisertRegnskapsfoerer", Order = 8)] + [JsonProperty("tjenestebistandEksternAutorisertRegnskapsfoerer")] + [JsonPropertyName("tjenestebistandEksternAutorisertRegnskapsfoerer")] + public TjenestebistandEksternAutorisertRegnskapsforer34671 tjenestebistandEksternAutorisertRegnskapsfoerer { get; set; } + + public bool ShouldSerializetjenestebistandEksternAutorisertRegnskapsfoerer() => tjenestebistandEksternAutorisertRegnskapsfoerer?.value is not null; + + } + + public class RegnskapsreglerSmaForetak8079 + { + [XmlText()] + public string value { get; set; } + + [XmlAttribute("orid")] + [BindNever] + public string orid { get; set; } = "8079"; + + } + + public class RegnskapsoppsettIFRS25021 + { + [XmlText()] + public string value { get; set; } + + [XmlAttribute("orid")] + [BindNever] + public string orid { get; set; } = "25021"; + + } + + public class ForenkletIFRS36639 + { + [XmlText()] + public string value { get; set; } + + [XmlAttribute("orid")] + [BindNever] + public string orid { get; set; } = "36639"; + + } + + public class RegnskapsoppsettKonsernIFRS25944 + { + [XmlText()] + public string value { get; set; } + + [XmlAttribute("orid")] + [BindNever] + public string orid { get; set; } = "25944"; + + } + + public class ForenkletIFRSKonsern36641 + { + [XmlText()] + public string value { get; set; } + + [XmlAttribute("orid")] + [BindNever] + public string orid { get; set; } = "36641"; + + } + + public class ArsregnskapIkkeRevisjonBesluttet34669 + { + [XmlText()] + public string value { get; set; } + + [XmlAttribute("orid")] + [BindNever] + public string orid { get; set; } = "34669"; + + } + + public class ArsregnskapUtarbeidelseAvAutorisertRegnskapsforer34670 + { + [XmlText()] + public string value { get; set; } + + [XmlAttribute("orid")] + [BindNever] + public string orid { get; set; } = "34670"; + + } + + public class TjenestebistandEksternAutorisertRegnskapsforer34671 + { + [XmlText()] + public string value { get; set; } + + [XmlAttribute("orid")] + [BindNever] + public string orid { get; set; } = "34671"; + + } + + public class Fastsettelse + { + [XmlElement("fastsettelsesdato", Order = 1)] + [JsonProperty("fastsettelsesdato")] + [JsonPropertyName("fastsettelsesdato")] + public RegnskapFastsettelseDato17105 fastsettelsesdato { get; set; } + + public bool ShouldSerializefastsettelsesdato() => fastsettelsesdato?.value is not null; + + [XmlElement("bekreftendeSelskapsrepresentant", Order = 2)] + [JsonProperty("bekreftendeSelskapsrepresentant")] + [JsonPropertyName("bekreftendeSelskapsrepresentant")] + public StyremedlemNavnSpesifisertStyremedlem19023 bekreftendeSelskapsrepresentant { get; set; } + + public bool ShouldSerializebekreftendeSelskapsrepresentant() => bekreftendeSelskapsrepresentant?.value is not null; + + } + + public class RegnskapFastsettelseDato17105 + { + [RegularExpression(@"^[0-9]{4}-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])$")] + [XmlText()] + public string value { get; set; } + + [XmlAttribute("orid")] + [BindNever] + public string orid { get; set; } = "17105"; + + } + + public class StyremedlemNavnSpesifisertStyremedlem19023 + { + [MinLength(1)] + [MaxLength(70)] + [XmlText()] + public string value { get; set; } + + [XmlAttribute("orid")] + [BindNever] + public string orid { get; set; } = "19023"; + + } +} diff --git "a/testdata/Model/CSharp/Gitea/Br\303\270nn\303\270ysundregistrene_ReelleRettighetshavere_M.cs" "b/testdata/Model/CSharp/Gitea/Br\303\270nn\303\270ysundregistrene_ReelleRettighetshavere_M.cs" index af24e1f25b1..25e0de62305 100644 --- "a/testdata/Model/CSharp/Gitea/Br\303\270nn\303\270ysundregistrene_ReelleRettighetshavere_M.cs" +++ "b/testdata/Model/CSharp/Gitea/Br\303\270nn\303\270ysundregistrene_ReelleRettighetshavere_M.cs" @@ -1,3 +1,4 @@ +#nullable disable using System; using System.Collections.Generic; using System.ComponentModel.DataAnnotations; @@ -66,20 +67,14 @@ public class Integrasjon [JsonPropertyName("hfHentPreutfyllingFeilet")] public bool? hfHentPreutfyllingFeilet { get; set; } - public bool ShouldSerializehfHentPreutfyllingFeilet() - { - return hfHentPreutfyllingFeilet.HasValue; - } + public bool ShouldSerializehfHentPreutfyllingFeilet() => hfHentPreutfyllingFeilet.HasValue; [XmlElement("hfHentRollerFeilet", Order = 2)] [JsonProperty("hfHentRollerFeilet")] [JsonPropertyName("hfHentRollerFeilet")] public bool? hfHentRollerFeilet { get; set; } - public bool ShouldSerializehfHentRollerFeilet() - { - return hfHentRollerFeilet.HasValue; - } + public bool ShouldSerializehfHentRollerFeilet() => hfHentRollerFeilet.HasValue; } @@ -120,10 +115,7 @@ public class Skjemadata [JsonPropertyName("finnesDetReelleRettighetshavereITilleggTilRolleinnehavereForStiftelse")] public bool? finnesDetReelleRettighetshavereITilleggTilRolleinnehavereForStiftelse { get; set; } - public bool ShouldSerializefinnesDetReelleRettighetshavereITilleggTilRolleinnehavereForStiftelse() - { - return finnesDetReelleRettighetshavereITilleggTilRolleinnehavereForStiftelse.HasValue; - } + public bool ShouldSerializefinnesDetReelleRettighetshavereITilleggTilRolleinnehavereForStiftelse() => finnesDetReelleRettighetshavereITilleggTilRolleinnehavereForStiftelse.HasValue; [XmlElement("reellRettighetshaver", Order = 8)] [JsonProperty("reellRettighetshaver")] @@ -135,20 +127,14 @@ public bool ShouldSerializefinnesDetReelleRettighetshavereITilleggTilRolleinneha [JsonPropertyName("kanIkkeIdentifisereFlereReelleRettighetshavere")] public bool? kanIkkeIdentifisereFlereReelleRettighetshavere { get; set; } - public bool ShouldSerializekanIkkeIdentifisereFlereReelleRettighetshavere() - { - return kanIkkeIdentifisereFlereReelleRettighetshavere.HasValue; - } + public bool ShouldSerializekanIkkeIdentifisereFlereReelleRettighetshavere() => kanIkkeIdentifisereFlereReelleRettighetshavere.HasValue; [XmlElement("erVirksomhetRegistrertPaaRegulertMarked", Order = 10)] [JsonProperty("erVirksomhetRegistrertPaaRegulertMarked")] [JsonPropertyName("erVirksomhetRegistrertPaaRegulertMarked")] public bool? erVirksomhetRegistrertPaaRegulertMarked { get; set; } - public bool ShouldSerializeerVirksomhetRegistrertPaaRegulertMarked() - { - return erVirksomhetRegistrertPaaRegulertMarked.HasValue; - } + public bool ShouldSerializeerVirksomhetRegistrertPaaRegulertMarked() => erVirksomhetRegistrertPaaRegulertMarked.HasValue; [XmlElement("regulertMarked", Order = 11)] [JsonProperty("regulertMarked")] @@ -160,10 +146,7 @@ public bool ShouldSerializeerVirksomhetRegistrertPaaRegulertMarked() [JsonPropertyName("erReelleRettighetshavereRegistrertIUtenlandskRegister")] public bool? erReelleRettighetshavereRegistrertIUtenlandskRegister { get; set; } - public bool ShouldSerializeerReelleRettighetshavereRegistrertIUtenlandskRegister() - { - return erReelleRettighetshavereRegistrertIUtenlandskRegister.HasValue; - } + public bool ShouldSerializeerReelleRettighetshavereRegistrertIUtenlandskRegister() => erReelleRettighetshavereRegistrertIUtenlandskRegister.HasValue; [XmlElement("utenlandskRegister", Order = 13)] [JsonProperty("utenlandskRegister")] @@ -229,15 +212,20 @@ public class AarsakTilAtVirksomhetIkkeHarReelleRettighetshavere [JsonPropertyName("erOffentligVirksomhetUtenlandsk")] public bool? erOffentligVirksomhetUtenlandsk { get; set; } - public bool ShouldSerializeerOffentligVirksomhetUtenlandsk() - { - return erOffentligVirksomhetUtenlandsk.HasValue; - } + public bool ShouldSerializeerOffentligVirksomhetUtenlandsk() => erOffentligVirksomhetUtenlandsk.HasValue; } public class ReellRettighetshaver { + [XmlAttribute("altinnRowId")] + [JsonPropertyName("altinnRowId")] + [System.Text.Json.Serialization.JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)] + [Newtonsoft.Json.JsonIgnore] + public Guid AltinnRowId { get; set; } + + public bool ShouldSerializeAltinnRowId() => AltinnRowId != default; + [XmlElement("erRegistrertIFolkeregisteret", Order = 1)] [JsonProperty("erRegistrertIFolkeregisteret")] [JsonPropertyName("erRegistrertIFolkeregisteret")] @@ -249,10 +237,7 @@ public class ReellRettighetshaver [JsonPropertyName("hfErPreutfylt")] public bool? hfErPreutfylt { get; set; } - public bool ShouldSerializehfErPreutfylt() - { - return hfErPreutfylt.HasValue; - } + public bool ShouldSerializehfErPreutfylt() => hfErPreutfylt.HasValue; [XmlElement("foedselsEllerDNummer", Order = 3)] [JsonProperty("foedselsEllerDNummer")] @@ -281,10 +266,7 @@ public bool ShouldSerializehfErPreutfylt() [JsonPropertyName("hfSoekFolkeregistrertPersonFeilkode")] public long? hfSoekFolkeregistrertPersonFeilkode { get; set; } - public bool ShouldSerializehfSoekFolkeregistrertPersonFeilkode() - { - return hfSoekFolkeregistrertPersonFeilkode.HasValue; - } + public bool ShouldSerializehfSoekFolkeregistrertPersonFeilkode() => hfSoekFolkeregistrertPersonFeilkode.HasValue; [XmlElement("statsborgerskap", Order = 8)] [JsonProperty("statsborgerskap")] @@ -301,10 +283,7 @@ public bool ShouldSerializehfSoekFolkeregistrertPersonFeilkode() [JsonPropertyName("harPosisjonEierskap")] public bool? harPosisjonEierskap { get; set; } - public bool ShouldSerializeharPosisjonEierskap() - { - return harPosisjonEierskap.HasValue; - } + public bool ShouldSerializeharPosisjonEierskap() => harPosisjonEierskap.HasValue; [XmlElement("posisjonEierskap", Order = 11)] [JsonProperty("posisjonEierskap")] @@ -316,10 +295,7 @@ public bool ShouldSerializeharPosisjonEierskap() [JsonPropertyName("harPosisjonKontrollOverStemmerettigheter")] public bool? harPosisjonKontrollOverStemmerettigheter { get; set; } - public bool ShouldSerializeharPosisjonKontrollOverStemmerettigheter() - { - return harPosisjonKontrollOverStemmerettigheter.HasValue; - } + public bool ShouldSerializeharPosisjonKontrollOverStemmerettigheter() => harPosisjonKontrollOverStemmerettigheter.HasValue; [XmlElement("posisjonKontrollOverStemmerettigheter", Order = 13)] [JsonProperty("posisjonKontrollOverStemmerettigheter")] @@ -331,10 +307,7 @@ public bool ShouldSerializeharPosisjonKontrollOverStemmerettigheter() [JsonPropertyName("harPosisjonRettTilAaUtpekeEllerAvsetteMinstHalvpartenAvStyremedlemmene")] public bool? harPosisjonRettTilAaUtpekeEllerAvsetteMinstHalvpartenAvStyremedlemmene { get; set; } - public bool ShouldSerializeharPosisjonRettTilAaUtpekeEllerAvsetteMinstHalvpartenAvStyremedlemmene() - { - return harPosisjonRettTilAaUtpekeEllerAvsetteMinstHalvpartenAvStyremedlemmene.HasValue; - } + public bool ShouldSerializeharPosisjonRettTilAaUtpekeEllerAvsetteMinstHalvpartenAvStyremedlemmene() => harPosisjonRettTilAaUtpekeEllerAvsetteMinstHalvpartenAvStyremedlemmene.HasValue; [XmlElement("grunnlagForPosisjonenRettTilAaUtpekeEllerAvsetteMinstHalvpartenAvStyremedlemmene", Order = 15)] [JsonProperty("grunnlagForPosisjonenRettTilAaUtpekeEllerAvsetteMinstHalvpartenAvStyremedlemmene")] @@ -346,10 +319,7 @@ public bool ShouldSerializeharPosisjonRettTilAaUtpekeEllerAvsetteMinstHalvparten [JsonPropertyName("harPosisjonKontrollPaaAnnenMaate")] public bool? harPosisjonKontrollPaaAnnenMaate { get; set; } - public bool ShouldSerializeharPosisjonKontrollPaaAnnenMaate() - { - return harPosisjonKontrollPaaAnnenMaate.HasValue; - } + public bool ShouldSerializeharPosisjonKontrollPaaAnnenMaate() => harPosisjonKontrollPaaAnnenMaate.HasValue; [XmlElement("beskrivelseAvPosisjonenKontrollPaaAnnenMaate", Order = 17)] [JsonProperty("beskrivelseAvPosisjonenKontrollPaaAnnenMaate")] @@ -361,10 +331,7 @@ public bool ShouldSerializeharPosisjonKontrollPaaAnnenMaate() [JsonPropertyName("harPosisjonAvgittGrunnkapital")] public bool? harPosisjonAvgittGrunnkapital { get; set; } - public bool ShouldSerializeharPosisjonAvgittGrunnkapital() - { - return harPosisjonAvgittGrunnkapital.HasValue; - } + public bool ShouldSerializeharPosisjonAvgittGrunnkapital() => harPosisjonAvgittGrunnkapital.HasValue; [XmlElement("posisjonAvgittGrunnkapital", Order = 19)] [JsonProperty("posisjonAvgittGrunnkapital")] @@ -376,10 +343,7 @@ public bool ShouldSerializeharPosisjonAvgittGrunnkapital() [JsonPropertyName("harPosisjonRettTilAaUtpekeEtFlertallAvStyremedlemmene")] public bool? harPosisjonRettTilAaUtpekeEtFlertallAvStyremedlemmene { get; set; } - public bool ShouldSerializeharPosisjonRettTilAaUtpekeEtFlertallAvStyremedlemmene() - { - return harPosisjonRettTilAaUtpekeEtFlertallAvStyremedlemmene.HasValue; - } + public bool ShouldSerializeharPosisjonRettTilAaUtpekeEtFlertallAvStyremedlemmene() => harPosisjonRettTilAaUtpekeEtFlertallAvStyremedlemmene.HasValue; [XmlElement("posisjonRettTilAaUtpekeEtFlertallAvStyremedlemmene", Order = 21)] [JsonProperty("posisjonRettTilAaUtpekeEtFlertallAvStyremedlemmene")] @@ -391,10 +355,7 @@ public bool ShouldSerializeharPosisjonRettTilAaUtpekeEtFlertallAvStyremedlemmene [JsonPropertyName("harPosisjonSaerligeRettigheter")] public bool? harPosisjonSaerligeRettigheter { get; set; } - public bool ShouldSerializeharPosisjonSaerligeRettigheter() - { - return harPosisjonSaerligeRettigheter.HasValue; - } + public bool ShouldSerializeharPosisjonSaerligeRettigheter() => harPosisjonSaerligeRettigheter.HasValue; [XmlElement("posisjonSaerligeRettigheter", Order = 23)] [JsonProperty("posisjonSaerligeRettigheter")] @@ -406,10 +367,7 @@ public bool ShouldSerializeharPosisjonSaerligeRettigheter() [JsonPropertyName("harPosisjonDestinatar")] public bool? harPosisjonDestinatar { get; set; } - public bool ShouldSerializeharPosisjonDestinatar() - { - return harPosisjonDestinatar.HasValue; - } + public bool ShouldSerializeharPosisjonDestinatar() => harPosisjonDestinatar.HasValue; [XmlElement("posisjonDestinatar", Order = 25)] [JsonProperty("posisjonDestinatar")] @@ -421,16 +379,6 @@ public bool ShouldSerializeharPosisjonDestinatar() [JsonPropertyName("hfPosisjonsbeskrivelse")] public string hfPosisjonsbeskrivelse { get; set; } - [XmlAttribute("altinnRowId")] - [JsonPropertyName("altinnRowId")] - [System.Text.Json.Serialization.JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)] - [Newtonsoft.Json.JsonIgnore] - public Guid AltinnRowId { get; set; } - - public bool ShouldSerializeAltinnRowId() - { - return AltinnRowId != default; - } } public class Posisjon @@ -454,6 +402,14 @@ public class Posisjon public class MellomliggendeVirksomhet { + [XmlAttribute("altinnRowId")] + [JsonPropertyName("altinnRowId")] + [System.Text.Json.Serialization.JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)] + [Newtonsoft.Json.JsonIgnore] + public Guid AltinnRowId { get; set; } + + public bool ShouldSerializeAltinnRowId() => AltinnRowId != default; + [XmlElement("erUtenlandskVirksomhet", Order = 1)] [JsonProperty("erUtenlandskVirksomhet")] [JsonPropertyName("erUtenlandskVirksomhet")] @@ -485,16 +441,6 @@ public class MellomliggendeVirksomhet [JsonPropertyName("hfLandnavn")] public string hfLandnavn { get; set; } - [XmlAttribute("altinnRowId")] - [JsonPropertyName("altinnRowId")] - [System.Text.Json.Serialization.JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)] - [Newtonsoft.Json.JsonIgnore] - public Guid AltinnRowId { get; set; } - - public bool ShouldSerializeAltinnRowId() - { - return AltinnRowId != default; - } } public class UtenlandskVirksomhet @@ -613,6 +559,14 @@ public class UtenlandskRegister public class Rolleinnehaver { + [XmlAttribute("altinnRowId")] + [JsonPropertyName("altinnRowId")] + [System.Text.Json.Serialization.JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)] + [Newtonsoft.Json.JsonIgnore] + public Guid AltinnRowId { get; set; } + + public bool ShouldSerializeAltinnRowId() => AltinnRowId != default; + [RegularExpression(@"^[0-9]{4}-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])$")] [XmlElement("foedselsdato", Order = 1)] [JsonProperty("foedselsdato")] @@ -629,15 +583,5 @@ public class Rolleinnehaver [JsonPropertyName("rolle")] public string rolle { get; set; } - [XmlAttribute("altinnRowId")] - [JsonPropertyName("altinnRowId")] - [System.Text.Json.Serialization.JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)] - [Newtonsoft.Json.JsonIgnore] - public Guid AltinnRowId { get; set; } - - public bool ShouldSerializeAltinnRowId() - { - return AltinnRowId != default; - } } } diff --git "a/testdata/Model/CSharp/Gitea/Kursdomene_APIN\303\270kkel_M_2020-05-26_5702_34556_SERES.cs" "b/testdata/Model/CSharp/Gitea/Kursdomene_APIN\303\270kkel_M_2020-05-26_5702_34556_SERES.cs" index 1af349c54f6..0e242fe8fa1 100644 --- "a/testdata/Model/CSharp/Gitea/Kursdomene_APIN\303\270kkel_M_2020-05-26_5702_34556_SERES.cs" +++ "b/testdata/Model/CSharp/Gitea/Kursdomene_APIN\303\270kkel_M_2020-05-26_5702_34556_SERES.cs" @@ -1,9 +1,9 @@ +#nullable disable using System; using System.Collections.Generic; using System.ComponentModel.DataAnnotations; using System.Linq; using System.Text.Json.Serialization; -using System.Threading.Tasks; using System.Xml.Serialization; using Microsoft.AspNetCore.Mvc.ModelBinding; using Newtonsoft.Json; @@ -14,15 +14,15 @@ public class APINoekkel_M { [XmlAttribute("dataFormatProvider")] [BindNever] - public string dataFormatProvider {get; set; } = "SERES"; + public string dataFormatProvider { get; set; } = "SERES"; [XmlAttribute("dataFormatId")] [BindNever] - public string dataFormatId {get; set; } = "5702"; + public string dataFormatId { get; set; } = "5702"; [XmlAttribute("dataFormatVersion")] [BindNever] - public string dataFormatVersion {get; set; } = "34556"; + public string dataFormatVersion { get; set; } = "34556"; [XmlElement("Applikasjon", Order = 1)] [JsonProperty("Applikasjon")] diff --git "a/testdata/Model/CSharp/Gitea/Kursdomene_BekrefteBruksvilk\303\245r_M_2020-05-25_5704_34554_SERES.cs" "b/testdata/Model/CSharp/Gitea/Kursdomene_BekrefteBruksvilk\303\245r_M_2020-05-25_5704_34554_SERES.cs" index 5482b0bf52f..a10a41aa0e1 100644 --- "a/testdata/Model/CSharp/Gitea/Kursdomene_BekrefteBruksvilk\303\245r_M_2020-05-25_5704_34554_SERES.cs" +++ "b/testdata/Model/CSharp/Gitea/Kursdomene_BekrefteBruksvilk\303\245r_M_2020-05-25_5704_34554_SERES.cs" @@ -1,9 +1,9 @@ +#nullable disable using System; using System.Collections.Generic; using System.ComponentModel.DataAnnotations; using System.Linq; using System.Text.Json.Serialization; -using System.Threading.Tasks; using System.Xml.Serialization; using Microsoft.AspNetCore.Mvc.ModelBinding; using Newtonsoft.Json; @@ -14,15 +14,15 @@ public class BekrefteBruksvilkaar_M { [XmlAttribute("dataFormatProvider")] [BindNever] - public string dataFormatProvider {get; set; } = "SERES"; + public string dataFormatProvider { get; set; } = "SERES"; [XmlAttribute("dataFormatId")] [BindNever] - public string dataFormatId {get; set; } = "5704"; + public string dataFormatId { get; set; } = "5704"; [XmlAttribute("dataFormatVersion")] [BindNever] - public string dataFormatVersion {get; set; } = "34554"; + public string dataFormatVersion { get; set; } = "34554"; [XmlElement("Tjenesteeier", Order = 1)] [JsonProperty("Tjenesteeier")] diff --git a/testdata/Model/CSharp/Gitea/Kursdomene_BliTjenesteeier_M_2020-05-25_5703_34553_SERES.cs b/testdata/Model/CSharp/Gitea/Kursdomene_BliTjenesteeier_M_2020-05-25_5703_34553_SERES.cs index 918a0cdcb44..8555a471853 100644 --- a/testdata/Model/CSharp/Gitea/Kursdomene_BliTjenesteeier_M_2020-05-25_5703_34553_SERES.cs +++ b/testdata/Model/CSharp/Gitea/Kursdomene_BliTjenesteeier_M_2020-05-25_5703_34553_SERES.cs @@ -1,9 +1,9 @@ +#nullable disable using System; using System.Collections.Generic; using System.ComponentModel.DataAnnotations; using System.Linq; using System.Text.Json.Serialization; -using System.Threading.Tasks; using System.Xml.Serialization; using Microsoft.AspNetCore.Mvc.ModelBinding; using Newtonsoft.Json; @@ -14,15 +14,15 @@ public class BliTjenesteeier_M { [XmlAttribute("dataFormatProvider")] [BindNever] - public string dataFormatProvider {get; set; } = "SERES"; + public string dataFormatProvider { get; set; } = "SERES"; [XmlAttribute("dataFormatId")] [BindNever] - public string dataFormatId {get; set; } = "5703"; + public string dataFormatId { get; set; } = "5703"; [XmlAttribute("dataFormatVersion")] [BindNever] - public string dataFormatVersion {get; set; } = "34553"; + public string dataFormatVersion { get; set; } = "34553"; [XmlElement("Tjenesteeier", Order = 1)] [JsonProperty("Tjenesteeier")] diff --git a/testdata/Model/CSharp/Gitea/aal-vedlegg.cs b/testdata/Model/CSharp/Gitea/aal-vedlegg.cs index 99bffb3ce5e..a7b5a08b4fa 100644 --- a/testdata/Model/CSharp/Gitea/aal-vedlegg.cs +++ b/testdata/Model/CSharp/Gitea/aal-vedlegg.cs @@ -1,9 +1,9 @@ +#nullable disable using System; using System.Collections.Generic; using System.ComponentModel.DataAnnotations; using System.Linq; using System.Text.Json.Serialization; -using System.Threading.Tasks; using System.Xml.Serialization; using Microsoft.AspNetCore.Mvc.ModelBinding; using Newtonsoft.Json; diff --git a/testdata/Model/CSharp/Gitea/bokskjema.cs b/testdata/Model/CSharp/Gitea/bokskjema.cs index de498192354..59933211b9e 100644 --- a/testdata/Model/CSharp/Gitea/bokskjema.cs +++ b/testdata/Model/CSharp/Gitea/bokskjema.cs @@ -1,9 +1,9 @@ +#nullable disable using System; using System.Collections.Generic; using System.ComponentModel.DataAnnotations; using System.Linq; using System.Text.Json.Serialization; -using System.Threading.Tasks; using System.Xml.Serialization; using Microsoft.AspNetCore.Mvc.ModelBinding; using Newtonsoft.Json; @@ -63,10 +63,7 @@ public class schematic [JsonPropertyName("meantForPress")] public bool? meantForPress { get; set; } - public bool ShouldSerializemeantForPress() - { - return meantForPress.HasValue; - } + public bool ShouldSerializemeantForPress() => meantForPress.HasValue; [XmlElement("language", Order = 11)] [JsonProperty("language")] @@ -98,10 +95,7 @@ public bool ShouldSerializemeantForPress() [JsonPropertyName("hasISBN")] public bool? hasISBN { get; set; } - public bool ShouldSerializehasISBN() - { - return hasISBN.HasValue; - } + public bool ShouldSerializehasISBN() => hasISBN.HasValue; [RegularExpression(@"(?=[\S\s]{13}$|[\S\s]{17}$)[\S\s]*^(978([\-]?)[0-9]{2}([\-]?)([0-1][0-9]|[2-6][0-9]{2}|[78][0-9]{3}|9[0-8][0-9]{3}|99[0-9]{4}|69[0-9]{4})([\-]?)[0-9]{1,5}([\-]?)[xX0-9])$")] [XmlElement("isbn", Order = 17)] @@ -119,10 +113,7 @@ public bool ShouldSerializehasISBN() [JsonPropertyName("isSeries")] public bool? isSeries { get; set; } - public bool ShouldSerializeisSeries() - { - return isSeries.HasValue; - } + public bool ShouldSerializeisSeries() => isSeries.HasValue; [RegularExpression(@"(?=[\S\s]{8}$|[\S\s]{9}$)[\S\s]*^([0-9]{4}([\-]?)[0-9]{3}[xX0-9])$")] [XmlElement("issn", Order = 20)] @@ -170,10 +161,7 @@ public bool ShouldSerializeisSeries() [JsonPropertyName("hasISMN")] public bool? hasISMN { get; set; } - public bool ShouldSerializehasISMN() - { - return hasISMN.HasValue; - } + public bool ShouldSerializehasISMN() => hasISMN.HasValue; [RegularExpression(@"(?=[\S\s]{13}$|[\S\s]{17}$)[\S\s]*^(979([\-]?)0([\-]?)(0[0-9]{2}|[1-3][0-9]{3}|[4-6][0-9]{4}|[78][0-9]{5}|9[0-9]{6})([\-]?)[0-9]{1,5}([\-]?)[xX0-9])$")] [XmlElement("ismn", Order = 29)] @@ -187,20 +175,14 @@ public bool ShouldSerializehasISMN() [JsonPropertyName("orgNumber")] public decimal? orgNumber { get; set; } - public bool ShouldSerializeorgNumber() - { - return orgNumber.HasValue; - } + public bool ShouldSerializeorgNumber() => orgNumber.HasValue; [XmlElement("access", Order = 31)] [JsonProperty("access")] [JsonPropertyName("access")] public bool? access { get; set; } - public bool ShouldSerializeaccess() - { - return access.HasValue; - } + public bool ShouldSerializeaccess() => access.HasValue; [XmlElement("comment", Order = 32)] [JsonProperty("comment")] @@ -216,6 +198,14 @@ public bool ShouldSerializeaccess() public class personOfResponsibility { + [XmlAttribute("altinnRowId")] + [JsonPropertyName("altinnRowId")] + [System.Text.Json.Serialization.JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)] + [Newtonsoft.Json.JsonIgnore] + public Guid AltinnRowId { get; set; } + + public bool ShouldSerializeAltinnRowId() => AltinnRowId != default; + [XmlElement("role", Order = 1)] [JsonProperty("role")] [JsonPropertyName("role")] @@ -231,21 +221,18 @@ public class personOfResponsibility [JsonPropertyName("lastname")] public string lastname { get; set; } + } + + public class organizationOfResponsibility + { [XmlAttribute("altinnRowId")] [JsonPropertyName("altinnRowId")] [System.Text.Json.Serialization.JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)] [Newtonsoft.Json.JsonIgnore] public Guid AltinnRowId { get; set; } - public bool ShouldSerializeAltinnRowId() - { - return AltinnRowId != default; - } + public bool ShouldSerializeAltinnRowId() => AltinnRowId != default; - } - - public class organizationOfResponsibility - { [XmlElement("orgName", Order = 1)] [JsonProperty("orgName")] [JsonPropertyName("orgName")] @@ -256,34 +243,22 @@ public class organizationOfResponsibility [JsonPropertyName("orgRole")] public string orgRole { get; set; } + } + + public class publisherObject + { [XmlAttribute("altinnRowId")] [JsonPropertyName("altinnRowId")] [System.Text.Json.Serialization.JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)] [Newtonsoft.Json.JsonIgnore] public Guid AltinnRowId { get; set; } - public bool ShouldSerializeAltinnRowId() - { - return AltinnRowId != default; - } - } + public bool ShouldSerializeAltinnRowId() => AltinnRowId != default; - public class publisherObject - { [XmlElement("publisherName", Order = 1)] [JsonProperty("publisherName")] [JsonPropertyName("publisherName")] public string publisherName { get; set; } - [XmlAttribute("altinnRowId")] - [JsonPropertyName("altinnRowId")] - [System.Text.Json.Serialization.JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)] - [Newtonsoft.Json.JsonIgnore] - public Guid AltinnRowId { get; set; } - - public bool ShouldSerializeAltinnRowId() - { - return AltinnRowId != default; - } } } diff --git a/testdata/Model/CSharp/Gitea/dat-aarligmelding-bemanning.cs b/testdata/Model/CSharp/Gitea/dat-aarligmelding-bemanning.cs index ebd49fbffec..5d1b3137852 100644 --- a/testdata/Model/CSharp/Gitea/dat-aarligmelding-bemanning.cs +++ b/testdata/Model/CSharp/Gitea/dat-aarligmelding-bemanning.cs @@ -1,9 +1,9 @@ +#nullable disable using System; using System.Collections.Generic; using System.ComponentModel.DataAnnotations; using System.Linq; using System.Text.Json.Serialization; -using System.Threading.Tasks; using System.Xml.Serialization; using Microsoft.AspNetCore.Mvc.ModelBinding; using Newtonsoft.Json; diff --git a/testdata/Model/CSharp/Gitea/dat-bilpleie-soknad.cs b/testdata/Model/CSharp/Gitea/dat-bilpleie-soknad.cs index c574612947c..7d40621b932 100644 --- a/testdata/Model/CSharp/Gitea/dat-bilpleie-soknad.cs +++ b/testdata/Model/CSharp/Gitea/dat-bilpleie-soknad.cs @@ -1,3 +1,4 @@ +#nullable disable using System; using System.Collections.Generic; using System.ComponentModel.DataAnnotations; @@ -144,10 +145,7 @@ public class Virksomhet [JsonPropertyName("AntallAnsatte")] public decimal? AntallAnsatte { get; set; } - public bool ShouldSerializeAntallAnsatte() - { - return AntallAnsatte.HasValue; - } + public bool ShouldSerializeAntallAnsatte() => AntallAnsatte.HasValue; [XmlElement("Underenheter", Order = 6)] [JsonProperty("Underenheter")] @@ -167,6 +165,14 @@ public class ArrayOfUnderenhet public class Underenhet { + [XmlAttribute("altinnRowId")] + [JsonPropertyName("altinnRowId")] + [System.Text.Json.Serialization.JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)] + [Newtonsoft.Json.JsonIgnore] + public Guid AltinnRowId { get; set; } + + public bool ShouldSerializeAltinnRowId() => AltinnRowId != default; + [MinLength(0)] [MaxLength(255)] [XmlElement("Organisasjonsnummer", Order = 1)] @@ -186,16 +192,6 @@ public class Underenhet [JsonPropertyName("Adresse")] public Adresse Adresse { get; set; } - [XmlAttribute("altinnRowId")] - [JsonPropertyName("altinnRowId")] - [System.Text.Json.Serialization.JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)] - [Newtonsoft.Json.JsonIgnore] - public Guid AltinnRowId { get; set; } - - public bool ShouldSerializeAltinnRowId() - { - return AltinnRowId != default; - } } public class InnholdSkjema @@ -205,20 +201,14 @@ public class InnholdSkjema [JsonPropertyName("ErIStatensVegvesen")] public bool? ErIStatensVegvesen { get; set; } - public bool ShouldSerializeErIStatensVegvesen() - { - return ErIStatensVegvesen.HasValue; - } + public bool ShouldSerializeErIStatensVegvesen() => ErIStatensVegvesen.HasValue; [XmlElement("KunAnsvarligSkalArbeide", Order = 2)] [JsonProperty("KunAnsvarligSkalArbeide")] [JsonPropertyName("KunAnsvarligSkalArbeide")] public bool? KunAnsvarligSkalArbeide { get; set; } - public bool ShouldSerializeKunAnsvarligSkalArbeide() - { - return KunAnsvarligSkalArbeide.HasValue; - } + public bool ShouldSerializeKunAnsvarligSkalArbeide() => KunAnsvarligSkalArbeide.HasValue; [Range(0,Double.MaxValue)] [XmlElement("AntallAnsatteEgenUtfylt", Order = 3)] @@ -226,10 +216,7 @@ public bool ShouldSerializeKunAnsvarligSkalArbeide() [JsonPropertyName("AntallAnsatteEgenUtfylt")] public decimal? AntallAnsatteEgenUtfylt { get; set; } - public bool ShouldSerializeAntallAnsatteEgenUtfylt() - { - return AntallAnsatteEgenUtfylt.HasValue; - } + public bool ShouldSerializeAntallAnsatteEgenUtfylt() => AntallAnsatteEgenUtfylt.HasValue; [Range(0,Double.MaxValue)] [XmlElement("AntallHMSKort", Order = 4)] @@ -237,20 +224,14 @@ public bool ShouldSerializeAntallAnsatteEgenUtfylt() [JsonPropertyName("AntallHMSKort")] public decimal? AntallHMSKort { get; set; } - public bool ShouldSerializeAntallHMSKort() - { - return AntallHMSKort.HasValue; - } + public bool ShouldSerializeAntallHMSKort() => AntallHMSKort.HasValue; [XmlElement("SkalUnderenheterJobbeMedBilpleie", Order = 5)] [JsonProperty("SkalUnderenheterJobbeMedBilpleie")] [JsonPropertyName("SkalUnderenheterJobbeMedBilpleie")] public bool? SkalUnderenheterJobbeMedBilpleie { get; set; } - public bool ShouldSerializeSkalUnderenheterJobbeMedBilpleie() - { - return SkalUnderenheterJobbeMedBilpleie.HasValue; - } + public bool ShouldSerializeSkalUnderenheterJobbeMedBilpleie() => SkalUnderenheterJobbeMedBilpleie.HasValue; [XmlElement("UnderenheterSomSkalBilpleie", Order = 6)] [JsonProperty("UnderenheterSomSkalBilpleie")] @@ -262,10 +243,7 @@ public bool ShouldSerializeSkalUnderenheterJobbeMedBilpleie() [JsonPropertyName("OmfattetAvForurensingsforskriften")] public bool? OmfattetAvForurensingsforskriften { get; set; } - public bool ShouldSerializeOmfattetAvForurensingsforskriften() - { - return OmfattetAvForurensingsforskriften.HasValue; - } + public bool ShouldSerializeOmfattetAvForurensingsforskriften() => OmfattetAvForurensingsforskriften.HasValue; [XmlElement("UnderenheterOmfattetAvForurensingsforskriften", Order = 8)] [JsonProperty("UnderenheterOmfattetAvForurensingsforskriften")] @@ -277,10 +255,7 @@ public bool ShouldSerializeOmfattetAvForurensingsforskriften() [JsonPropertyName("HarVerneombud")] public bool? HarVerneombud { get; set; } - public bool ShouldSerializeHarVerneombud() - { - return HarVerneombud.HasValue; - } + public bool ShouldSerializeHarVerneombud() => HarVerneombud.HasValue; [MinLength(0)] [MaxLength(255)] @@ -301,20 +276,14 @@ public bool ShouldSerializeHarVerneombud() [JsonPropertyName("AlternativOrdning")] public bool? AlternativOrdning { get; set; } - public bool ShouldSerializeAlternativOrdning() - { - return AlternativOrdning.HasValue; - } + public bool ShouldSerializeAlternativOrdning() => AlternativOrdning.HasValue; [XmlElement("HarAMU", Order = 13)] [JsonProperty("HarAMU")] [JsonPropertyName("HarAMU")] public bool? HarAMU { get; set; } - public bool ShouldSerializeHarAMU() - { - return HarAMU.HasValue; - } + public bool ShouldSerializeHarAMU() => HarAMU.HasValue; [Range(Double.MinValue,Double.MaxValue)] [XmlElement("BHTorgnr", Order = 14)] @@ -322,10 +291,7 @@ public bool ShouldSerializeHarAMU() [JsonPropertyName("BHTorgnr")] public decimal? BHTorgnr { get; set; } - public bool ShouldSerializeBHTorgnr() - { - return BHTorgnr.HasValue; - } + public bool ShouldSerializeBHTorgnr() => BHTorgnr.HasValue; [XmlElement("Arbeidsavtaler", Order = 15)] [JsonProperty("Arbeidsavtaler")] @@ -337,10 +303,7 @@ public bool ShouldSerializeBHTorgnr() [JsonPropertyName("ErUtfyllerKontaktPerson")] public bool? ErUtfyllerKontaktPerson { get; set; } - public bool ShouldSerializeErUtfyllerKontaktPerson() - { - return ErUtfyllerKontaktPerson.HasValue; - } + public bool ShouldSerializeErUtfyllerKontaktPerson() => ErUtfyllerKontaktPerson.HasValue; [MinLength(0)] [MaxLength(255)] @@ -368,20 +331,14 @@ public bool ShouldSerializeErUtfyllerKontaktPerson() [JsonPropertyName("BekreftOpplysninger")] public bool? BekreftOpplysninger { get; set; } - public bool ShouldSerializeBekreftOpplysninger() - { - return BekreftOpplysninger.HasValue; - } + public bool ShouldSerializeBekreftOpplysninger() => BekreftOpplysninger.HasValue; [XmlElement("BekreftStraff", Order = 21)] [JsonProperty("BekreftStraff")] [JsonPropertyName("BekreftStraff")] public bool? BekreftStraff { get; set; } - public bool ShouldSerializeBekreftStraff() - { - return BekreftStraff.HasValue; - } + public bool ShouldSerializeBekreftStraff() => BekreftStraff.HasValue; } } diff --git a/testdata/Model/CSharp/Gitea/dat-skjema.cs b/testdata/Model/CSharp/Gitea/dat-skjema.cs index d386ff4b2dd..e8717c0dbba 100644 --- a/testdata/Model/CSharp/Gitea/dat-skjema.cs +++ b/testdata/Model/CSharp/Gitea/dat-skjema.cs @@ -1,3 +1,4 @@ +#nullable disable using System; using System.Collections.Generic; using System.ComponentModel.DataAnnotations; @@ -156,6 +157,14 @@ public class ArrayOfUnderenhet public class Underenhet { + [XmlAttribute("altinnRowId")] + [JsonPropertyName("altinnRowId")] + [System.Text.Json.Serialization.JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)] + [Newtonsoft.Json.JsonIgnore] + public Guid AltinnRowId { get; set; } + + public bool ShouldSerializeAltinnRowId() => AltinnRowId != default; + [MinLength(0)] [MaxLength(255)] [XmlElement("Organisasjonsnummer", Order = 1)] @@ -175,16 +184,6 @@ public class Underenhet [JsonPropertyName("Adresse")] public Adresse Adresse { get; set; } - [XmlAttribute("altinnRowId")] - [JsonPropertyName("altinnRowId")] - [System.Text.Json.Serialization.JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)] - [Newtonsoft.Json.JsonIgnore] - public Guid AltinnRowId { get; set; } - - public bool ShouldSerializeAltinnRowId() - { - return AltinnRowId != default; - } } public class InnholdSkjema @@ -195,10 +194,7 @@ public class InnholdSkjema [JsonPropertyName("AntallAnsatte")] public decimal? AntallAnsatte { get; set; } - public bool ShouldSerializeAntallAnsatte() - { - return AntallAnsatte.HasValue; - } + public bool ShouldSerializeAntallAnsatte() => AntallAnsatte.HasValue; [XmlElement("ASellerASAiHjemland", Order = 2)] [JsonProperty("ASellerASAiHjemland")] diff --git a/testdata/Model/CSharp/Gitea/dev-nill-test.cs b/testdata/Model/CSharp/Gitea/dev-nill-test.cs index 2981994292f..6e60f610c8d 100644 --- a/testdata/Model/CSharp/Gitea/dev-nill-test.cs +++ b/testdata/Model/CSharp/Gitea/dev-nill-test.cs @@ -1,60 +1,54 @@ +#nullable disable using System; using System.Collections.Generic; using System.ComponentModel.DataAnnotations; using System.Linq; using System.Text.Json.Serialization; -using System.Threading.Tasks; using System.Xml.Serialization; using Microsoft.AspNetCore.Mvc.ModelBinding; using Newtonsoft.Json; namespace Altinn.App.Models { - [XmlRoot(ElementName="modell")] - public class modell - { - [XmlElement("element", Order = 1)] - [JsonProperty("element")] - [JsonPropertyName("element")] - public ModelType element { get; set; } - - } - - public class ModelType - { - [XmlElement("nonNillableRef", Order = 1)] - [JsonProperty("nonNillableRef")] - [JsonPropertyName("nonNillableRef")] - public bool? nonNillableRef { get; set; } - - public bool ShouldSerializenonNillableRef() - { - return nonNillableRef.HasValue; - } - - [XmlElement("nillableRef", Order = 2)] - [JsonProperty("nillableRef")] - [JsonPropertyName("nillableRef")] - public bool? nillableRef { get; set; } - - [XmlElement("nonNillableBoolean", Order = 3)] - [JsonProperty("nonNillableBoolean")] - [JsonPropertyName("nonNillableBoolean")] - public bool? nonNillableBoolean { get; set; } - - public bool ShouldSerializenonNillableBoolean() - { - return nonNillableBoolean.HasValue; - } - - [XmlElement("nillableBoolean", Order = 4)] - [JsonProperty("nillableBoolean")] - [JsonPropertyName("nillableBoolean")] - public bool? nillableBoolean { get; set; } - - [XmlElement("s1", Order = 5)] - [JsonProperty("s1")] - [JsonPropertyName("s1")] - public string s1 { get; set; } - - } + [XmlRoot(ElementName="modell")] + public class modell + { + [XmlElement("element", Order = 1)] + [JsonProperty("element")] + [JsonPropertyName("element")] + public ModelType element { get; set; } + + } + + public class ModelType + { + [XmlElement("nonNillableRef", Order = 1)] + [JsonProperty("nonNillableRef")] + [JsonPropertyName("nonNillableRef")] + public bool? nonNillableRef { get; set; } + + public bool ShouldSerializenonNillableRef() => nonNillableRef.HasValue; + + [XmlElement("nillableRef", Order = 2)] + [JsonProperty("nillableRef")] + [JsonPropertyName("nillableRef")] + public bool? nillableRef { get; set; } + + [XmlElement("nonNillableBoolean", Order = 3)] + [JsonProperty("nonNillableBoolean")] + [JsonPropertyName("nonNillableBoolean")] + public bool? nonNillableBoolean { get; set; } + + public bool ShouldSerializenonNillableBoolean() => nonNillableBoolean.HasValue; + + [XmlElement("nillableBoolean", Order = 4)] + [JsonProperty("nillableBoolean")] + [JsonPropertyName("nillableBoolean")] + public bool? nillableBoolean { get; set; } + + [XmlElement("s1", Order = 5)] + [JsonProperty("s1")] + [JsonPropertyName("s1")] + public string s1 { get; set; } + + } } diff --git a/testdata/Model/CSharp/Gitea/dihe-redusert-foreldrebetaling-bhg.cs b/testdata/Model/CSharp/Gitea/dihe-redusert-foreldrebetaling-bhg.cs index 753bd420375..caae63ccc17 100644 --- a/testdata/Model/CSharp/Gitea/dihe-redusert-foreldrebetaling-bhg.cs +++ b/testdata/Model/CSharp/Gitea/dihe-redusert-foreldrebetaling-bhg.cs @@ -1,3 +1,4 @@ +#nullable disable using System; using System.Collections.Generic; using System.ComponentModel.DataAnnotations; @@ -134,6 +135,14 @@ public class AVSMOT public class DOKLINK { + [XmlAttribute("altinnRowId")] + [JsonPropertyName("altinnRowId")] + [System.Text.Json.Serialization.JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)] + [Newtonsoft.Json.JsonIgnore] + public Guid AltinnRowId { get; set; } + + public bool ShouldSerializeAltinnRowId() => AltinnRowId != default; + [XmlElement("DL_DOKID_DB", Order = 1)] [JsonProperty("DL_DOKID_DB")] [JsonPropertyName("DL_DOKID_DB")] @@ -144,20 +153,18 @@ public class DOKLINK [JsonPropertyName("DL_TYPE_DT")] public string DL_TYPE_DT { get; set; } + } + + public class DOKBESKRIV + { [XmlAttribute("altinnRowId")] [JsonPropertyName("altinnRowId")] [System.Text.Json.Serialization.JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)] [Newtonsoft.Json.JsonIgnore] public Guid AltinnRowId { get; set; } - public bool ShouldSerializeAltinnRowId() - { - return AltinnRowId != default; - } - } + public bool ShouldSerializeAltinnRowId() => AltinnRowId != default; - public class DOKBESKRIV - { [XmlElement("DB_DOKID", Order = 1)] [JsonProperty("DB_DOKID")] [JsonPropertyName("DB_DOKID")] @@ -168,20 +175,18 @@ public class DOKBESKRIV [JsonPropertyName("DB_TITTEL")] public string DB_TITTEL { get; set; } + } + + public class DOKVERSJON + { [XmlAttribute("altinnRowId")] [JsonPropertyName("altinnRowId")] [System.Text.Json.Serialization.JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)] [Newtonsoft.Json.JsonIgnore] public Guid AltinnRowId { get; set; } - public bool ShouldSerializeAltinnRowId() - { - return AltinnRowId != default; - } - } + public bool ShouldSerializeAltinnRowId() => AltinnRowId != default; - public class DOKVERSJON - { [XmlElement("VE_DOKID_DB", Order = 1)] [JsonProperty("VE_DOKID_DB")] [JsonPropertyName("VE_DOKID_DB")] @@ -197,16 +202,6 @@ public class DOKVERSJON [JsonPropertyName("VE_FILREF")] public string VE_FILREF { get; set; } - [XmlAttribute("altinnRowId")] - [JsonPropertyName("altinnRowId")] - [System.Text.Json.Serialization.JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)] - [Newtonsoft.Json.JsonIgnore] - public Guid AltinnRowId { get; set; } - - public bool ShouldSerializeAltinnRowId() - { - return AltinnRowId != default; - } } public class FlatData @@ -311,6 +306,14 @@ public class Soker public class Barn { + [XmlAttribute("altinnRowId")] + [JsonPropertyName("altinnRowId")] + [System.Text.Json.Serialization.JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)] + [Newtonsoft.Json.JsonIgnore] + public Guid AltinnRowId { get; set; } + + public bool ShouldSerializeAltinnRowId() => AltinnRowId != default; + [XmlElement("navn", Order = 1)] [JsonProperty("navn")] [JsonPropertyName("navn")] @@ -336,20 +339,18 @@ public class Barn [JsonPropertyName("bhgEllerSfo")] public string bhgEllerSfo { get; set; } + } + + public class Skattegrunnlag + { [XmlAttribute("altinnRowId")] [JsonPropertyName("altinnRowId")] [System.Text.Json.Serialization.JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)] [Newtonsoft.Json.JsonIgnore] public Guid AltinnRowId { get; set; } - public bool ShouldSerializeAltinnRowId() - { - return AltinnRowId != default; - } - } + public bool ShouldSerializeAltinnRowId() => AltinnRowId != default; - public class Skattegrunnlag - { [XmlElement("grunnlagNavn", Order = 1)] [JsonProperty("grunnlagNavn")] [JsonPropertyName("grunnlagNavn")] @@ -362,16 +363,6 @@ public class Skattegrunnlag [Required] public decimal? beloep { get; set; } - [XmlAttribute("altinnRowId")] - [JsonPropertyName("altinnRowId")] - [System.Text.Json.Serialization.JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)] - [Newtonsoft.Json.JsonIgnore] - public Guid AltinnRowId { get; set; } - - public bool ShouldSerializeAltinnRowId() - { - return AltinnRowId != default; - } } public class AppLogikk diff --git a/testdata/Model/CSharp/Gitea/hi-algeskjema.cs b/testdata/Model/CSharp/Gitea/hi-algeskjema.cs index e9ef68a6eb7..b79add18412 100644 --- a/testdata/Model/CSharp/Gitea/hi-algeskjema.cs +++ b/testdata/Model/CSharp/Gitea/hi-algeskjema.cs @@ -1,3 +1,4 @@ +#nullable disable using System; using System.Collections.Generic; using System.ComponentModel.DataAnnotations; @@ -36,20 +37,14 @@ public class AltinnSchema [JsonPropertyName("longitude")] public decimal? longitude { get; set; } - public bool ShouldSerializelongitude() - { - return longitude.HasValue; - } + public bool ShouldSerializelongitude() => longitude.HasValue; [XmlElement("latitude", Order = 6)] [JsonProperty("latitude")] [JsonPropertyName("latitude")] public decimal? latitude { get; set; } - public bool ShouldSerializelatitude() - { - return latitude.HasValue; - } + public bool ShouldSerializelatitude() => latitude.HasValue; [Range(Double.MinValue,Double.MaxValue)] [XmlElement("depth", Order = 7)] @@ -57,10 +52,7 @@ public bool ShouldSerializelatitude() [JsonPropertyName("depth")] public decimal? depth { get; set; } - public bool ShouldSerializedepth() - { - return depth.HasValue; - } + public bool ShouldSerializedepth() => depth.HasValue; [RegularExpression(@"^[0-9]{4}-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])$")] [XmlElement("sampledate", Order = 8)] @@ -74,10 +66,7 @@ public bool ShouldSerializedepth() [JsonPropertyName("hour")] public decimal? hour { get; set; } - public bool ShouldSerializehour() - { - return hour.HasValue; - } + public bool ShouldSerializehour() => hour.HasValue; [Range(Double.MinValue,Double.MaxValue)] [XmlElement("minute", Order = 10)] @@ -85,10 +74,7 @@ public bool ShouldSerializehour() [JsonPropertyName("minute")] public decimal? minute { get; set; } - public bool ShouldSerializeminute() - { - return minute.HasValue; - } + public bool ShouldSerializeminute() => minute.HasValue; [XmlElement("productionarea", Order = 11)] [JsonProperty("productionarea")] @@ -115,30 +101,21 @@ public bool ShouldSerializeminute() [JsonPropertyName("harmfulalgae")] public bool? harmfulalgae { get; set; } - public bool ShouldSerializeharmfulalgae() - { - return harmfulalgae.HasValue; - } + public bool ShouldSerializeharmfulalgae() => harmfulalgae.HasValue; [XmlElement("reportedmortality", Order = 16)] [JsonProperty("reportedmortality")] [JsonPropertyName("reportedmortality")] public bool? reportedmortality { get; set; } - public bool ShouldSerializereportedmortality() - { - return reportedmortality.HasValue; - } + public bool ShouldSerializereportedmortality() => reportedmortality.HasValue; [XmlElement("behaviourchanges", Order = 17)] [JsonProperty("behaviourchanges")] [JsonPropertyName("behaviourchanges")] public bool? behaviourchanges { get; set; } - public bool ShouldSerializebehaviourchanges() - { - return behaviourchanges.HasValue; - } + public bool ShouldSerializebehaviourchanges() => behaviourchanges.HasValue; [Range(Double.MinValue,Double.MaxValue)] [XmlElement("diatomcount", Order = 18)] @@ -146,10 +123,7 @@ public bool ShouldSerializebehaviourchanges() [JsonPropertyName("diatomcount")] public decimal? diatomcount { get; set; } - public bool ShouldSerializediatomcount() - { - return diatomcount.HasValue; - } + public bool ShouldSerializediatomcount() => diatomcount.HasValue; [Range(Double.MinValue,Double.MaxValue)] [XmlElement("dinoflagellatecount", Order = 19)] @@ -157,10 +131,7 @@ public bool ShouldSerializediatomcount() [JsonPropertyName("dinoflagellatecount")] public decimal? dinoflagellatecount { get; set; } - public bool ShouldSerializedinoflagellatecount() - { - return dinoflagellatecount.HasValue; - } + public bool ShouldSerializedinoflagellatecount() => dinoflagellatecount.HasValue; [Range(Double.MinValue,Double.MaxValue)] [XmlElement("flagellatecount", Order = 20)] @@ -168,10 +139,7 @@ public bool ShouldSerializedinoflagellatecount() [JsonPropertyName("flagellatecount")] public decimal? flagellatecount { get; set; } - public bool ShouldSerializeflagellatecount() - { - return flagellatecount.HasValue; - } + public bool ShouldSerializeflagellatecount() => flagellatecount.HasValue; [XmlElement("comments", Order = 21)] [JsonProperty("comments")] @@ -192,6 +160,14 @@ public bool ShouldSerializeflagellatecount() public class AltinnAlgae { + [XmlAttribute("altinnRowId")] + [JsonPropertyName("altinnRowId")] + [System.Text.Json.Serialization.JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)] + [Newtonsoft.Json.JsonIgnore] + public Guid AltinnRowId { get; set; } + + public bool ShouldSerializeAltinnRowId() => AltinnRowId != default; + [XmlElement("scientificname", Order = 1)] [JsonProperty("scientificname")] [JsonPropertyName("scientificname")] @@ -203,25 +179,20 @@ public class AltinnAlgae [JsonPropertyName("density")] public decimal? density { get; set; } - public bool ShouldSerializedensity() - { - return density.HasValue; - } + public bool ShouldSerializedensity() => density.HasValue; + } + + public class AltinnOwner + { [XmlAttribute("altinnRowId")] [JsonPropertyName("altinnRowId")] [System.Text.Json.Serialization.JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)] [Newtonsoft.Json.JsonIgnore] public Guid AltinnRowId { get; set; } - public bool ShouldSerializeAltinnRowId() - { - return AltinnRowId != default; - } - } + public bool ShouldSerializeAltinnRowId() => AltinnRowId != default; - public class AltinnOwner - { [XmlElement("organisationid", Order = 1)] [JsonProperty("organisationid")] [JsonPropertyName("organisationid")] @@ -232,15 +203,5 @@ public class AltinnOwner [JsonPropertyName("organisationname")] public string organisationname { get; set; } - [XmlAttribute("altinnRowId")] - [JsonPropertyName("altinnRowId")] - [System.Text.Json.Serialization.JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)] - [Newtonsoft.Json.JsonIgnore] - public Guid AltinnRowId { get; set; } - - public bool ShouldSerializeAltinnRowId() - { - return AltinnRowId != default; - } } } diff --git a/testdata/Model/CSharp/Gitea/krt-1188a-1.cs b/testdata/Model/CSharp/Gitea/krt-1188a-1.cs index 0a817f3e7b0..29c1f0bb226 100644 --- a/testdata/Model/CSharp/Gitea/krt-1188a-1.cs +++ b/testdata/Model/CSharp/Gitea/krt-1188a-1.cs @@ -1,9 +1,9 @@ +#nullable disable using System; using System.Collections.Generic; using System.ComponentModel.DataAnnotations; using System.Linq; using System.Text.Json.Serialization; -using System.Threading.Tasks; using System.Xml.Serialization; using Microsoft.AspNetCore.Mvc.ModelBinding; using Newtonsoft.Json; @@ -14,15 +14,15 @@ public class KRT1226Gjenopprettingsplaner_M { [XmlAttribute("dataFormatProvider")] [BindNever] - public string dataFormatProvider {get; set; } = "SERES"; + public string dataFormatProvider { get; set; } = "SERES"; [XmlAttribute("dataFormatId")] [BindNever] - public string dataFormatId {get; set; } = "6946"; + public string dataFormatId { get; set; } = "6946"; [XmlAttribute("dataFormatVersion")] [BindNever] - public string dataFormatVersion {get; set; } = "46317"; + public string dataFormatVersion { get; set; } = "46317"; [XmlElement("rapport", Order = 1)] [JsonProperty("rapport")] @@ -62,6 +62,8 @@ public class Innsender [JsonPropertyName("maalform")] public Maalform maalform { get; set; } + public bool ShouldSerializemaalform() => maalform?.valueNullable is not null; + } public class Adresse @@ -71,16 +73,22 @@ public class Adresse [JsonPropertyName("postnummer")] public Postnummer postnummer { get; set; } + public bool ShouldSerializepostnummer() => postnummer?.value is not null; + [XmlElement("adresselinje1", Order = 2)] [JsonProperty("adresselinje1")] [JsonPropertyName("adresselinje1")] public Adresselinje1 adresselinje1 { get; set; } + public bool ShouldSerializeadresselinje1() => adresselinje1?.value is not null; + [XmlElement("poststed", Order = 3)] [JsonProperty("poststed")] [JsonPropertyName("poststed")] public Poststed poststed { get; set; } + public bool ShouldSerializepoststed() => poststed?.value is not null; + } public class Postnummer @@ -91,7 +99,7 @@ public class Postnummer [XmlAttribute("guid")] [BindNever] - public string guid {get; set; } = "http://seres.no/guid/Finanstilsynet/Dataenkeltype/Postnummer/660288"; + public string guid { get; set; } = "http://seres.no/guid/Finanstilsynet/Dataenkeltype/Postnummer/660288"; } @@ -103,7 +111,7 @@ public class Adresselinje1 [XmlAttribute("guid")] [BindNever] - public string guid {get; set; } = "http://seres.no/guid/Finanstilsynet/Dataenkeltype/Adresselinje1/660286"; + public string guid { get; set; } = "http://seres.no/guid/Finanstilsynet/Dataenkeltype/Adresselinje1/660286"; } @@ -115,7 +123,7 @@ public class Poststed [XmlAttribute("guid")] [BindNever] - public string guid {get; set; } = "http://seres.no/guid/Finanstilsynet/Dataenkeltype/Poststed/660287"; + public string guid { get; set; } = "http://seres.no/guid/Finanstilsynet/Dataenkeltype/Poststed/660287"; } @@ -126,11 +134,15 @@ public class Foretak [JsonPropertyName("organisasjonsnummer")] public Organisasjonsnummer organisasjonsnummer { get; set; } + public bool ShouldSerializeorganisasjonsnummer() => organisasjonsnummer?.value is not null; + [XmlElement("navn", Order = 2)] [JsonProperty("navn")] [JsonPropertyName("navn")] public Foretaksnavn navn { get; set; } + public bool ShouldSerializenavn() => navn?.value is not null; + } public class Organisasjonsnummer @@ -142,7 +154,7 @@ public class Organisasjonsnummer [XmlAttribute("guid")] [BindNever] - public string guid {get; set; } = "http://seres.no/guid/Finanstilsynet/Dataenkeltype/Organisasjonsnummer/472763"; + public string guid { get; set; } = "http://seres.no/guid/Finanstilsynet/Dataenkeltype/Organisasjonsnummer/472763"; } @@ -154,20 +166,34 @@ public class Foretaksnavn [XmlAttribute("guid")] [BindNever] - public string guid {get; set; } = "http://seres.no/guid/Finanstilsynet/Dataenkeltype/Foretaksnavn/639250"; + public string guid { get; set; } = "http://seres.no/guid/Finanstilsynet/Dataenkeltype/Foretaksnavn/639250"; } public class Maalform { [Range(Double.MinValue,Double.MaxValue)] - [XmlText()] [Required] - public decimal value { get; set; } + [XmlIgnore] + [JsonPropertyName("value")] + [JsonProperty(PropertyName = "value")] + public decimal? valueNullable { get; set; } + + [XmlText] + [System.Text.Json.Serialization.JsonIgnore] + [Newtonsoft.Json.JsonIgnore] + public decimal value + { + get => valueNullable ?? default; + set + { + this.valueNullable = value; + } + } [XmlAttribute("guid")] [BindNever] - public string guid {get; set; } = "http://seres.no/guid/Finanstilsynet/Dataenkeltype/Målform/660674"; + public string guid { get; set; } = "http://seres.no/guid/Finanstilsynet/Dataenkeltype/Målform/660674"; } @@ -203,26 +229,36 @@ public class Rapportering [JsonPropertyName("sporvalgrappreg")] public Tekst_60_S1 sporvalgrappreg { get; set; } + public bool ShouldSerializesporvalgrappreg() => sporvalgrappreg?.value is not null; + [XmlElement("hjelpefelt", Order = 7)] [JsonProperty("hjelpefelt")] [JsonPropertyName("hjelpefelt")] public Tekst_120_S01 hjelpefelt { get; set; } + public bool ShouldSerializehjelpefelt() => hjelpefelt?.value is not null; + [XmlElement("avdeling", Order = 8)] [JsonProperty("avdeling")] [JsonPropertyName("avdeling")] public Avdeling avdeling { get; set; } + public bool ShouldSerializeavdeling() => avdeling?.value is not null; + [XmlElement("beskrivelse", Order = 9)] [JsonProperty("beskrivelse")] [JsonPropertyName("beskrivelse")] public Tekst_255_S10 beskrivelse { get; set; } + public bool ShouldSerializebeskrivelse() => beskrivelse?.value is not null; + [XmlElement("periodeaarstall", Order = 10)] [JsonProperty("periodeaarstall")] [JsonPropertyName("periodeaarstall")] public AAr_S01 periodeaarstall { get; set; } + public bool ShouldSerializeperiodeaarstall() => periodeaarstall?.value is not null; + } public class Arkiv @@ -232,6 +268,8 @@ public class Arkiv [JsonPropertyName("arkivkode")] public Arkivkode arkivkode { get; set; } + public bool ShouldSerializearkivkode() => arkivkode?.value is not null; + } public class Arkivkode @@ -241,7 +279,7 @@ public class Arkivkode [XmlAttribute("guid")] [BindNever] - public string guid {get; set; } = "http://seres.no/guid/Finanstilsynet/Dataenkeltype/Arkivkode/660676"; + public string guid { get; set; } = "http://seres.no/guid/Finanstilsynet/Dataenkeltype/Arkivkode/660676"; } @@ -252,21 +290,29 @@ public class Kontaktperson1 [JsonPropertyName("epost")] public Epost_S01 epost { get; set; } + public bool ShouldSerializeepost() => epost?.value is not null; + [XmlElement("navn", Order = 2)] [JsonProperty("navn")] [JsonPropertyName("navn")] public Navn_S01 navn { get; set; } + public bool ShouldSerializenavn() => navn?.value is not null; + [XmlElement("telefonnummer", Order = 3)] [JsonProperty("telefonnummer")] [JsonPropertyName("telefonnummer")] public TelefonNummer_S01 telefonnummer { get; set; } + public bool ShouldSerializetelefonnummer() => telefonnummer?.value is not null; + [XmlElement("telefonprefiks", Order = 4)] [JsonProperty("telefonprefiks")] [JsonPropertyName("telefonprefiks")] public TelefonPrefiks_S01 telefonprefiks { get; set; } + public bool ShouldSerializetelefonprefiks() => telefonprefiks?.value is not null; + } public class Epost_S01 @@ -276,7 +322,7 @@ public class Epost_S01 [XmlAttribute("guid")] [BindNever] - public string guid {get; set; } = "http://seres.no/guid/Finanstilsynet/Dataenkeltype/Epost_S01/637664"; + public string guid { get; set; } = "http://seres.no/guid/Finanstilsynet/Dataenkeltype/Epost_S01/637664"; } @@ -288,7 +334,7 @@ public class Navn_S01 [XmlAttribute("guid")] [BindNever] - public string guid {get; set; } = "http://seres.no/guid/Finanstilsynet/Dataenkeltype/Navn_S01/637662"; + public string guid { get; set; } = "http://seres.no/guid/Finanstilsynet/Dataenkeltype/Navn_S01/637662"; } @@ -300,7 +346,7 @@ public class TelefonNummer_S01 [XmlAttribute("guid")] [BindNever] - public string guid {get; set; } = "http://seres.no/guid/Finanstilsynet/Dataenkeltype/TelefonNummer_S01/637660"; + public string guid { get; set; } = "http://seres.no/guid/Finanstilsynet/Dataenkeltype/TelefonNummer_S01/637660"; } @@ -312,7 +358,7 @@ public class TelefonPrefiks_S01 [XmlAttribute("guid")] [BindNever] - public string guid {get; set; } = "http://seres.no/guid/Finanstilsynet/Dataenkeltype/TelefonPrefiks_S01/637658"; + public string guid { get; set; } = "http://seres.no/guid/Finanstilsynet/Dataenkeltype/TelefonPrefiks_S01/637658"; } @@ -323,21 +369,29 @@ public class Kontaktperson2 [JsonPropertyName("epost")] public Epost_S02 epost { get; set; } + public bool ShouldSerializeepost() => epost?.value is not null; + [XmlElement("navn", Order = 2)] [JsonProperty("navn")] [JsonPropertyName("navn")] public Navn_S02 navn { get; set; } + public bool ShouldSerializenavn() => navn?.value is not null; + [XmlElement("telefonnummer", Order = 3)] [JsonProperty("telefonnummer")] [JsonPropertyName("telefonnummer")] public TelefonNummer_S02 telefonnummer { get; set; } + public bool ShouldSerializetelefonnummer() => telefonnummer?.value is not null; + [XmlElement("telefonprefiks", Order = 4)] [JsonProperty("telefonprefiks")] [JsonPropertyName("telefonprefiks")] public TelefonPrefiks_S02 telefonprefiks { get; set; } + public bool ShouldSerializetelefonprefiks() => telefonprefiks?.value is not null; + } public class Epost_S02 @@ -347,7 +401,7 @@ public class Epost_S02 [XmlAttribute("guid")] [BindNever] - public string guid {get; set; } = "http://seres.no/guid/Finanstilsynet/Dataenkeltype/Epost_S02/637663"; + public string guid { get; set; } = "http://seres.no/guid/Finanstilsynet/Dataenkeltype/Epost_S02/637663"; } @@ -359,7 +413,7 @@ public class Navn_S02 [XmlAttribute("guid")] [BindNever] - public string guid {get; set; } = "http://seres.no/guid/Finanstilsynet/Dataenkeltype/Navn_S02/637661"; + public string guid { get; set; } = "http://seres.no/guid/Finanstilsynet/Dataenkeltype/Navn_S02/637661"; } @@ -371,7 +425,7 @@ public class TelefonNummer_S02 [XmlAttribute("guid")] [BindNever] - public string guid {get; set; } = "http://seres.no/guid/Finanstilsynet/Dataenkeltype/TelefonNummer_S02/637659"; + public string guid { get; set; } = "http://seres.no/guid/Finanstilsynet/Dataenkeltype/TelefonNummer_S02/637659"; } @@ -383,7 +437,7 @@ public class TelefonPrefiks_S02 [XmlAttribute("guid")] [BindNever] - public string guid {get; set; } = "http://seres.no/guid/Finanstilsynet/Dataenkeltype/TelefonPrefiks_S02/637657"; + public string guid { get; set; } = "http://seres.no/guid/Finanstilsynet/Dataenkeltype/TelefonPrefiks_S02/637657"; } @@ -394,11 +448,15 @@ public class Periode [JsonPropertyName("aar")] public AAr aar { get; set; } + public bool ShouldSerializeaar() => aar?.value is not null; + [XmlElement("periodetype", Order = 2)] [JsonProperty("periodetype")] [JsonPropertyName("periodetype")] public Periodetype periodetype { get; set; } + public bool ShouldSerializeperiodetype() => periodetype?.value is not null; + } public class AAr @@ -409,7 +467,7 @@ public class AAr [XmlAttribute("guid")] [BindNever] - public string guid {get; set; } = "http://seres.no/guid/Finanstilsynet/Dataenkeltype/År/660276"; + public string guid { get; set; } = "http://seres.no/guid/Finanstilsynet/Dataenkeltype/År/660276"; } @@ -420,7 +478,7 @@ public class Periodetype [XmlAttribute("guid")] [BindNever] - public string guid {get; set; } = "http://seres.no/guid/Finanstilsynet/Dataenkeltype/Periodetype/660275"; + public string guid { get; set; } = "http://seres.no/guid/Finanstilsynet/Dataenkeltype/Periodetype/660275"; } @@ -431,6 +489,8 @@ public class Rapporteringsregisteret [JsonPropertyName("rapporteringsid")] public Rapporteringsid rapporteringsid { get; set; } + public bool ShouldSerializerapporteringsid() => rapporteringsid?.value is not null; + } public class Rapporteringsid @@ -441,7 +501,7 @@ public class Rapporteringsid [XmlAttribute("guid")] [BindNever] - public string guid {get; set; } = "http://seres.no/guid/Finanstilsynet/Dataenkeltype/RapporteringsId/636854"; + public string guid { get; set; } = "http://seres.no/guid/Finanstilsynet/Dataenkeltype/RapporteringsId/636854"; } @@ -454,7 +514,7 @@ public class Tekst_60_S1 [XmlAttribute("guid")] [BindNever] - public string guid {get; set; } = "http://seres.no/guid/Finanstilsynet/Dataenkeltype/Tekst_60_S1/488638"; + public string guid { get; set; } = "http://seres.no/guid/Finanstilsynet/Dataenkeltype/Tekst_60_S1/488638"; } @@ -466,7 +526,7 @@ public class Tekst_120_S01 [XmlAttribute("guid")] [BindNever] - public string guid {get; set; } = "http://seres.no/guid/Finanstilsynet/Dataenkeltype/Tekst_120_S01/619866"; + public string guid { get; set; } = "http://seres.no/guid/Finanstilsynet/Dataenkeltype/Tekst_120_S01/619866"; } @@ -477,7 +537,7 @@ public class Avdeling [XmlAttribute("guid")] [BindNever] - public string guid {get; set; } = "http://seres.no/guid/Finanstilsynet/Dataenkeltype/Avdeling/664243"; + public string guid { get; set; } = "http://seres.no/guid/Finanstilsynet/Dataenkeltype/Avdeling/664243"; } @@ -490,7 +550,7 @@ public class Tekst_255_S10 [XmlAttribute("guid")] [BindNever] - public string guid {get; set; } = "http://seres.no/guid/Finanstilsynet/Dataenkeltype/Tekst_255_S10/600714"; + public string guid { get; set; } = "http://seres.no/guid/Finanstilsynet/Dataenkeltype/Tekst_255_S10/600714"; } @@ -502,7 +562,7 @@ public class AAr_S01 [XmlAttribute("guid")] [BindNever] - public string guid {get; set; } = "http://seres.no/guid/Finanstilsynet/Dataenkeltype/År_S01/602291"; + public string guid { get; set; } = "http://seres.no/guid/Finanstilsynet/Dataenkeltype/År_S01/602291"; } } diff --git a/testdata/Model/CSharp/Gitea/nbib-melding.cs b/testdata/Model/CSharp/Gitea/nbib-melding.cs index 8b22b4a154f..34c0a137470 100644 --- a/testdata/Model/CSharp/Gitea/nbib-melding.cs +++ b/testdata/Model/CSharp/Gitea/nbib-melding.cs @@ -1,9 +1,9 @@ +#nullable disable using System; using System.Collections.Generic; using System.ComponentModel.DataAnnotations; using System.Linq; using System.Text.Json.Serialization; -using System.Threading.Tasks; using System.Xml.Serialization; using Microsoft.AspNetCore.Mvc.ModelBinding; using Newtonsoft.Json; diff --git a/testdata/Model/CSharp/Gitea/nsm-klareringsportalen.cs b/testdata/Model/CSharp/Gitea/nsm-klareringsportalen.cs index c8906257876..5bef3539cd5 100644 --- a/testdata/Model/CSharp/Gitea/nsm-klareringsportalen.cs +++ b/testdata/Model/CSharp/Gitea/nsm-klareringsportalen.cs @@ -1,3 +1,4 @@ +#nullable disable using System; using System.Collections.Generic; using System.ComponentModel.DataAnnotations; @@ -95,6 +96,14 @@ public class ePOB_M public class Arbeidserfaringer { + [XmlAttribute("altinnRowId")] + [JsonPropertyName("altinnRowId")] + [System.Text.Json.Serialization.JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)] + [Newtonsoft.Json.JsonIgnore] + public Guid AltinnRowId { get; set; } + + public bool ShouldSerializeAltinnRowId() => AltinnRowId != default; + [XmlElement("fraaar", Order = 1)] [JsonProperty("fraaar")] [JsonPropertyName("fraaar")] @@ -165,16 +174,6 @@ public class Arbeidserfaringer [JsonPropertyName("tilmaaned")] public string tilmaaned { get; set; } - [XmlAttribute("altinnRowId")] - [JsonPropertyName("altinnRowId")] - [System.Text.Json.Serialization.JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)] - [Newtonsoft.Json.JsonIgnore] - public Guid AltinnRowId { get; set; } - - public bool ShouldSerializeAltinnRowId() - { - return AltinnRowId != default; - } } public class Personalia @@ -214,10 +213,7 @@ public class Personalia [JsonPropertyName("ishatttidligerenavn")] public bool? ishatttidligerenavn { get; set; } - public bool ShouldSerializeishatttidligerenavn() - { - return ishatttidligerenavn.HasValue; - } + public bool ShouldSerializeishatttidligerenavn() => ishatttidligerenavn.HasValue; [XmlElement("hatttidligerenavn", Order = 8)] [JsonProperty("hatttidligerenavn")] @@ -283,6 +279,14 @@ public bool ShouldSerializeishatttidligerenavn() public class Adresse { + [XmlAttribute("altinnRowId")] + [JsonPropertyName("altinnRowId")] + [System.Text.Json.Serialization.JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)] + [Newtonsoft.Json.JsonIgnore] + public Guid AltinnRowId { get; set; } + + public bool ShouldSerializeAltinnRowId() => AltinnRowId != default; + [XmlElement("adressebeskrivelse", Order = 1)] [JsonProperty("adressebeskrivelse")] [JsonPropertyName("adressebeskrivelse")] @@ -303,20 +307,18 @@ public class Adresse [JsonPropertyName("land")] public string land { get; set; } + } + + public class Iddokumenter + { [XmlAttribute("altinnRowId")] [JsonPropertyName("altinnRowId")] [System.Text.Json.Serialization.JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)] [Newtonsoft.Json.JsonIgnore] public Guid AltinnRowId { get; set; } - public bool ShouldSerializeAltinnRowId() - { - return AltinnRowId != default; - } - } + public bool ShouldSerializeAltinnRowId() => AltinnRowId != default; - public class Iddokumenter - { [XmlElement("typedokument", Order = 1)] [JsonProperty("typedokument")] [JsonPropertyName("typedokument")] @@ -332,20 +334,18 @@ public class Iddokumenter [JsonPropertyName("land")] public string land { get; set; } + } + + public class Person + { [XmlAttribute("altinnRowId")] [JsonPropertyName("altinnRowId")] [System.Text.Json.Serialization.JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)] [Newtonsoft.Json.JsonIgnore] public Guid AltinnRowId { get; set; } - public bool ShouldSerializeAltinnRowId() - { - return AltinnRowId != default; - } - } + public bool ShouldSerializeAltinnRowId() => AltinnRowId != default; - public class Person - { [XmlElement("foedselsnummer", Order = 1)] [JsonProperty("foedselsnummer")] [JsonPropertyName("foedselsnummer")] @@ -381,16 +381,6 @@ public class Person [JsonPropertyName("utenlandsadresse")] public List utenlandsadresse { get; set; } - [XmlAttribute("altinnRowId")] - [JsonPropertyName("altinnRowId")] - [System.Text.Json.Serialization.JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)] - [Newtonsoft.Json.JsonIgnore] - public Guid AltinnRowId { get; set; } - - public bool ShouldSerializeAltinnRowId() - { - return AltinnRowId != default; - } } public class Personnavn @@ -419,6 +409,14 @@ public class Personnavn public class Statsborgerskap { + [XmlAttribute("altinnRowId")] + [JsonPropertyName("altinnRowId")] + [System.Text.Json.Serialization.JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)] + [Newtonsoft.Json.JsonIgnore] + public Guid AltinnRowId { get; set; } + + public bool ShouldSerializeAltinnRowId() => AltinnRowId != default; + [XmlElement("fraDato", Order = 1)] [JsonProperty("fraDato")] [JsonPropertyName("fraDato")] @@ -454,16 +452,6 @@ public class Statsborgerskap [JsonPropertyName("land")] public string land { get; set; } - [XmlAttribute("altinnRowId")] - [JsonPropertyName("altinnRowId")] - [System.Text.Json.Serialization.JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)] - [Newtonsoft.Json.JsonIgnore] - public Guid AltinnRowId { get; set; } - - public bool ShouldSerializeAltinnRowId() - { - return AltinnRowId != default; - } } public class Relasjoner @@ -572,6 +560,14 @@ public class Relasjoner public class Naerstaaende { + [XmlAttribute("altinnRowId")] + [JsonPropertyName("altinnRowId")] + [System.Text.Json.Serialization.JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)] + [Newtonsoft.Json.JsonIgnore] + public Guid AltinnRowId { get; set; } + + public bool ShouldSerializeAltinnRowId() => AltinnRowId != default; + [XmlElement("personinfo", Order = 1)] [JsonProperty("personinfo")] [JsonPropertyName("personinfo")] @@ -617,16 +613,6 @@ public class Naerstaaende [JsonPropertyName("relasjonmedperson")] public string relasjonmedperson { get; set; } - [XmlAttribute("altinnRowId")] - [JsonPropertyName("altinnRowId")] - [System.Text.Json.Serialization.JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)] - [Newtonsoft.Json.JsonIgnore] - public Guid AltinnRowId { get; set; } - - public bool ShouldSerializeAltinnRowId() - { - return AltinnRowId != default; - } } public class Samboerektefelle @@ -690,6 +676,14 @@ public class Samboerektefelle public class Bostedhistorikkutland { + [XmlAttribute("altinnRowId")] + [JsonPropertyName("altinnRowId")] + [System.Text.Json.Serialization.JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)] + [Newtonsoft.Json.JsonIgnore] + public Guid AltinnRowId { get; set; } + + public bool ShouldSerializeAltinnRowId() => AltinnRowId != default; + [XmlElement("land", Order = 1)] [JsonProperty("land")] [JsonPropertyName("land")] @@ -740,20 +734,18 @@ public class Bostedhistorikkutland [JsonPropertyName("spesifikasjon")] public string spesifikasjon { get; set; } + } + + public class Bostedhistorikkeu + { [XmlAttribute("altinnRowId")] [JsonPropertyName("altinnRowId")] [System.Text.Json.Serialization.JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)] [Newtonsoft.Json.JsonIgnore] public Guid AltinnRowId { get; set; } - public bool ShouldSerializeAltinnRowId() - { - return AltinnRowId != default; - } - } + public bool ShouldSerializeAltinnRowId() => AltinnRowId != default; - public class Bostedhistorikkeu - { [XmlElement("land", Order = 1)] [JsonProperty("land")] [JsonPropertyName("land")] @@ -774,16 +766,6 @@ public class Bostedhistorikkeu [JsonPropertyName("antallganger")] public string antallganger { get; set; } - [XmlAttribute("altinnRowId")] - [JsonPropertyName("altinnRowId")] - [System.Text.Json.Serialization.JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)] - [Newtonsoft.Json.JsonIgnore] - public Guid AltinnRowId { get; set; } - - public bool ShouldSerializeAltinnRowId() - { - return AltinnRowId != default; - } } public class OEkonomi @@ -862,6 +844,14 @@ public class OEkonomi public class Investering { + [XmlAttribute("altinnRowId")] + [JsonPropertyName("altinnRowId")] + [System.Text.Json.Serialization.JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)] + [Newtonsoft.Json.JsonIgnore] + public Guid AltinnRowId { get; set; } + + public bool ShouldSerializeAltinnRowId() => AltinnRowId != default; + [XmlElement("type", Order = 1)] [JsonProperty("type")] [JsonPropertyName("type")] @@ -877,20 +867,18 @@ public class Investering [JsonPropertyName("land")] public string land { get; set; } + } + + public class Transaksjonutland + { [XmlAttribute("altinnRowId")] [JsonPropertyName("altinnRowId")] [System.Text.Json.Serialization.JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)] [Newtonsoft.Json.JsonIgnore] public Guid AltinnRowId { get; set; } - public bool ShouldSerializeAltinnRowId() - { - return AltinnRowId != default; - } - } + public bool ShouldSerializeAltinnRowId() => AltinnRowId != default; - public class Transaksjonutland - { [XmlElement("antallganger", Order = 1)] [JsonProperty("antallganger")] [JsonPropertyName("antallganger")] @@ -911,16 +899,6 @@ public class Transaksjonutland [JsonPropertyName("belop")] public string belop { get; set; } - [XmlAttribute("altinnRowId")] - [JsonPropertyName("altinnRowId")] - [System.Text.Json.Serialization.JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)] - [Newtonsoft.Json.JsonIgnore] - public Guid AltinnRowId { get; set; } - - public bool ShouldSerializeAltinnRowId() - { - return AltinnRowId != default; - } } public class Strafferettslig @@ -959,6 +937,14 @@ public class Strafferettslig public class Straffforhold { + [XmlAttribute("altinnRowId")] + [JsonPropertyName("altinnRowId")] + [System.Text.Json.Serialization.JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)] + [Newtonsoft.Json.JsonIgnore] + public Guid AltinnRowId { get; set; } + + public bool ShouldSerializeAltinnRowId() => AltinnRowId != default; + [XmlElement("aar", Order = 1)] [JsonProperty("aar")] [JsonPropertyName("aar")] @@ -979,16 +965,6 @@ public class Straffforhold [JsonPropertyName("type")] public string type { get; set; } - [XmlAttribute("altinnRowId")] - [JsonPropertyName("altinnRowId")] - [System.Text.Json.Serialization.JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)] - [Newtonsoft.Json.JsonIgnore] - public Guid AltinnRowId { get; set; } - - public bool ShouldSerializeAltinnRowId() - { - return AltinnRowId != default; - } } public class Rusmidler @@ -1145,6 +1121,14 @@ public class Statstilknytning public class Tilknytningtilfelle { + [XmlAttribute("altinnRowId")] + [JsonPropertyName("altinnRowId")] + [System.Text.Json.Serialization.JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)] + [Newtonsoft.Json.JsonIgnore] + public Guid AltinnRowId { get; set; } + + public bool ShouldSerializeAltinnRowId() => AltinnRowId != default; + [XmlElement("beskrivelse", Order = 1)] [JsonProperty("beskrivelse")] [JsonPropertyName("beskrivelse")] @@ -1165,20 +1149,18 @@ public class Tilknytningtilfelle [JsonPropertyName("til")] public string til { get; set; } + } + + public class Utdanningssted + { [XmlAttribute("altinnRowId")] [JsonPropertyName("altinnRowId")] [System.Text.Json.Serialization.JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)] [Newtonsoft.Json.JsonIgnore] public Guid AltinnRowId { get; set; } - public bool ShouldSerializeAltinnRowId() - { - return AltinnRowId != default; - } - } + public bool ShouldSerializeAltinnRowId() => AltinnRowId != default; - public class Utdanningssted - { [XmlElement("utdanningsted", Order = 1)] [JsonProperty("utdanningsted")] [JsonPropertyName("utdanningsted")] @@ -1199,16 +1181,6 @@ public class Utdanningssted [JsonPropertyName("til")] public string til { get; set; } - [XmlAttribute("altinnRowId")] - [JsonPropertyName("altinnRowId")] - [System.Text.Json.Serialization.JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)] - [Newtonsoft.Json.JsonIgnore] - public Guid AltinnRowId { get; set; } - - public bool ShouldSerializeAltinnRowId() - { - return AltinnRowId != default; - } } public class Helse diff --git a/testdata/Model/CSharp/Gitea/skd-formueinntekt-skattemelding-v2.cs b/testdata/Model/CSharp/Gitea/skd-formueinntekt-skattemelding-v2.cs index 6c37832940a..db2faf05ec8 100644 --- a/testdata/Model/CSharp/Gitea/skd-formueinntekt-skattemelding-v2.cs +++ b/testdata/Model/CSharp/Gitea/skd-formueinntekt-skattemelding-v2.cs @@ -1,9 +1,9 @@ +#nullable disable using System; using System.Collections.Generic; using System.ComponentModel.DataAnnotations; using System.Linq; using System.Text.Json.Serialization; -using System.Threading.Tasks; using System.Xml.Serialization; using Microsoft.AspNetCore.Mvc.ModelBinding; using Newtonsoft.Json; diff --git a/testdata/Model/CSharp/Gitea/skjema.cs b/testdata/Model/CSharp/Gitea/skjema.cs index 126cb8fec69..9b704c85b7f 100644 --- a/testdata/Model/CSharp/Gitea/skjema.cs +++ b/testdata/Model/CSharp/Gitea/skjema.cs @@ -1,3 +1,4 @@ +#nullable disable using System; using System.Collections.Generic; using System.ComponentModel.DataAnnotations; @@ -196,6 +197,14 @@ public class ArrayOfUnderenhet public class Underenhet { + [XmlAttribute("altinnRowId")] + [JsonPropertyName("altinnRowId")] + [System.Text.Json.Serialization.JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)] + [Newtonsoft.Json.JsonIgnore] + public Guid AltinnRowId { get; set; } + + public bool ShouldSerializeAltinnRowId() => AltinnRowId != default; + [MinLength(0)] [MaxLength(50)] [XmlElement("Organisasjonsnummer", Order = 1)] @@ -215,16 +224,6 @@ public class Underenhet [JsonPropertyName("Adresse")] public Adresse Adresse { get; set; } - [XmlAttribute("altinnRowId")] - [JsonPropertyName("altinnRowId")] - [System.Text.Json.Serialization.JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)] - [Newtonsoft.Json.JsonIgnore] - public Guid AltinnRowId { get; set; } - - public bool ShouldSerializeAltinnRowId() - { - return AltinnRowId != default; - } } public class NorskRepresentant @@ -266,10 +265,7 @@ public class InnholdSkjema [JsonPropertyName("AntallEnerom")] public decimal? AntallEnerom { get; set; } - public bool ShouldSerializeAntallEnerom() - { - return AntallEnerom.HasValue; - } + public bool ShouldSerializeAntallEnerom() => AntallEnerom.HasValue; [XmlElement("AlleRomHarBadOgToalett", Order = 5)] [JsonProperty("AlleRomHarBadOgToalett")] @@ -287,10 +283,7 @@ public bool ShouldSerializeAntallEnerom() [JsonPropertyName("AntallRomMedKjokken")] public decimal? AntallRomMedKjokken { get; set; } - public bool ShouldSerializeAntallRomMedKjokken() - { - return AntallRomMedKjokken.HasValue; - } + public bool ShouldSerializeAntallRomMedKjokken() => AntallRomMedKjokken.HasValue; [XmlElement("TilbysMatservering", Order = 8)] [JsonProperty("TilbysMatservering")] @@ -348,10 +341,7 @@ public bool ShouldSerializeAntallRomMedKjokken() [JsonPropertyName("BekreftetRiktig")] public bool? BekreftetRiktig { get; set; } - public bool ShouldSerializeBekreftetRiktig() - { - return BekreftetRiktig.HasValue; - } + public bool ShouldSerializeBekreftetRiktig() => BekreftetRiktig.HasValue; [MinLength(0)] [MaxLength(255)] diff --git a/testdata/Model/CSharp/Gitea/srf-fufinn-behovsendring.cs b/testdata/Model/CSharp/Gitea/srf-fufinn-behovsendring.cs index e42d1e2f2da..3b7df713495 100644 --- a/testdata/Model/CSharp/Gitea/srf-fufinn-behovsendring.cs +++ b/testdata/Model/CSharp/Gitea/srf-fufinn-behovsendring.cs @@ -1,9 +1,9 @@ +#nullable disable using System; using System.Collections.Generic; using System.ComponentModel.DataAnnotations; using System.Linq; using System.Text.Json.Serialization; -using System.Threading.Tasks; using System.Xml.Serialization; using Microsoft.AspNetCore.Mvc.ModelBinding; using Newtonsoft.Json; diff --git a/testdata/Model/CSharp/Gitea/srf-fufinn-behovskartleggin.cs b/testdata/Model/CSharp/Gitea/srf-fufinn-behovskartleggin.cs index e42d1e2f2da..3b7df713495 100644 --- a/testdata/Model/CSharp/Gitea/srf-fufinn-behovskartleggin.cs +++ b/testdata/Model/CSharp/Gitea/srf-fufinn-behovskartleggin.cs @@ -1,9 +1,9 @@ +#nullable disable using System; using System.Collections.Generic; using System.ComponentModel.DataAnnotations; using System.Linq; using System.Text.Json.Serialization; -using System.Threading.Tasks; using System.Xml.Serialization; using Microsoft.AspNetCore.Mvc.ModelBinding; using Newtonsoft.Json; diff --git a/testdata/Model/CSharp/Gitea/srf-melding-til-statsforvalteren.cs b/testdata/Model/CSharp/Gitea/srf-melding-til-statsforvalteren.cs index 065dd7d8afb..de9255a3171 100644 --- a/testdata/Model/CSharp/Gitea/srf-melding-til-statsforvalteren.cs +++ b/testdata/Model/CSharp/Gitea/srf-melding-til-statsforvalteren.cs @@ -1,9 +1,9 @@ +#nullable disable using System; using System.Collections.Generic; using System.ComponentModel.DataAnnotations; using System.Linq; using System.Text.Json.Serialization; -using System.Threading.Tasks; using System.Xml.Serialization; using Microsoft.AspNetCore.Mvc.ModelBinding; using Newtonsoft.Json; diff --git a/testdata/Model/CSharp/Gitea/stami-atid-databehandler-2022.cs b/testdata/Model/CSharp/Gitea/stami-atid-databehandler-2022.cs index 78b0b36f840..ff5d51f67bc 100644 --- a/testdata/Model/CSharp/Gitea/stami-atid-databehandler-2022.cs +++ b/testdata/Model/CSharp/Gitea/stami-atid-databehandler-2022.cs @@ -1,9 +1,9 @@ +#nullable disable using System; using System.Collections.Generic; using System.ComponentModel.DataAnnotations; using System.Linq; using System.Text.Json.Serialization; -using System.Threading.Tasks; using System.Xml.Serialization; using Microsoft.AspNetCore.Mvc.ModelBinding; using Newtonsoft.Json; diff --git a/testdata/Model/CSharp/Gitea/stami-mu-bestilling-2021.cs b/testdata/Model/CSharp/Gitea/stami-mu-bestilling-2021.cs index c624e66cc2b..c21524c3d75 100644 --- a/testdata/Model/CSharp/Gitea/stami-mu-bestilling-2021.cs +++ b/testdata/Model/CSharp/Gitea/stami-mu-bestilling-2021.cs @@ -1,9 +1,9 @@ +#nullable disable using System; using System.Collections.Generic; using System.ComponentModel.DataAnnotations; using System.Linq; using System.Text.Json.Serialization; -using System.Threading.Tasks; using System.Xml.Serialization; using Microsoft.AspNetCore.Mvc.ModelBinding; using Newtonsoft.Json; diff --git a/testdata/Model/CSharp/Gitea/stami-mu-databehandler-2021.cs b/testdata/Model/CSharp/Gitea/stami-mu-databehandler-2021.cs index 78b0b36f840..ff5d51f67bc 100644 --- a/testdata/Model/CSharp/Gitea/stami-mu-databehandler-2021.cs +++ b/testdata/Model/CSharp/Gitea/stami-mu-databehandler-2021.cs @@ -1,9 +1,9 @@ +#nullable disable using System; using System.Collections.Generic; using System.ComponentModel.DataAnnotations; using System.Linq; using System.Text.Json.Serialization; -using System.Threading.Tasks; using System.Xml.Serialization; using Microsoft.AspNetCore.Mvc.ModelBinding; using Newtonsoft.Json; diff --git a/testdata/Model/CSharp/Gitea/udi-unntak-karantenehotell-velferd.cs b/testdata/Model/CSharp/Gitea/udi-unntak-karantenehotell-velferd.cs index dfb9211ab2e..799b985a61d 100644 --- a/testdata/Model/CSharp/Gitea/udi-unntak-karantenehotell-velferd.cs +++ b/testdata/Model/CSharp/Gitea/udi-unntak-karantenehotell-velferd.cs @@ -1,9 +1,9 @@ +#nullable disable using System; using System.Collections.Generic; using System.ComponentModel.DataAnnotations; using System.Linq; using System.Text.Json.Serialization; -using System.Threading.Tasks; using System.Xml.Serialization; using Microsoft.AspNetCore.Mvc.ModelBinding; using Newtonsoft.Json; diff --git a/testdata/Model/CSharp/Gitea/udir-invitasjon-vfkl.cs b/testdata/Model/CSharp/Gitea/udir-invitasjon-vfkl.cs index b2771998a74..638ebc52d7e 100644 --- a/testdata/Model/CSharp/Gitea/udir-invitasjon-vfkl.cs +++ b/testdata/Model/CSharp/Gitea/udir-invitasjon-vfkl.cs @@ -1,9 +1,9 @@ +#nullable disable using System; using System.Collections.Generic; using System.ComponentModel.DataAnnotations; using System.Linq; using System.Text.Json.Serialization; -using System.Threading.Tasks; using System.Xml.Serialization; using Microsoft.AspNetCore.Mvc.ModelBinding; using Newtonsoft.Json; diff --git a/testdata/Model/CSharp/Gitea/udir-vfkl.cs b/testdata/Model/CSharp/Gitea/udir-vfkl.cs index cbb0a0d531d..e40efa1b3dc 100644 --- a/testdata/Model/CSharp/Gitea/udir-vfkl.cs +++ b/testdata/Model/CSharp/Gitea/udir-vfkl.cs @@ -1,9 +1,9 @@ +#nullable disable using System; using System.Collections.Generic; using System.ComponentModel.DataAnnotations; using System.Linq; using System.Text.Json.Serialization; -using System.Threading.Tasks; using System.Xml.Serialization; using Microsoft.AspNetCore.Mvc.ModelBinding; using Newtonsoft.Json; diff --git a/testdata/Model/XmlSchema/Gitea/3422-39646.xsd b/testdata/Model/XmlSchema/Gitea/3422-39646.xsd new file mode 100644 index 00000000000..cf1eaa201be --- /dev/null +++ b/testdata/Model/XmlSchema/Gitea/3422-39646.xsd @@ -0,0 +1,5095 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/testdata/Model/XmlSchema/Gitea/3430-39615.xsd b/testdata/Model/XmlSchema/Gitea/3430-39615.xsd new file mode 100644 index 00000000000..9fae00d939e --- /dev/null +++ b/testdata/Model/XmlSchema/Gitea/3430-39615.xsd @@ -0,0 +1,456 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file From 36f5d1f66fdacb36299c8e1df05f907da5d607ee Mon Sep 17 00:00:00 2001 From: andreastanderen <71079896+standeren@users.noreply.github.com> Date: Wed, 8 May 2024 16:19:46 +0200 Subject: [PATCH 09/11] Make it possible to edit actions on tasks (#12672) * Add combobox to edit actions on tasks * Add element to bpmnDetails mock * Fix tests * Add tests * Refactor to match new design * Update frontend/language/src/nb.json Co-authored-by: Nina Kylstad * Update frontend/language/src/nb.json Co-authored-by: Nina Kylstad --------- Co-authored-by: Nina Kylstad --- frontend/language/src/nb.json | 9 + .../StudioPropertyButton.module.css | 11 + .../StudioPropertyButton.tsx | 22 +- .../bpmnProviders/SupportedPaletteProvider.js | 16 +- .../ConfigContent/ConfigContent.module.css | 11 +- .../ConfigContent/ConfigContent.test.tsx | 73 +--- .../ConfigContent/ConfigContent.tsx | 21 +- .../ConfigContent/EditActions/ActionsUtils.ts | 146 +++++++ .../EditActions/EditAction.module.css | 20 + .../EditActions/EditAction.test.tsx | 369 ++++++++++++++++++ .../ConfigContent/EditActions/EditAction.tsx | 133 +++++++ .../EditActions/EditActions.test.tsx | 148 +++++++ .../ConfigContent/EditActions/EditActions.tsx | 48 +++ .../EditActions/SelectAction.module.css | 3 + .../EditActions/SelectAction.test.tsx | 61 +++ .../EditActions/SelectAction.tsx | 49 +++ .../ConfigContent/EditActions/index.ts | 1 + .../EditDataType/EditDataType.module.css | 2 +- .../EditDataType/EditDataType.test.tsx | 78 +--- .../EditTaskId/EditTaskId.test.tsx | 51 +-- .../ConfigContent/EditTaskId/EditTaskId.tsx | 51 ++- .../ConfigPanel/ConfigPanel.test.tsx | 15 +- .../ConfigSurface/ConfigSurface.module.css | 1 + .../src/extensions/altinnCustomTasks.ts | 1 + .../src/hooks/useBpmnEditor.test.tsx | 23 +- .../process-editor/src/hooks/useBpmnEditor.ts | 5 +- .../process-editor/src/types/BpmnTaskType.ts | 8 +- .../src/utils/hookUtils/hookUtils.test.ts | 15 +- .../src/utils/hookUtils/hookUtils.ts | 10 +- .../test/mocks/bpmnContextMock.ts | 45 +++ .../test/mocks/bpmnDetailsMock.ts | 79 ++++ .../test/mocks/bpmnModelerMock.ts | 17 + 32 files changed, 1284 insertions(+), 258 deletions(-) create mode 100644 frontend/packages/process-editor/src/components/ConfigPanel/ConfigContent/EditActions/ActionsUtils.ts create mode 100644 frontend/packages/process-editor/src/components/ConfigPanel/ConfigContent/EditActions/EditAction.module.css create mode 100644 frontend/packages/process-editor/src/components/ConfigPanel/ConfigContent/EditActions/EditAction.test.tsx create mode 100644 frontend/packages/process-editor/src/components/ConfigPanel/ConfigContent/EditActions/EditAction.tsx create mode 100644 frontend/packages/process-editor/src/components/ConfigPanel/ConfigContent/EditActions/EditActions.test.tsx create mode 100644 frontend/packages/process-editor/src/components/ConfigPanel/ConfigContent/EditActions/EditActions.tsx create mode 100644 frontend/packages/process-editor/src/components/ConfigPanel/ConfigContent/EditActions/SelectAction.module.css create mode 100644 frontend/packages/process-editor/src/components/ConfigPanel/ConfigContent/EditActions/SelectAction.test.tsx create mode 100644 frontend/packages/process-editor/src/components/ConfigPanel/ConfigContent/EditActions/SelectAction.tsx create mode 100644 frontend/packages/process-editor/src/components/ConfigPanel/ConfigContent/EditActions/index.ts create mode 100644 frontend/packages/process-editor/test/mocks/bpmnContextMock.ts create mode 100644 frontend/packages/process-editor/test/mocks/bpmnDetailsMock.ts create mode 100644 frontend/packages/process-editor/test/mocks/bpmnModelerMock.ts diff --git a/frontend/language/src/nb.json b/frontend/language/src/nb.json index 32fa7e4ad61..99f6fd280f9 100644 --- a/frontend/language/src/nb.json +++ b/frontend/language/src/nb.json @@ -743,6 +743,15 @@ "preview.subheader.showas": "Vis som", "preview.view_size_desktop": "Desktop", "preview.view_size_mobile": "Mobil", + "process_editor.configuration_panel_actions_action_label": "Handling {{ actionIndex }}: {{ actionName }}", + "process_editor.configuration_panel_actions_action_type_help_text": "Hjelpetekst for valg av handlingstype", + "process_editor.configuration_panel_actions_add_new": "Legg til ny handling", + "process_editor.configuration_panel_actions_combobox_description": "Velg en handling eller definer din egen", + "process_editor.configuration_panel_actions_custom_action": "Skriv en egendefinert handling", + "process_editor.configuration_panel_actions_delete_action": "Slett {{ actionName }}-handlingen", + "process_editor.configuration_panel_actions_set_server_action_info": "Handlingen skal utføres uten å endre status på prosessen. Dette alternativet er kun tilgjengelig for egendefinerte handlinger.", + "process_editor.configuration_panel_actions_set_server_action_label": "Handlingen skal ikke påvirke prosessen", + "process_editor.configuration_panel_actions_title": "Handlinger", "process_editor.configuration_panel_change_task_id": "Endre id", "process_editor.configuration_panel_confirmation_task": "Oppgave: Bekreftelse", "process_editor.configuration_panel_custom_receipt": "Egendefinert kvittering", diff --git a/frontend/libs/studio-components/src/components/StudioProperty/StudioPropertyButton/StudioPropertyButton.module.css b/frontend/libs/studio-components/src/components/StudioProperty/StudioPropertyButton/StudioPropertyButton.module.css index 748476c70b4..8932f2d1402 100644 --- a/frontend/libs/studio-components/src/components/StudioProperty/StudioPropertyButton/StudioPropertyButton.module.css +++ b/frontend/libs/studio-components/src/components/StudioProperty/StudioPropertyButton/StudioPropertyButton.module.css @@ -21,6 +21,11 @@ white-space: nowrap; } +.readOnly:hover { + cursor: auto !important; + background-color: transparent !important; +} + .property, .value { display: block; @@ -28,17 +33,23 @@ text-overflow: ellipsis; } +.readOnlyWrapper, .editIconWrapper { flex: 1; text-align: right; display: none; } +.readOnlyWrapper, .propertyButton:hover .editIconWrapper, .propertyButton:focus .editIconWrapper { display: inline-block; } +.readOnlyWrapper { + color: black; +} + .propertyButton.compact { padding-left: var(--fds-spacing-3); padding-right: var(--fds-spacing-3); diff --git a/frontend/libs/studio-components/src/components/StudioProperty/StudioPropertyButton/StudioPropertyButton.tsx b/frontend/libs/studio-components/src/components/StudioProperty/StudioPropertyButton/StudioPropertyButton.tsx index d4d93cb103b..0a7a07c4533 100644 --- a/frontend/libs/studio-components/src/components/StudioProperty/StudioPropertyButton/StudioPropertyButton.tsx +++ b/frontend/libs/studio-components/src/components/StudioProperty/StudioPropertyButton/StudioPropertyButton.tsx @@ -3,13 +3,14 @@ import React, { forwardRef } from 'react'; import type { StudioButtonProps } from '../../StudioButton'; import { StudioButton } from '../../StudioButton'; import classes from './StudioPropertyButton.module.css'; -import { PlusCircleIcon, PencilIcon } from '@studio/icons'; +import { PadlockLockedFillIcon, PlusCircleIcon, PencilIcon } from '@studio/icons'; import cn from 'classnames'; export type StudioPropertyButtonProps = { property: string; value?: ReactNode; compact?: boolean; + readOnly?: boolean; withoutNegativeMargin?: boolean; } & Omit; @@ -18,6 +19,7 @@ const StudioPropertyButton = forwardRef{property} {value} - {hasValue && ( - - + {readOnly ? ( + + + ) : ( + hasValue && ( + + + + ) )} ); diff --git a/frontend/packages/process-editor/src/bpmnProviders/SupportedPaletteProvider.js b/frontend/packages/process-editor/src/bpmnProviders/SupportedPaletteProvider.js index b4fdb5c1265..2b33da4ef61 100644 --- a/frontend/packages/process-editor/src/bpmnProviders/SupportedPaletteProvider.js +++ b/frontend/packages/process-editor/src/bpmnProviders/SupportedPaletteProvider.js @@ -113,7 +113,17 @@ class SupportedPaletteProvider { bpmnFactory.create('altinn:TaskExtension', { taskType: taskType, actions: bpmnFactory.create('altinn:Actions', { - action: ['pay', 'reject'], + action: [ + bpmnFactory.create('altinn:Action', { + action: 'pay', + }), + bpmnFactory.create('altinn:Action', { + action: 'reject', + }), + bpmnFactory.create('altinn:Action', { + action: 'confirm', + }), + ], }), paymentConfig: bpmnFactory.create('altinn:PaymentConfig', { paymentDataType: bpmnFactory.create('altinn:PaymentDataType', { @@ -174,10 +184,10 @@ class SupportedPaletteProvider { }, 'create.altinn-confirmation-task': { group: 'activity', - title: translate('Create Altinn Confirm Task'), className: 'bpmn-icon-task-generic bpmn-icon-confirmation-task', + title: translate('Create Altinn Confirm Task'), action: { - dragstart: createCustomConfirmationTask('confirmation'), + dragstart: createCustomConfirmationTask(), }, }, 'create.altinn-payment-task': { diff --git a/frontend/packages/process-editor/src/components/ConfigPanel/ConfigContent/ConfigContent.module.css b/frontend/packages/process-editor/src/components/ConfigPanel/ConfigContent/ConfigContent.module.css index 396d575d6c2..e47042674eb 100644 --- a/frontend/packages/process-editor/src/components/ConfigPanel/ConfigContent/ConfigContent.module.css +++ b/frontend/packages/process-editor/src/components/ConfigPanel/ConfigContent/ConfigContent.module.css @@ -1,8 +1,9 @@ -.editTaskId { - margin-bottom: var(--fds-spacing-4); +.configContent { + display: flex; + flex-direction: column; + gap: var(--fds-spacing-2); } -.configContent { - margin-bottom: var(--fds-spacing-4); - padding: var(--fds-spacing-3); +.accordion { + padding-inline: 0; } diff --git a/frontend/packages/process-editor/src/components/ConfigPanel/ConfigContent/ConfigContent.test.tsx b/frontend/packages/process-editor/src/components/ConfigPanel/ConfigContent/ConfigContent.test.tsx index bd15b72a2b3..281529ad825 100644 --- a/frontend/packages/process-editor/src/components/ConfigPanel/ConfigContent/ConfigContent.test.tsx +++ b/frontend/packages/process-editor/src/components/ConfigPanel/ConfigContent/ConfigContent.test.tsx @@ -5,62 +5,18 @@ import { textMock } from '../../../../../../testing/mocks/i18nMock'; import type { BpmnContextProps } from '../../../contexts/BpmnContext'; import { BpmnContext } from '../../../contexts/BpmnContext'; import userEvent from '@testing-library/user-event'; -import type { BpmnDetails } from '../../../types/BpmnDetails'; -import { BpmnTypeEnum } from '../../../enum/BpmnTypeEnum'; -import type Modeler from 'bpmn-js/lib/Modeler'; -import { type BpmnTaskType } from '../../../types/BpmnTaskType'; -import { BpmnConfigPanelFormContextProvider } from '../../../contexts/BpmnConfigPanelContext'; import { BpmnApiContext } from '../../../contexts/BpmnApiContext'; import type { BpmnApiContextProps } from '../../../contexts/BpmnApiContext'; -import type { LayoutSets } from 'app-shared/types/api/LayoutSetsResponse'; - -const mockBPMNXML: string = ``; -const mockAppLibVersion8: string = '8.0.3'; - -const mockTaskId: string = 'testId'; -const mockName: string = 'testName'; -const layoutSetIdToUpdate: string = 'layoutSet1'; - -const modelerRefMock = { - current: { - get: () => {}, - } as unknown as Modeler, -}; - -const mockBpmnDetails: BpmnDetails = { - id: mockTaskId, - name: mockName, - taskType: 'data', - type: BpmnTypeEnum.Task, -}; - -const mockBpmnApiContextValue: Partial = { - layoutSets: { sets: [] }, - availableDataModelIds: [], -}; - -const mockBpmnContextValue: BpmnContextProps = { - bpmnXml: mockBPMNXML, - appLibVersion: mockAppLibVersion8, - getUpdatedXml: jest.fn(), - isEditAllowed: true, - bpmnDetails: mockBpmnDetails, - setBpmnDetails: jest.fn(), - modelerRef: modelerRefMock, -}; - -jest.mock('../../../hooks/useBpmnModeler', () => ({ - useBpmnModeler: () => ({ - getModeler: () => ({ - get: () => ({ - updateProperties: jest.fn(), - }), - }), - }), -})); +import { type BpmnTaskType } from '../../../types/BpmnTaskType'; +import { BpmnConfigPanelFormContextProvider } from '../../../contexts/BpmnConfigPanelContext'; +import { mockBpmnDetails } from '../../../../test/mocks/bpmnDetailsMock'; +import { + mockBpmnApiContextValue, + mockBpmnContextValue, +} from '../../../../test/mocks/bpmnContextMock'; describe('ConfigContent', () => { - beforeEach(() => { + afterEach(() => { jest.clearAllMocks(); }); it('should render heading for selected task', () => { @@ -155,17 +111,8 @@ describe('ConfigContent', () => { }); it('should display the connected data model as selected by default when data type is connected to task', () => { - const connectedDataType = 'dataModel0'; - const existingLayoutSets: LayoutSets = { - sets: [ - { - id: layoutSetIdToUpdate, - tasks: [mockTaskId], - dataType: connectedDataType, - }, - ], - }; - renderConfigContent({ layoutSets: existingLayoutSets }); + const connectedDataType = mockBpmnApiContextValue.layoutSets.sets[0].dataType; + renderConfigContent(); expect( screen.getByRole('button', { name: textMock('process_editor.configuration_panel_set_datamodel'), diff --git a/frontend/packages/process-editor/src/components/ConfigPanel/ConfigContent/ConfigContent.tsx b/frontend/packages/process-editor/src/components/ConfigPanel/ConfigContent/ConfigContent.tsx index b840a75dab7..171668981f6 100644 --- a/frontend/packages/process-editor/src/components/ConfigPanel/ConfigContent/ConfigContent.tsx +++ b/frontend/packages/process-editor/src/components/ConfigPanel/ConfigContent/ConfigContent.tsx @@ -8,6 +8,8 @@ import { getConfigTitleKey, getConfigTitleHelpTextKey } from '../../../utils/con import { ConfigIcon } from './ConfigIcon'; import { EditDataType } from './EditDataType/EditDataType'; import { useBpmnApiContext } from '../../../contexts/BpmnApiContext'; +import { Accordion } from '@digdir/design-system-react'; +import { EditActions } from './EditActions'; export const ConfigContent = (): React.ReactElement => { const { t } = useTranslation(); @@ -21,7 +23,7 @@ export const ConfigContent = (): React.ReactElement => { const taskHasConnectedLayoutSet = layoutSets?.sets?.some((set) => set.tasks[0] == bpmnDetails.id); return ( - <> +
} heading={{ @@ -33,15 +35,22 @@ export const ConfigContent = (): React.ReactElement => { title: t('process_editor.configuration_panel_header_help_text_title'), }} /> - - - + {taskHasConnectedLayoutSet && } - + + + + {t('process_editor.configuration_panel_actions_title')} + + + + + + +
); }; diff --git a/frontend/packages/process-editor/src/components/ConfigPanel/ConfigContent/EditActions/ActionsUtils.ts b/frontend/packages/process-editor/src/components/ConfigPanel/ConfigContent/EditActions/ActionsUtils.ts new file mode 100644 index 00000000000..1d9e570e325 --- /dev/null +++ b/frontend/packages/process-editor/src/components/ConfigPanel/ConfigContent/EditActions/ActionsUtils.ts @@ -0,0 +1,146 @@ +import type { ModdleElement } from 'bpmn-js/lib/BaseModeler'; +import type Modeling from 'bpmn-js/lib/features/modeling/Modeling'; +import type BpmnFactory from 'bpmn-js/lib/features/modeling/BpmnFactory'; +import type { BpmnDetails } from '../../../../types/BpmnDetails'; +import type { ActionType } from './EditAction'; +import type { BpmnTaskType } from '../../../../types/BpmnTaskType'; + +export const addNewActionToTask = ( + bpmnFactory: BpmnFactory, + modeling: Modeling, + generatedActionName: string, + bpmnDetails: BpmnDetails, +) => { + const actionsElement: ModdleElement = + bpmnDetails.element.businessObject.extensionElements.values[0].actions; + const newActionElement: ModdleElement = bpmnFactory.create('altinn:Action', { + action: generatedActionName, + }); + // Task has actions in element from before + if (actionsElement) { + actionsElement.action.push(newActionElement); + updateExistingActionsOnTask(modeling, bpmnDetails, actionsElement); + } else { + addFirstActionOnTask(bpmnFactory, modeling, bpmnDetails, newActionElement); + } +}; + +export const updateActionNameOnActionElement = ( + actionElement: ModdleElement, + newAction: string, + modeling: Modeling, + bpmnDetails: BpmnDetails, +) => { + if (actionElement.action === newAction || newAction === '') return; + if (getPredefinedActions(bpmnDetails.taskType).includes(newAction)) { + delete actionElement.type; + } + updateActionNameOnExistingAction(modeling, bpmnDetails, actionElement, newAction); +}; + +export const deleteActionFromTask = ( + bpmnDetails: BpmnDetails, + actionElement: ModdleElement, + modeling: Modeling, +) => { + const actionsElement = bpmnDetails.element.businessObject.extensionElements.values[0].actions; + const index = actionsElement.action.indexOf(actionElement); + actionsElement.action.splice(index, 1); + if (actionsElement.action.length > 0) { + updateExistingActionsOnTask(modeling, bpmnDetails, actionsElement); + } else { + updateExistingActionsOnTask(modeling, bpmnDetails, undefined); + } +}; + +export const setActionTypeOnAction = ( + actionType: ActionType, + bpmnDetails: BpmnDetails, + actionElement: ModdleElement, + modeling: Modeling, +) => { + const actionsElement = bpmnDetails.element.businessObject.extensionElements.values[0].actions; + const actionIndex = actionsElement.action.indexOf(actionElement); + actionsElement.action[actionIndex]['type'] = actionType; + updateExistingActionsOnTask(modeling, bpmnDetails, actionsElement); +}; + +const addFirstActionOnTask = ( + bpmnFactory: BpmnFactory, + modeling: Modeling, + bpmnDetails: BpmnDetails, + newActionElement: ModdleElement, +) => { + const newActionsElement: ModdleElement = bpmnFactory.create('altinn:Actions', { + action: [newActionElement], + }); + updateExistingActionsOnTask(modeling, bpmnDetails, newActionsElement); +}; + +const updateExistingActionsOnTask = ( + modeling: Modeling, + bpmnDetails: BpmnDetails, + updatedActionsElement: ModdleElement[], +) => { + modeling.updateModdleProperties( + bpmnDetails.element, + bpmnDetails.element.businessObject.extensionElements.values[0], + { + actions: updatedActionsElement, + }, + ); +}; + +const updateActionNameOnExistingAction = ( + modeling: Modeling, + bpmnDetails: BpmnDetails, + actionElementToUpdate: ModdleElement, + newActionName: string, +) => { + modeling.updateModdleProperties(bpmnDetails.element, actionElementToUpdate, { + action: newActionName, + }); +}; + +export const getPredefinedActions = (bpmnTaskType: BpmnTaskType): string[] => { + const allPredefinedActions = ['write', 'reject', 'confirm']; + if (bpmnTaskType === 'signing') allPredefinedActions.push('sign'); + if (bpmnTaskType === 'payment') allPredefinedActions.push('pay'); + return allPredefinedActions; +}; + +export const getTypeForAction = (actionElement: ModdleElement) => { + return (actionElement?.type || actionElement?.$attrs?.type) ?? undefined; +}; + +export const isActionRequiredForTask = (action: string, bpmnTaskType: BpmnTaskType): boolean => { + if (bpmnTaskType === 'signing' && action === 'sign') return true; + if (bpmnTaskType === 'signing' && action === 'reject') return true; + if (bpmnTaskType === 'payment' && action === 'pay') return true; + if (bpmnTaskType === 'payment' && action === 'confirm') return true; + if (bpmnTaskType === 'payment' && action === 'reject') return true; + return bpmnTaskType === 'confirmation' && action === 'confirm'; +}; + +export const getAvailablePredefinedActions = ( + taskType: BpmnTaskType, + actionElements: ModdleElement[], +) => filterAvailableActions(getPredefinedActions(taskType), actionElements) ?? []; + +const filterAvailableActions = ( + predefinedActionNames: string[], + existingActionElements: ModdleElement[], +): string[] => { + return predefinedActionNames.filter((actionName: string) => + isActionAvailable(actionName, existingActionElements), + ); +}; + +const isActionAvailable = ( + actionName: string, + existingActionElements: ModdleElement[], +): boolean => { + return !existingActionElements.some( + (actionElement: ModdleElement) => actionElement.action === actionName, + ); +}; diff --git a/frontend/packages/process-editor/src/components/ConfigPanel/ConfigContent/EditActions/EditAction.module.css b/frontend/packages/process-editor/src/components/ConfigPanel/ConfigContent/EditActions/EditAction.module.css new file mode 100644 index 00000000000..a42120f3731 --- /dev/null +++ b/frontend/packages/process-editor/src/components/ConfigPanel/ConfigContent/EditActions/EditAction.module.css @@ -0,0 +1,20 @@ +.action { + padding: var(--studio-property-button-vertical-spacing) var(--fds-spacing-5); + margin-bottom: var(--studio-property-button-vertical-spacing); +} + +.editActionName { + display: flex; + flex-direction: row; + align-items: flex-end; + justify-content: space-between; + gap: var(--fds-spacing-4); +} + +.editActionType { + padding-top: var(--fds-spacing-4); + display: flex; + flex-direction: row; + align-items: center; + justify-content: space-between; +} diff --git a/frontend/packages/process-editor/src/components/ConfigPanel/ConfigContent/EditActions/EditAction.test.tsx b/frontend/packages/process-editor/src/components/ConfigPanel/ConfigContent/EditActions/EditAction.test.tsx new file mode 100644 index 00000000000..48c022c8f11 --- /dev/null +++ b/frontend/packages/process-editor/src/components/ConfigPanel/ConfigContent/EditActions/EditAction.test.tsx @@ -0,0 +1,369 @@ +import React from 'react'; +import userEvent from '@testing-library/user-event'; +import { textMock } from '../../../../../../../testing/mocks/i18nMock'; +import { render, screen } from '@testing-library/react'; +import { mockBpmnDetails, paymentActions } from '../../../../../test/mocks/bpmnDetailsMock'; +import { ActionType, EditAction } from './EditAction'; +import { + modelingMock, + updateModdlePropertiesMock, +} from '../../../../../test/mocks/bpmnModelerMock'; +import type { EditActionProps } from './EditAction'; + +const mockActionElementWrite = + mockBpmnDetails.element.businessObject.extensionElements.values[0].actions.action[0]; +const mockActionElementCustomServer = + mockBpmnDetails.element.businessObject.extensionElements.values[0].actions.action[1]; +const mockActionElementCustomProcess = + mockBpmnDetails.element.businessObject.extensionElements.values[0].actions.action[2]; +const mockAvailablePredefinedActions = ['reject', 'confirm']; +const defaultEditActionProps: EditActionProps = { + actionElementToEdit: mockActionElementWrite, + availablePredefinedActions: mockAvailablePredefinedActions, + bpmnDetails: mockBpmnDetails, + index: 0, + modeling: modelingMock as any, +}; + +describe('EditAction', () => { + afterEach(() => { + jest.clearAllMocks(); + }); + it('should render a defined action as read only by default when action is required for task', () => { + const mockActionElementPay = paymentActions.actions.action[0]; + renderEditAction({ + ...defaultEditActionProps, + bpmnDetails: { + ...mockBpmnDetails, + taskType: 'payment', + }, + actionElementToEdit: mockActionElementPay, + }); + const definedAction = screen.getByRole('button', { + name: textMock('process_editor.configuration_panel_actions_action_label', { + actionIndex: defaultEditActionProps.index + 1, + actionName: mockActionElementPay.action, + }), + }); + expect(definedAction).toHaveAttribute('aria-readonly'); + }); + + it('should render a defined action by default when action is set', () => { + renderEditAction(); + expect( + screen.getByRole('button', { + name: textMock('process_editor.configuration_panel_actions_action_label', { + actionIndex: defaultEditActionProps.index + 1, + actionName: mockActionElementWrite.action, + }), + }), + ).toBeInTheDocument(); + }); + + it('should render help text for custom action', async () => { + const user = userEvent.setup(); + renderEditAction({ + ...defaultEditActionProps, + actionElementToEdit: mockActionElementCustomServer, + }); + const openEditModeButton = screen.getByRole('button', { + name: textMock('process_editor.configuration_panel_actions_action_label', { + actionIndex: defaultEditActionProps.index + 1, + actionName: mockActionElementCustomServer.action, + }), + }); + await user.click(openEditModeButton); + const helpTextButton = screen.getByRole('button', { + name: textMock('process_editor.configuration_panel_actions_action_type_help_text'), + }); + await user.click(helpTextButton); + expect( + screen.getByText( + textMock('process_editor.configuration_panel_actions_set_server_action_info'), + ), + ).toBeInTheDocument(); + }); + + it('should render save button as disabled when clicking an option', async () => { + const user = userEvent.setup(); + renderEditAction({ + ...defaultEditActionProps, + actionElementToEdit: mockActionElementCustomServer, + }); + const openEditModeButton = screen.getByRole('button', { + name: textMock('process_editor.configuration_panel_actions_action_label', { + actionIndex: defaultEditActionProps.index + 1, + actionName: mockActionElementCustomServer.action, + }), + }); + await user.click(openEditModeButton); + const helpTextButton = screen.getByRole('button', { + name: textMock('process_editor.configuration_panel_actions_action_type_help_text'), + }); + await user.click(helpTextButton); + expect( + screen.getByText( + textMock('process_editor.configuration_panel_actions_set_server_action_info'), + ), + ).toBeInTheDocument(); + }); + + it('should render switch that is enabled for an existing server action', async () => { + const user = userEvent.setup(); + renderEditAction({ + ...defaultEditActionProps, + actionElementToEdit: mockActionElementCustomServer, + }); + const openEditModeButton = screen.getByRole('button', { + name: textMock('process_editor.configuration_panel_actions_action_label', { + actionIndex: defaultEditActionProps.index + 1, + actionName: mockActionElementCustomServer.action, + }), + }); + await user.click(openEditModeButton); + const serverActionSwitch = screen.getByRole('checkbox', { + name: `set_server_type_for_${mockActionElementCustomServer.action}_action`, + }); + expect(serverActionSwitch).toBeInTheDocument(); + expect(serverActionSwitch).toBeChecked(); + }); + + it('should render switch that is not checked for a task that has an existing custom processAction', async () => { + const user = userEvent.setup(); + renderEditAction({ + ...defaultEditActionProps, + actionElementToEdit: mockActionElementCustomProcess, + }); + const openEditModeButton = screen.getByRole('button', { + name: textMock('process_editor.configuration_panel_actions_action_label', { + actionIndex: defaultEditActionProps.index + 1, + actionName: mockActionElementCustomProcess.action, + }), + }); + await user.click(openEditModeButton); + const processActionSwitch = screen.getByRole('checkbox', { + name: `set_server_type_for_${mockActionElementCustomProcess.action}_action`, + }); + expect(processActionSwitch).toBeInTheDocument(); + expect(processActionSwitch).not.toBeChecked(); + }); + + it('should call updateModdleProperties on modeling with actionType=server when setting serverAction', async () => { + const user = userEvent.setup(); + renderEditAction({ + ...defaultEditActionProps, + actionElementToEdit: mockActionElementCustomProcess, + }); + expect(mockActionElementCustomProcess.type).toBe(ActionType.Process); + const openEditModeButton = screen.getByRole('button', { + name: textMock('process_editor.configuration_panel_actions_action_label', { + actionIndex: defaultEditActionProps.index + 1, + actionName: mockActionElementCustomProcess.action, + }), + }); + await user.click(openEditModeButton); + const actionTypeSwitch = screen.getByRole('checkbox', { + name: `set_server_type_for_${mockActionElementCustomProcess.action}_action`, + }); + await user.click(actionTypeSwitch); + expect(updateModdlePropertiesMock).toHaveBeenCalledTimes(1); + expect(updateModdlePropertiesMock).toHaveBeenCalledWith( + expect.anything(), + expect.anything(), + expect.objectContaining({ + actions: expect.objectContaining({ + action: expect.arrayContaining([ + { action: mockActionElementCustomProcess.action, type: ActionType.Server }, + ]), + }), + }), + ); + }); + + it('should call updateModdleProperties on modeling with actionType=process when unsetting serverAction', async () => { + const user = userEvent.setup(); + renderEditAction({ + ...defaultEditActionProps, + actionElementToEdit: mockActionElementCustomServer, + }); + expect(mockActionElementCustomServer.type).toBe(ActionType.Server); + const openEditModeButton = screen.getByRole('button', { + name: textMock('process_editor.configuration_panel_actions_action_label', { + actionIndex: defaultEditActionProps.index + 1, + actionName: mockActionElementCustomServer.action, + }), + }); + await user.click(openEditModeButton); + const actionTypeSwitch = screen.getByRole('checkbox', { + name: `set_server_type_for_${mockActionElementCustomServer.action}_action`, + }); + await user.click(actionTypeSwitch); + expect(updateModdlePropertiesMock).toHaveBeenCalledTimes(1); + expect(updateModdlePropertiesMock).toHaveBeenCalledWith( + expect.anything(), + expect.anything(), + expect.objectContaining({ + actions: expect.objectContaining({ + action: expect.arrayContaining([ + { action: mockActionElementCustomServer.action, type: ActionType.Process }, + ]), + }), + }), + ); + }); + + it('should call updateModdleProperties on modeling with new action name when typing a new action in combobox', async () => { + const user = userEvent.setup(); + const newActionNameCustom = 'myCustomAction'; + renderEditAction(); + const openEditModeButton = screen.getByRole('button', { + name: textMock('process_editor.configuration_panel_actions_action_label', { + actionIndex: defaultEditActionProps.index + 1, + actionName: mockActionElementWrite.action, + }), + }); + await user.click(openEditModeButton); + const combobox = screen.getByTitle(`combobox_${mockActionElementWrite.action}`); + await user.clear(combobox); + await user.type(combobox, newActionNameCustom); + await user.tab(); + const saveButton = screen.getByRole('button', { name: textMock('general.save') }); + await user.click(saveButton); + expect(updateModdlePropertiesMock).toHaveBeenCalledTimes(1); + expect(updateModdlePropertiesMock).toHaveBeenCalledWith( + mockBpmnDetails.element, + mockActionElementWrite, + { + action: newActionNameCustom, + }, + ); + }); + + it('should call updateModdleProperties on modeling with new action name and deleted action type when changing a custom action to a predefined', async () => { + const user = userEvent.setup(); + const newActionNameReject = 'reject'; + renderEditAction({ + ...defaultEditActionProps, + actionElementToEdit: { + action: mockActionElementCustomServer.action, + type: ActionType.Server, + }, + }); + const openEditModeButton = screen.getByRole('button', { + name: textMock('process_editor.configuration_panel_actions_action_label', { + actionIndex: defaultEditActionProps.index + 1, + actionName: mockActionElementCustomServer.action, + }), + }); + await user.click(openEditModeButton); + const combobox = screen.getByTitle(`combobox_${mockActionElementCustomServer.action}`); + await user.click(combobox); + await user.clear(combobox); + const actionOption = screen.getByRole('option', { name: newActionNameReject }); + await user.click(actionOption); + const saveButton = await screen.findByRole('button', { name: textMock('general.save') }); + await user.click(saveButton); + expect(updateModdlePropertiesMock).toHaveBeenCalledTimes(1); + expect(updateModdlePropertiesMock).toHaveBeenCalledWith( + expect.anything(), + expect.objectContaining({ action: mockActionElementCustomServer.action }) && + expect.not.objectContaining({ type: mockActionElementCustomServer.type }), + { action: newActionNameReject }, + ); + }); + + it('should call updateModdleProperties on modeling without specific action when deleting an action', async () => { + const user = userEvent.setup(); + renderEditAction(); + const openEditModeButton = screen.getByRole('button', { + name: textMock('process_editor.configuration_panel_actions_action_label', { + actionIndex: defaultEditActionProps.index + 1, + actionName: mockActionElementWrite.action, + }), + }); + await user.click(openEditModeButton); + const deleteButton = screen.getByRole('button', { + name: textMock('process_editor.configuration_panel_actions_delete_action', { + actionName: mockActionElementWrite.action, + }), + }); + await user.click(deleteButton); + expect(updateModdlePropertiesMock).toHaveBeenCalledTimes(1); + expect(updateModdlePropertiesMock).toHaveBeenCalledWith( + expect.anything(), + expect.anything(), + expect.objectContaining({ + actions: + expect.objectContaining({ mockActionElementCustomServer }) && + expect.objectContaining({ mockActionElementCustomProcess }) && + expect.not.objectContaining({ mockActionElementWrite }), + }), + ); + }); + + it('should call updateModdleProperties on modeling without any actions when deleting the only existing one', async () => { + const user = userEvent.setup(); + renderEditAction({ + ...defaultEditActionProps, + bpmnDetails: { + ...mockBpmnDetails, + element: { + businessObject: { + extensionElements: { + values: [ + { + actions: { + action: [mockActionElementWrite], + }, + }, + ], + }, + }, + }, + }, + }); + const openEditModeButton = screen.getByRole('button', { + name: textMock('process_editor.configuration_panel_actions_action_label', { + actionIndex: defaultEditActionProps.index + 1, + actionName: mockActionElementWrite.action, + }), + }); + await user.click(openEditModeButton); + const deleteButton = screen.getByRole('button', { + name: textMock('process_editor.configuration_panel_actions_delete_action', { + actionName: mockActionElementWrite.action, + }), + }); + await user.click(deleteButton); + expect(updateModdlePropertiesMock).toHaveBeenCalledTimes(1); + expect(updateModdlePropertiesMock).toHaveBeenCalledWith( + expect.anything(), + expect.anything(), + expect.objectContaining({ + actions: undefined, + }), + ); + }); + + it('should not call updateModdleProperties on modeling when selecting the current action', async () => { + const user = userEvent.setup(); + const newActionNameWrite = 'write'; + renderEditAction(); + const openEditModeButton = screen.getByRole('button', { + name: textMock('process_editor.configuration_panel_actions_action_label', { + actionIndex: defaultEditActionProps.index + 1, + actionName: mockActionElementWrite.action, + }), + }); + await user.click(openEditModeButton); + const combobox = screen.getByTitle(`combobox_${mockActionElementWrite.action}`); + await user.clear(combobox); + const actionOption = screen.getByRole('option', { name: newActionNameWrite }); + await user.click(actionOption); + expect(updateModdlePropertiesMock).not.toHaveBeenCalled(); + }); +}); + +const renderEditAction = (editActionProps: EditActionProps = defaultEditActionProps) => { + return render(); +}; diff --git a/frontend/packages/process-editor/src/components/ConfigPanel/ConfigContent/EditActions/EditAction.tsx b/frontend/packages/process-editor/src/components/ConfigPanel/ConfigContent/EditActions/EditAction.tsx new file mode 100644 index 00000000000..19f8d075ebc --- /dev/null +++ b/frontend/packages/process-editor/src/components/ConfigPanel/ConfigContent/EditActions/EditAction.tsx @@ -0,0 +1,133 @@ +import type { ChangeEvent } from 'react'; +import React, { useState } from 'react'; +import classes from './EditAction.module.css'; +import { + deleteActionFromTask, + getPredefinedActions, + getTypeForAction, + isActionRequiredForTask, + setActionTypeOnAction, + updateActionNameOnActionElement, +} from './ActionsUtils'; +import type Modeling from 'bpmn-js/lib/features/modeling/Modeling'; +import type { ModdleElement } from 'bpmn-js/lib/BaseModeler'; +import { StudioButton, StudioDeleteButton, StudioProperty } from '@studio/components'; +import { CheckmarkIcon } from '@studio/icons'; +import { HelpText, Switch } from '@digdir/design-system-react'; +import type { BpmnDetails } from '../../../../types/BpmnDetails'; +import { useTranslation } from 'react-i18next'; +import { SelectAction } from './SelectAction'; + +export enum ActionType { + Server = 'serverAction', + Process = 'processAction', +} + +export interface EditActionProps { + actionElementToEdit: ModdleElement; + availablePredefinedActions: string[]; + bpmnDetails: BpmnDetails; + index: number; + modeling: Modeling; +} + +export const EditAction = ({ + actionElementToEdit, + availablePredefinedActions, + bpmnDetails, + index, + modeling, +}: EditActionProps) => { + const { t } = useTranslation(); + const [editMode, setEditMode] = useState(actionElementToEdit.action === undefined); + // Ideally this state is not needed. The call to update action should be triggered on direct change of the value in the combobox. + // When this triggering can happen from both option selection and custom writing we need to keep the value in a state and pass this + // value when clicking save-button. + const [currentActionName, setCurrentActionName] = useState( + actionElementToEdit.action ?? '', + ); + + const setActionType = (actionElement: ModdleElement, checked: ChangeEvent) => { + const actionType = checked.target.checked ? ActionType.Server : ActionType.Process; + setActionTypeOnAction(actionType, bpmnDetails, actionElement, modeling); + }; + + const handleUpdateAction = (actionElement: ModdleElement, newAction: string) => { + updateActionNameOnActionElement(actionElement, newAction, modeling, bpmnDetails); + setEditMode(false); + }; + + const handleDeleteAction = (actionElement: ModdleElement) => { + deleteActionFromTask(bpmnDetails, actionElement, modeling); + }; + + const allowSettingServerAction = (actionName: string): boolean => { + if (actionName === '') return false; // Ensure that default is not allowing + return ( + !isActionRequiredForTask(actionName, bpmnDetails.taskType) && + !getPredefinedActions(bpmnDetails.taskType).includes(actionName) + ); + }; + + const actionLabel = (actionName = actionElementToEdit.action) => + t('process_editor.configuration_panel_actions_action_label', { + actionIndex: index + 1, + actionName: actionName, + }); + + return editMode ? ( +
+
+ setCurrentActionName(actionName)} + /> + } + onClick={() => handleUpdateAction(actionElementToEdit, currentActionName)} + disabled={currentActionName === ''} + size='small' + title={t('general.save')} + variant='secondary' + /> + handleDeleteAction(actionElementToEdit)} + size='small' + title={t('process_editor.configuration_panel_actions_delete_action', { + actionName: actionElementToEdit.action, + })} + /> +
+ {allowSettingServerAction(currentActionName) && ( +
+ setActionType(actionElementToEdit, checked)} + size='small' + value={getTypeForAction(actionElementToEdit) ?? ActionType.Process} + checked={getTypeForAction(actionElementToEdit) === ActionType.Server} + > + {t('process_editor.configuration_panel_actions_set_server_action_label')} + + + {t('process_editor.configuration_panel_actions_set_server_action_info')} + +
+ )} +
+ ) : ( + setEditMode(true)} + property={actionLabel(null)} + title={actionLabel()} + value={actionElementToEdit.action} + className={classes.action} + /> + ); +}; diff --git a/frontend/packages/process-editor/src/components/ConfigPanel/ConfigContent/EditActions/EditActions.test.tsx b/frontend/packages/process-editor/src/components/ConfigPanel/ConfigContent/EditActions/EditActions.test.tsx new file mode 100644 index 00000000000..8fce18e565d --- /dev/null +++ b/frontend/packages/process-editor/src/components/ConfigPanel/ConfigContent/EditActions/EditActions.test.tsx @@ -0,0 +1,148 @@ +import React from 'react'; +import { render, screen } from '@testing-library/react'; +import { EditActions } from './EditActions'; +import { textMock } from '../../../../../../../testing/mocks/i18nMock'; +import { + confirmationActions, + mockBpmnDetails, + paymentActions, + signingActions, +} from '../../../../../test/mocks/bpmnDetailsMock'; +import { + createMock, + mockModelerRef, + updateModdlePropertiesMock, +} from '../../../../../test/mocks/bpmnModelerMock'; +import { useBpmnContext } from '../../../../contexts/BpmnContext'; +import type { BpmnDetails } from '../../../../types/BpmnDetails'; +import type { BpmnTaskType } from '../../../../types/BpmnTaskType'; +import userEvent from '@testing-library/user-event'; +import { ObjectUtils } from '@studio/pure-functions'; + +const actionsForTaskTypes = { + confirmation: confirmationActions, + signing: signingActions, + payment: paymentActions, +}; // add payment: paymentActions + +const setBpmnDetailsMock = jest.fn(); +jest.mock('../../../../contexts/BpmnContext', () => ({ + useBpmnContext: jest.fn(() => ({ + modelerRef: mockModelerRef, + setBpmnDetails: setBpmnDetailsMock, + bpmnDetails: mockBpmnDetails, + })), +})); + +jest.mock('bpmn-js/lib/features/modeling/BpmnFactory', () => ({ + BpmnFactory: jest.fn(() => ({ + create: jest.fn(), + })), +})); + +const overrideBpmnDetailsMock = (bpmnDetailsToOverride: BpmnDetails) => { + (useBpmnContext as jest.Mock).mockReturnValue({ + modelerRef: mockModelerRef, + setBpmnDetails: setBpmnDetailsMock, + bpmnDetails: bpmnDetailsToOverride, + }); +}; + +describe('EditActions', () => { + afterEach(() => { + jest.clearAllMocks(); + }); + + it('should render only "add new action" button when task have no actions', () => { + renderEditActions({ + ...mockBpmnDetails, + element: { businessObject: { extensionElements: { values: [{}] } } }, + }); + const addNewActionButton = screen.getAllByRole('button', { + name: textMock('process_editor.configuration_panel_actions_add_new'), + }); + expect(addNewActionButton).toHaveLength(1); + }); + + it('should render existing actions when task have predefined actions', () => { + const predefinedAction = + mockBpmnDetails.element.businessObject.extensionElements.values[0].actions.action[0].action; + const customServerAction = + mockBpmnDetails.element.businessObject.extensionElements.values[0].actions.action[1].action; + const customProcessAction = + mockBpmnDetails.element.businessObject.extensionElements.values[0].actions.action[2].action; + renderEditActions(); + expect( + screen.getByRole('button', { + name: textMock('process_editor.configuration_panel_actions_action_label', { + actionIndex: 1, + actionName: predefinedAction, + }), + }), + ).toBeInTheDocument(); + expect( + screen.getByRole('button', { + name: textMock('process_editor.configuration_panel_actions_action_label', { + actionIndex: 2, + actionName: customServerAction, + }), + }), + ).toBeInTheDocument(); + expect( + screen.getByRole('button', { + name: textMock('process_editor.configuration_panel_actions_action_label', { + actionIndex: 3, + actionName: customProcessAction, + }), + }), + ).toBeInTheDocument(); + }); + + it.each(['confirmation', 'signing', 'payment'])( + 'should render readOnly non-clickable defined action button for actions that are required for task type: %s', + (taskType: BpmnTaskType) => { + const actions = actionsForTaskTypes[taskType]; + const element = { businessObject: { extensionElements: { values: [actions] } } }; + renderEditActions({ ...mockBpmnDetails, taskType: taskType, element }); + actions.actions.action.forEach((action, index) => { + const definedActionButton = screen.getByRole('button', { + name: textMock('process_editor.configuration_panel_actions_action_label', { + actionIndex: index + 1, + actionName: action.action, + }), + }); + expect(definedActionButton).toHaveAttribute('aria-readonly'); + }); + }, + ); + + it('should not render optional action for task as read only', () => { + const predefinedAction = + mockBpmnDetails.element.businessObject.extensionElements.values[0].actions.action[0].action; + renderEditActions(); + const definedActionButton = screen.getByRole('button', { + name: textMock('process_editor.configuration_panel_actions_action_label', { + actionIndex: 1, + actionName: predefinedAction, + }), + }); + expect(definedActionButton).not.toHaveAttribute('aria-readonly'); + }); + + it('should call "create" and "updateModdleProperties" when clicking "add new action"', async () => { + const user = userEvent.setup(); + renderEditActions(); + const addNewActionButton = screen.getByRole('button', { + name: textMock('process_editor.configuration_panel_actions_add_new'), + }); + await user.click(addNewActionButton); + expect(createMock).toHaveBeenCalledTimes(1); + expect(updateModdlePropertiesMock).toHaveBeenCalledTimes(1); + }); +}); + +const renderEditActions = (bpmnDetails = mockBpmnDetails) => { + const bpmnDetailsCopy = ObjectUtils.deepCopy(bpmnDetails); + overrideBpmnDetailsMock(bpmnDetailsCopy); + return render(); +}; diff --git a/frontend/packages/process-editor/src/components/ConfigPanel/ConfigContent/EditActions/EditActions.tsx b/frontend/packages/process-editor/src/components/ConfigPanel/ConfigContent/EditActions/EditActions.tsx new file mode 100644 index 00000000000..83d7ffb1fa7 --- /dev/null +++ b/frontend/packages/process-editor/src/components/ConfigPanel/ConfigContent/EditActions/EditActions.tsx @@ -0,0 +1,48 @@ +import React from 'react'; +import { useBpmnContext } from '../../../../contexts/BpmnContext'; +import { useTranslation } from 'react-i18next'; +import { StudioProperty } from '@studio/components'; +import type Modeling from 'bpmn-js/lib/features/modeling/Modeling'; +import type { ModdleElement } from 'bpmn-js/lib/BaseModeler'; +import type BpmnFactory from 'bpmn-js/lib/features/modeling/BpmnFactory'; +import { addNewActionToTask, getAvailablePredefinedActions } from './ActionsUtils'; +import { EditAction } from './EditAction'; + +export const EditActions = () => { + const { t } = useTranslation(); + const { bpmnDetails, modelerRef } = useBpmnContext(); + const actionElements: ModdleElement[] = + bpmnDetails?.element?.businessObject?.extensionElements?.values[0]?.actions?.action ?? []; + const modelerInstance = modelerRef.current; + const modeling: Modeling = modelerInstance.get('modeling'); + const bpmnFactory: BpmnFactory = modelerInstance.get('bpmnFactory'); + + const availablePredefinedActions = getAvailablePredefinedActions( + bpmnDetails.taskType, + actionElements, + ); + + const handleAddNewAction = () => { + addNewActionToTask(bpmnFactory, modeling, undefined, bpmnDetails); + }; + + return ( + <> + {actionElements.map((actionElement: ModdleElement, index: number) => ( + + ))} + + + ); +}; diff --git a/frontend/packages/process-editor/src/components/ConfigPanel/ConfigContent/EditActions/SelectAction.module.css b/frontend/packages/process-editor/src/components/ConfigPanel/ConfigContent/EditActions/SelectAction.module.css new file mode 100644 index 00000000000..268e9930368 --- /dev/null +++ b/frontend/packages/process-editor/src/components/ConfigPanel/ConfigContent/EditActions/SelectAction.module.css @@ -0,0 +1,3 @@ +.actionCombobox { + flex: 1; +} diff --git a/frontend/packages/process-editor/src/components/ConfigPanel/ConfigContent/EditActions/SelectAction.test.tsx b/frontend/packages/process-editor/src/components/ConfigPanel/ConfigContent/EditActions/SelectAction.test.tsx new file mode 100644 index 00000000000..70aa243ab47 --- /dev/null +++ b/frontend/packages/process-editor/src/components/ConfigPanel/ConfigContent/EditActions/SelectAction.test.tsx @@ -0,0 +1,61 @@ +import React from 'react'; +import userEvent from '@testing-library/user-event'; +import { render, screen, waitFor } from '@testing-library/react'; +import type { SelectActionProps } from './SelectAction'; +import { SelectAction } from './SelectAction'; + +describe('SelectAction', () => { + afterEach(() => { + jest.clearAllMocks(); + }); + it('should show combobox with all predefined actions as options', async () => { + const user = userEvent.setup(); + renderSelectAction(); + const combobox = screen.getByTitle(`combobox_${mockActionNameWrite}`); + await user.click(combobox); + mockAvailablePredefinedActions.forEach((action) => + expect(screen.getByRole('option', { name: action })).toBeInTheDocument(), + ); + }); + + it('should call onSetCurrentActionName when writing a custom action and bluring combobox', async () => { + const user = userEvent.setup(); + const myCustomActionName = 'MyCustomAction'; + const onSetCurrentActionNameMock = jest.fn(); + renderSelectAction({ onSetCurrentActionName: onSetCurrentActionNameMock }); + const combobox = screen.getByTitle(`combobox_${mockActionNameWrite}`); + await user.click(combobox); + await user.clear(combobox); + await user.type(combobox, myCustomActionName); + await user.tab(); + expect(onSetCurrentActionNameMock).toHaveBeenCalledTimes(1); + expect(onSetCurrentActionNameMock).toHaveBeenCalledWith(myCustomActionName); + }); + + it('should change displayValue when selecting an option', async () => { + const user = userEvent.setup(); + const rejectActionName = 'reject'; + const onSetCurrentActionNameMock = jest.fn(); + renderSelectAction({ onSetCurrentActionName: onSetCurrentActionNameMock }); + const combobox = screen.getByTitle(`combobox_${mockActionNameWrite}`); + expect(combobox).toHaveDisplayValue(mockActionNameWrite); + await user.click(combobox); + const rejectOption = screen.getByRole('option', { name: rejectActionName }); + await user.click(rejectOption); + await waitFor(() => expect(combobox).toHaveDisplayValue(rejectActionName)); + }); +}); + +const mockActionNameWrite = 'write'; +const mockAvailablePredefinedActions = ['reject', 'confirm']; +const defaultSelectActionProps: SelectActionProps = { + actionName: mockActionNameWrite, + availablePredefinedActions: mockAvailablePredefinedActions, + comboboxLabel: '', + currentActionName: mockActionNameWrite, + onSetCurrentActionName: jest.fn(), +}; + +const renderSelectAction = (selectActionProps?: Partial) => { + return render(); +}; diff --git a/frontend/packages/process-editor/src/components/ConfigPanel/ConfigContent/EditActions/SelectAction.tsx b/frontend/packages/process-editor/src/components/ConfigPanel/ConfigContent/EditActions/SelectAction.tsx new file mode 100644 index 00000000000..5f53c699e76 --- /dev/null +++ b/frontend/packages/process-editor/src/components/ConfigPanel/ConfigContent/EditActions/SelectAction.tsx @@ -0,0 +1,49 @@ +import React from 'react'; +import { Combobox } from '@digdir/design-system-react'; +import classes from './SelectAction.module.css'; +import { useTranslation } from 'react-i18next'; + +export interface SelectActionProps { + actionName: string; + availablePredefinedActions: string[]; + comboboxLabel: string; + currentActionName: string; + onSetCurrentActionName: (actionName: string) => void; +} +export const SelectAction = ({ + actionName, + availablePredefinedActions, + comboboxLabel, + currentActionName, + onSetCurrentActionName, +}: SelectActionProps) => { + const { t } = useTranslation(); + + const allPredefinedActions = ['write', 'reject', 'confirm', 'sign']; + + return ( + onSetCurrentActionName(target.value)} + > + + {t('process_editor.configuration_panel_actions_custom_action')} + + {allPredefinedActions.includes(actionName) && ( + + {actionName} + + )} + {availablePredefinedActions.map((predefinedAction: string) => ( + + {predefinedAction} + + ))} + + ); +}; diff --git a/frontend/packages/process-editor/src/components/ConfigPanel/ConfigContent/EditActions/index.ts b/frontend/packages/process-editor/src/components/ConfigPanel/ConfigContent/EditActions/index.ts new file mode 100644 index 00000000000..774fd71b8de --- /dev/null +++ b/frontend/packages/process-editor/src/components/ConfigPanel/ConfigContent/EditActions/index.ts @@ -0,0 +1 @@ +export { EditActions } from './EditActions'; diff --git a/frontend/packages/process-editor/src/components/ConfigPanel/ConfigContent/EditDataType/EditDataType.module.css b/frontend/packages/process-editor/src/components/ConfigPanel/ConfigContent/EditDataType/EditDataType.module.css index 7d142802921..67a77c93d13 100644 --- a/frontend/packages/process-editor/src/components/ConfigPanel/ConfigContent/EditDataType/EditDataType.module.css +++ b/frontend/packages/process-editor/src/components/ConfigPanel/ConfigContent/EditDataType/EditDataType.module.css @@ -1,6 +1,6 @@ .datamodelUndefined, .datamodelDefined { - padding-left: var(--fds-spacing-3); + padding: var(--fds-spacing-3) var(--fds-spacing-3); } .definedValue { diff --git a/frontend/packages/process-editor/src/components/ConfigPanel/ConfigContent/EditDataType/EditDataType.test.tsx b/frontend/packages/process-editor/src/components/ConfigPanel/ConfigContent/EditDataType/EditDataType.test.tsx index a9f79a415a0..025245a0426 100644 --- a/frontend/packages/process-editor/src/components/ConfigPanel/ConfigContent/EditDataType/EditDataType.test.tsx +++ b/frontend/packages/process-editor/src/components/ConfigPanel/ConfigContent/EditDataType/EditDataType.test.tsx @@ -4,51 +4,29 @@ import { textMock } from '../../../../../../../testing/mocks/i18nMock'; import userEvent from '@testing-library/user-event'; import type { BpmnApiContextProps } from '../../../../contexts/BpmnApiContext'; import { BpmnApiContext } from '../../../../contexts/BpmnApiContext'; -import type { BpmnContextProps } from '../../../../contexts/BpmnContext'; import { BpmnContext } from '../../../../contexts/BpmnContext'; -import type { BpmnDetails } from '../../../../types/BpmnDetails'; -import { BpmnTypeEnum } from '../../../../enum/BpmnTypeEnum'; -import type Modeler from 'bpmn-js/lib/Modeler'; import { EditDataType } from './EditDataType'; import { BpmnConfigPanelFormContextProvider } from '../../../../contexts/BpmnConfigPanelContext'; +import { + mockBpmnApiContextValue, + mockBpmnContextValue, +} from '../../../../../test/mocks/bpmnContextMock'; +import type { LayoutSets } from 'app-shared/types/api/LayoutSetsResponse'; const mockTaskId: string = 'testId'; -const mockName: string = 'testName'; - -const modelerRefMock = { - current: { - get: () => {}, - } as unknown as Modeler, -}; - -const mockBpmnDetails: BpmnDetails = { - id: mockTaskId, - name: mockName, - taskType: 'data', - type: BpmnTypeEnum.Task, -}; - -const mockBpmnApiContextValue: Partial = { - layoutSets: { - sets: [ - { - id: 'layoutSetName', - tasks: [mockTaskId], - }, - ], - }, - availableDataModelIds: [], -}; - -const mockBpmnContextValue: Partial = { - bpmnDetails: mockBpmnDetails, - modelerRef: modelerRefMock, +const layoutSetsWithoutDataTypeConnection: LayoutSets = { + sets: [ + { + id: 'setWithDataType', + tasks: [mockTaskId], + }, + ], }; describe('EditDataType', () => { afterEach(jest.clearAllMocks); it('should display a button to add datamodel when task has no datamodel', () => { - renderEditDataType(); + renderEditDataType({ layoutSets: layoutSetsWithoutDataTypeConnection }); expect( screen.getByRole('button', { name: textMock('process_editor.configuration_panel_set_datamodel_link'), @@ -58,7 +36,7 @@ describe('EditDataType', () => { it('should display a native select with default value when clicking "add datamodel"', async () => { const user = userEvent.setup(); - renderEditDataType(); + renderEditDataType({ layoutSets: layoutSetsWithoutDataTypeConnection }); const addDataModelButton = screen.getByRole('button', { name: textMock('process_editor.configuration_panel_set_datamodel_link'), }); @@ -72,11 +50,8 @@ describe('EditDataType', () => { it('should display all available data types including existing and no-model-key as options for data type select', async () => { const user = userEvent.setup(); const availableDataModelIds = ['dataModel1', 'dataModel2']; - const existingDataType = 'dataModel0'; + const existingDataType = mockBpmnApiContextValue.layoutSets.sets[0].dataType; renderEditDataType({ - layoutSets: { - sets: [{ id: 'setWithDataType', dataType: existingDataType, tasks: [mockTaskId] }], - }, availableDataModelIds, }); const updateDataTypeButton = screen.getByRole('button', { @@ -98,12 +73,8 @@ describe('EditDataType', () => { it('should display the existing data type in preview as a button to edit when task has connected data model', async () => { const user = userEvent.setup(); - const existingDataType = 'dataType'; - renderEditDataType({ - layoutSets: { - sets: [{ id: 'setWithDataType', dataType: existingDataType, tasks: [mockTaskId] }], - }, - }); + const existingDataType = mockBpmnApiContextValue.layoutSets.sets[0].dataType; + renderEditDataType(); const updateDataTypeButton = screen.getByRole('button', { name: textMock('process_editor.configuration_panel_set_datamodel'), }); @@ -118,18 +89,7 @@ describe('EditDataType', () => { it('should display the existing data type in preview when clicking the close button after edit mode and task has data type', async () => { const user = userEvent.setup(); - const existingDataType = 'dataType'; - renderEditDataType({ - layoutSets: { - sets: [ - { - id: 'setWithDataType', - dataType: existingDataType, - tasks: [mockTaskId], - }, - ], - }, - }); + renderEditDataType(); const updateDataTypeButton = screen.getByRole('button', { name: textMock('process_editor.configuration_panel_set_datamodel'), }); @@ -145,7 +105,7 @@ describe('EditDataType', () => { it('should display the button to add datamodel when clicking the close button after edit mode and task has no data type', async () => { const user = userEvent.setup(); - renderEditDataType(); + renderEditDataType({ layoutSets: layoutSetsWithoutDataTypeConnection }); const addDataModelButton = screen.getByRole('button', { name: textMock('process_editor.configuration_panel_set_datamodel_link'), }); diff --git a/frontend/packages/process-editor/src/components/ConfigPanel/ConfigContent/EditTaskId/EditTaskId.test.tsx b/frontend/packages/process-editor/src/components/ConfigPanel/ConfigContent/EditTaskId/EditTaskId.test.tsx index bb6dc34851d..d7ce07faae8 100644 --- a/frontend/packages/process-editor/src/components/ConfigPanel/ConfigContent/EditTaskId/EditTaskId.test.tsx +++ b/frontend/packages/process-editor/src/components/ConfigPanel/ConfigContent/EditTaskId/EditTaskId.test.tsx @@ -4,33 +4,10 @@ import userEvent from '@testing-library/user-event'; import { EditTaskId } from './EditTaskId'; import { textMock } from '../../../../../../../testing/mocks/i18nMock'; import { useBpmnConfigPanelFormContext } from '../../../../contexts/BpmnConfigPanelContext'; -import { - type BpmnApiContextProps, - BpmnApiContextProvider, -} from '../../../../contexts/BpmnApiContext'; - -const mockBpmnApiContextValue: Partial = { - layoutSets: { - sets: [ - { - id: 'testId', - dataType: 'layoutSetId1', - tasks: ['testId'], - }, - { - id: 'layoutSetId2', - dataType: 'layoutSetId2', - tasks: ['Task_2'], - }, - ], - }, - pendingApiOperations: false, - existingCustomReceiptLayoutSetName: undefined, - addLayoutSet: jest.fn(), - deleteLayoutSet: jest.fn(), - mutateLayoutSet: jest.fn(), - saveBpmn: jest.fn(), -}; +import { BpmnApiContextProvider } from '../../../../contexts/BpmnApiContext'; +import { mockBpmnDetails } from '../../../../../test/mocks/bpmnDetailsMock'; +import { mockModelerRef } from '../../../../../test/mocks/bpmnModelerMock'; +import { mockBpmnApiContextValue } from '../../../../../test/mocks/bpmnContextMock'; const renderEditTaskId = (children: React.ReactNode) => { return render( @@ -41,20 +18,9 @@ const renderEditTaskId = (children: React.ReactNode) => { const setBpmnDetailsMock = jest.fn(); jest.mock('../../../../contexts/BpmnContext', () => ({ useBpmnContext: () => ({ - modelerRef: { - current: { - get: () => ({ - updateProperties: jest.fn(), - }), - }, - }, + modelerRef: mockModelerRef, setBpmnDetails: setBpmnDetailsMock, - bpmnDetails: { - id: 'testId', - name: 'testName', - taskType: 'data', - type: 'task', - }, + bpmnDetails: mockBpmnDetails, }), })); @@ -187,11 +153,6 @@ describe('EditTaskId', () => { }); }); - it('should support HTMLDivElement props', () => { - renderEditTaskId(); - expect(screen.getByTestId('unitTestId')).toHaveClass('my-awesome-class-name'); - }); - it('should not update id if new id is the same as the old id', async () => { const user = userEvent.setup(); const metaDataFormRefMock = { current: undefined }; diff --git a/frontend/packages/process-editor/src/components/ConfigPanel/ConfigContent/EditTaskId/EditTaskId.tsx b/frontend/packages/process-editor/src/components/ConfigPanel/ConfigContent/EditTaskId/EditTaskId.tsx index ac2b44e0e43..21f611fef22 100644 --- a/frontend/packages/process-editor/src/components/ConfigPanel/ConfigContent/EditTaskId/EditTaskId.tsx +++ b/frontend/packages/process-editor/src/components/ConfigPanel/ConfigContent/EditTaskId/EditTaskId.tsx @@ -1,4 +1,4 @@ -import React, { type HTMLAttributes } from 'react'; +import React from 'react'; import { useTranslation } from 'react-i18next'; import { checkForInvalidCharacters } from '../../../../utils/configPanelUtils'; import { StudioToggleableTextfield } from '@studio/components'; @@ -10,8 +10,7 @@ import classes from './EditTaskId.module.css'; import { useTaskIds } from '../../../../hooks/useTaskIds'; import type { MetaDataForm } from 'app-shared/types/BpmnMetaDataForm'; -type EditTaskIdProps = HTMLAttributes; -export const EditTaskId = ({ ...rest }: EditTaskIdProps): React.ReactElement => { +export const EditTaskId = (): React.ReactElement => { const { t } = useTranslation(); const { bpmnDetails, modelerRef, setBpmnDetails } = useBpmnContext(); const { metaDataFormRef } = useBpmnConfigPanelFormContext(); @@ -80,29 +79,27 @@ export const EditTaskId = ({ ...rest }: EditTaskIdProps): React.ReactElement => }; return ( -
- , - label: t('process_editor.configuration_panel_change_task_id'), - value: bpmnDetails.id, - onBlur: (event) => handleOnTaskIdBlur(event), - size: 'small', - }} - viewProps={{ - className: classes.view, - children: ( - - ID: {bpmnDetails.id} - - ), - value: bpmnDetails.id, - variant: 'tertiary', - 'aria-label': t('process_editor.configuration_panel_change_task_id'), - }} - /> -
+ , + label: t('process_editor.configuration_panel_change_task_id'), + value: bpmnDetails.id, + onBlur: (event) => handleOnTaskIdBlur(event), + size: 'small', + }} + viewProps={{ + className: classes.view, + children: ( + + ID: {bpmnDetails.id} + + ), + value: bpmnDetails.id, + variant: 'tertiary', + 'aria-label': t('process_editor.configuration_panel_change_task_id'), + }} + /> ); }; diff --git a/frontend/packages/process-editor/src/components/ConfigPanel/ConfigPanel.test.tsx b/frontend/packages/process-editor/src/components/ConfigPanel/ConfigPanel.test.tsx index d48020379c6..05e9973a709 100644 --- a/frontend/packages/process-editor/src/components/ConfigPanel/ConfigPanel.test.tsx +++ b/frontend/packages/process-editor/src/components/ConfigPanel/ConfigPanel.test.tsx @@ -4,29 +4,21 @@ import { render, screen } from '@testing-library/react'; import { textMock } from '../../../../../testing/mocks/i18nMock'; import type { BpmnContextProps } from '../../contexts/BpmnContext'; import { BpmnContext } from '../../contexts/BpmnContext'; -import type { BpmnDetails } from '../../types/BpmnDetails'; import { BpmnTypeEnum } from '../../enum/BpmnTypeEnum'; import { BpmnConfigPanelFormContextProvider } from '../../contexts/BpmnConfigPanelContext'; import type Modeler from 'bpmn-js/lib/Modeler'; import { shouldDisplayFeature } from 'app-shared/utils/featureToggleUtils'; import { BpmnApiContextProvider } from '../../contexts/BpmnApiContext'; +import { mockBpmnDetails } from '../../../test/mocks/bpmnDetailsMock'; jest.mock('app-shared/utils/featureToggleUtils', () => ({ shouldDisplayFeature: jest.fn().mockReturnValue(false), })); -const mockBpmnDetails: BpmnDetails = { - id: 'testId', - name: 'testName', - taskType: 'data', - type: BpmnTypeEnum.Task, -}; - describe('ConfigPanel', () => { - beforeEach(() => { - jest.resetAllMocks(); + afterEach(() => { + jest.clearAllMocks(); }); - it('should render no selected task message', () => { renderConfigPanel({ bpmnDetails: null }); const title = screen.getByRole('heading', { @@ -78,6 +70,7 @@ describe('ConfigPanel', () => { expectedText: 'process_editor.configuration_panel_element_not_supported_message', }, ])('should display correct message based on selected bpmn type', ({ task, expectedText }) => { + (shouldDisplayFeature as jest.Mock).mockReturnValue(false); renderConfigPanel({ modelerRef: { current: '' as unknown as Modeler }, bpmnDetails: { ...mockBpmnDetails, type: task }, diff --git a/frontend/packages/process-editor/src/components/ConfigSurface/ConfigSurface.module.css b/frontend/packages/process-editor/src/components/ConfigSurface/ConfigSurface.module.css index 542eb082c65..d7c1edc7b30 100644 --- a/frontend/packages/process-editor/src/components/ConfigSurface/ConfigSurface.module.css +++ b/frontend/packages/process-editor/src/components/ConfigSurface/ConfigSurface.module.css @@ -2,4 +2,5 @@ width: 100%; background-color: var(--fds-semantic-surface-neutral-default); border-left: 1px solid var(--fds-semantic-border-neutral-subtle); + overflow-y: scroll; } diff --git a/frontend/packages/process-editor/src/extensions/altinnCustomTasks.ts b/frontend/packages/process-editor/src/extensions/altinnCustomTasks.ts index a20983652a6..4eacdda2a59 100644 --- a/frontend/packages/process-editor/src/extensions/altinnCustomTasks.ts +++ b/frontend/packages/process-editor/src/extensions/altinnCustomTasks.ts @@ -18,6 +18,7 @@ export const altinnCustomTasks = { { name: 'actions', isMany: false, + isAttr: false, type: 'Actions', }, { diff --git a/frontend/packages/process-editor/src/hooks/useBpmnEditor.test.tsx b/frontend/packages/process-editor/src/hooks/useBpmnEditor.test.tsx index e028c15c7f9..212807fb5ba 100644 --- a/frontend/packages/process-editor/src/hooks/useBpmnEditor.test.tsx +++ b/frontend/packages/process-editor/src/hooks/useBpmnEditor.test.tsx @@ -9,15 +9,10 @@ import type { BpmnDetails } from '../types/BpmnDetails'; import { BpmnTypeEnum } from '../enum/BpmnTypeEnum'; import type { BpmnTaskType } from '../types/BpmnTaskType'; import type { LayoutSets } from 'app-shared/types/api/LayoutSetsResponse'; +import { mockBpmnDetails, mockBpmnElement } from '../../test/mocks/bpmnDetailsMock'; const taskId = 'testId'; const layoutSetId = 'someLayoutSetId'; -const bpmnDetailsMock: BpmnDetails = { - id: taskId, - name: 'mockName', - type: BpmnTypeEnum.Task, - taskType: 'data', -}; const layoutSetsMock: LayoutSets = { sets: [ @@ -41,7 +36,7 @@ class BpmnModelerMockImpl { } on(eventName: string, listener: (event: any) => void) { if (eventName === this._currentEventName) { - listener({ element: 'someElement' }); + listener({ element: mockBpmnElement }); } } get(elementName: string) { @@ -129,11 +124,11 @@ describe('useBpmnEditor', () => { expect(addLayoutSetMock).toHaveBeenCalledTimes(1); expect(addLayoutSetMock).toHaveBeenCalledWith({ - layoutSetIdToUpdate: bpmnDetailsMock.id, - layoutSetConfig: { id: bpmnDetailsMock.id, tasks: [bpmnDetailsMock.id] }, + layoutSetIdToUpdate: mockBpmnDetails.id, + layoutSetConfig: { id: mockBpmnDetails.id, tasks: [mockBpmnDetails.id] }, }); expect(setBpmnDetailsMock).toHaveBeenCalledTimes(1); - expect(setBpmnDetailsMock).toHaveBeenCalledWith(bpmnDetailsMock); + expect(setBpmnDetailsMock).toHaveBeenCalledWith(mockBpmnDetails); }); it.each(['confirmation', 'signing', 'feedback', 'endEvent'])( @@ -144,6 +139,7 @@ describe('useBpmnEditor', () => { name: 'mockName', type: BpmnTypeEnum.Task, taskType: taskType, + element: mockBpmnElement, }; const currentEventName = 'shape.add'; renderUseBpmnEditor(true, currentEventName, mockBpmnDetailsNotData); @@ -193,17 +189,14 @@ describe('useBpmnEditor', () => { renderUseBpmnEditor(true, currentEventName); expect(setBpmnDetailsMock).toHaveBeenCalledTimes(1); - expect(setBpmnDetailsMock).toHaveBeenCalledWith({ - ...bpmnDetailsMock, - element: 'someElement', - }); + expect(setBpmnDetailsMock).toHaveBeenCalledWith(mockBpmnDetails); }); }); const renderUseBpmnEditor = ( overrideBpmnContext: boolean, currentEventName: string, - bpmnDetails = bpmnDetailsMock, + bpmnDetails = mockBpmnDetails, ) => { overrideBpmnContext && overrideUseBpmnContext(); overrideGetBpmnEditorDetailsFromBusinessObject(bpmnDetails); diff --git a/frontend/packages/process-editor/src/hooks/useBpmnEditor.ts b/frontend/packages/process-editor/src/hooks/useBpmnEditor.ts index 08a1e14ae84..75fc4db1d93 100644 --- a/frontend/packages/process-editor/src/hooks/useBpmnEditor.ts +++ b/frontend/packages/process-editor/src/hooks/useBpmnEditor.ts @@ -31,7 +31,10 @@ export const useBpmnEditor = (): UseBpmnViewerResult => { const handleShapeAdd = (e) => { const bpmnDetails = getBpmnEditorDetailsFromBusinessObject(e?.element?.businessObject); - setBpmnDetails(bpmnDetails); + setBpmnDetails({ + ...bpmnDetails, + element: e.element, + }); if (bpmnDetails.taskType === 'data') { addLayoutSet({ layoutSetIdToUpdate: bpmnDetails.id, diff --git a/frontend/packages/process-editor/src/types/BpmnTaskType.ts b/frontend/packages/process-editor/src/types/BpmnTaskType.ts index 9536c78ba79..61c50b5e387 100644 --- a/frontend/packages/process-editor/src/types/BpmnTaskType.ts +++ b/frontend/packages/process-editor/src/types/BpmnTaskType.ts @@ -1 +1,7 @@ -export type BpmnTaskType = 'data' | 'confirmation' | 'feedback' | 'signing' | 'endEvent'; +export type BpmnTaskType = + | 'data' + | 'confirmation' + | 'feedback' + | 'signing' + | 'payment' + | 'endEvent'; diff --git a/frontend/packages/process-editor/src/utils/hookUtils/hookUtils.test.ts b/frontend/packages/process-editor/src/utils/hookUtils/hookUtils.test.ts index cf494df7784..4a27b873823 100644 --- a/frontend/packages/process-editor/src/utils/hookUtils/hookUtils.test.ts +++ b/frontend/packages/process-editor/src/utils/hookUtils/hookUtils.test.ts @@ -11,6 +11,7 @@ import { getBpmnViewerDetailsFromBusinessObject, getLayoutSetIdFromTaskId, } from './hookUtils'; +import { mockBpmnDetails } from '../../../test/mocks/bpmnDetailsMock'; describe('hookUtils', () => { afterEach(jest.clearAllMocks); @@ -111,14 +112,6 @@ describe('hookUtils', () => { }); }); - const mockTaskId = 'mockId'; - const bpmnDetailsMock: BpmnDetails = { - id: mockTaskId, - name: 'mockName', - type: BpmnTypeEnum.Task, - taskType: 'data', - }; - const layoutSets = { sets: [ { id: 'layoutSet1', tasks: ['task1'] }, @@ -128,18 +121,18 @@ describe('hookUtils', () => { describe('getLayoutSetIdFromTaskId', () => { it('should return the layout set id corresponding to the task id', () => { - const result = getLayoutSetIdFromTaskId({ ...bpmnDetailsMock, id: 'task1' }, layoutSets); + const result = getLayoutSetIdFromTaskId({ ...mockBpmnDetails, id: 'task1' }, layoutSets); expect(result).toBe('layoutSet1'); }); it('should return undefined if task id does not exist in any layout set', () => { - const result = getLayoutSetIdFromTaskId(bpmnDetailsMock, layoutSets); + const result = getLayoutSetIdFromTaskId(mockBpmnDetails, layoutSets); expect(result).toBeUndefined(); }); it('should return undefined if layout sets are empty', () => { const layoutSets = { sets: [] }; - const result = getLayoutSetIdFromTaskId(bpmnDetailsMock, layoutSets); + const result = getLayoutSetIdFromTaskId(mockBpmnDetails, layoutSets); expect(result).toBeUndefined(); }); }); diff --git a/frontend/packages/process-editor/src/utils/hookUtils/hookUtils.ts b/frontend/packages/process-editor/src/utils/hookUtils/hookUtils.ts index 89342493069..4a884621c71 100644 --- a/frontend/packages/process-editor/src/utils/hookUtils/hookUtils.ts +++ b/frontend/packages/process-editor/src/utils/hookUtils/hookUtils.ts @@ -12,15 +12,14 @@ export const getBpmnViewerDetailsFromBusinessObject = ( businessObject: BpmnBusinessObjectViewer, ): BpmnDetails => { const bpmnAttrs = businessObject?.$attrs; - const bpmnTasktype = bpmnAttrs ? bpmnAttrs['altinn:tasktype'] : null; + const bpmnTaskType = bpmnAttrs ? bpmnAttrs['altinn:tasktype'] : null; - const bpmnDetails: BpmnDetails = { + return { id: businessObject?.id, name: businessObject?.name, - taskType: bpmnTasktype, + taskType: bpmnTaskType, type: businessObject?.$type, }; - return bpmnDetails; }; /** @@ -37,13 +36,12 @@ export const getBpmnEditorDetailsFromBusinessObject = ( const bpmnAttrs = businessObject.$attrs; const taskTypeFromV7 = bpmnAttrs ? bpmnAttrs['altinn:tasktype'] : null; - const bpmnDetails: BpmnDetails = { + return { id: businessObject?.id, name: businessObject?.name, taskType: taskTypeFromV8 || taskTypeFromV7, type: businessObject?.$type, }; - return bpmnDetails; }; export const getLayoutSetIdFromTaskId = (bpmnDetails: BpmnDetails, layoutSets: LayoutSets) => { diff --git a/frontend/packages/process-editor/test/mocks/bpmnContextMock.ts b/frontend/packages/process-editor/test/mocks/bpmnContextMock.ts new file mode 100644 index 00000000000..49cc919430a --- /dev/null +++ b/frontend/packages/process-editor/test/mocks/bpmnContextMock.ts @@ -0,0 +1,45 @@ +import type { BpmnContextProps } from '../../src/contexts/BpmnContext'; +import { mockBpmnDetails } from './bpmnDetailsMock'; +import type { BpmnApiContextProps } from '../../src/contexts/BpmnApiContext'; +import { mockModelerRef } from './bpmnModelerMock'; +import type { LayoutSets } from 'app-shared/types/api/LayoutSetsResponse'; + +const mockBPMNXML: string = ``; +const mockAppLibVersion8: string = '8.0.3'; + +export const mockBpmnContextValue: BpmnContextProps = { + bpmnXml: mockBPMNXML, + appLibVersion: mockAppLibVersion8, + getUpdatedXml: jest.fn(), + isEditAllowed: true, + bpmnDetails: mockBpmnDetails, + setBpmnDetails: jest.fn(), + modelerRef: mockModelerRef as any, +}; + +export const mockLayoutSets: LayoutSets = { + sets: [ + { + id: 'testId', + dataType: 'layoutSetId1', + tasks: ['testId'], + }, + { + id: 'layoutSetId2', + dataType: 'layoutSetId2', + tasks: ['Task_2'], + }, + ], +}; + +export const mockBpmnApiContextValue: BpmnApiContextProps = { + layoutSets: mockLayoutSets, + pendingApiOperations: false, + existingCustomReceiptLayoutSetName: undefined, + availableDataModelIds: [], + addLayoutSet: jest.fn(), + deleteLayoutSet: jest.fn(), + mutateDataType: jest.fn(), + mutateLayoutSet: jest.fn(), + saveBpmn: jest.fn(), +}; diff --git a/frontend/packages/process-editor/test/mocks/bpmnDetailsMock.ts b/frontend/packages/process-editor/test/mocks/bpmnDetailsMock.ts new file mode 100644 index 00000000000..a597a1111ae --- /dev/null +++ b/frontend/packages/process-editor/test/mocks/bpmnDetailsMock.ts @@ -0,0 +1,79 @@ +import type { BpmnDetails } from '../../src/types/BpmnDetails'; +import { BpmnTypeEnum } from '../../src/enum/BpmnTypeEnum'; +import type { ModdleElement } from 'bpmn-js/lib/model/Types'; + +export const mockBpmnId: string = 'testId'; +export const mockBpmnName: string = 'testName'; + +export const mockBpmnElement: ModdleElement = { + businessObject: { + extensionElements: { + values: [ + { + actions: { + action: [ + { + action: 'write', + }, + { + action: 'myServerAction', + type: 'serverAction', + }, + { + action: 'myProcessAction', + type: 'processAction', + }, + ], + }, + }, + ], + }, + }, +}; + +export const mockBpmnDetails: BpmnDetails = { + id: mockBpmnId, + name: mockBpmnName, + taskType: 'data', + type: BpmnTypeEnum.Task, + element: mockBpmnElement, +}; + +export const confirmationActions = { + actions: { + action: [ + { + action: 'confirm', + }, + ], + }, +}; + +export const signingActions = { + actions: { + action: [ + { + action: 'sign', + }, + { + action: 'reject', + }, + ], + }, +}; + +export const paymentActions = { + actions: { + action: [ + { + action: 'pay', + }, + { + action: 'reject', + }, + { + action: 'confirm', + }, + ], + }, +}; diff --git a/frontend/packages/process-editor/test/mocks/bpmnModelerMock.ts b/frontend/packages/process-editor/test/mocks/bpmnModelerMock.ts new file mode 100644 index 00000000000..2306238951c --- /dev/null +++ b/frontend/packages/process-editor/test/mocks/bpmnModelerMock.ts @@ -0,0 +1,17 @@ +export const updatePropertiesMock = jest.fn(); +export const updateModdlePropertiesMock = jest.fn(); +export const createMock = jest.fn(); + +export const mockModelerRef = { + current: { + get: () => ({ + ...modelingMock, + create: createMock, + }), + }, +}; + +export const modelingMock = { + updateProperties: updatePropertiesMock, + updateModdleProperties: updateModdlePropertiesMock, +}; From 10c7c0405c0cdbe11ff324f955cc2bf53e6032d4 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Mon, 13 May 2024 08:09:21 +0200 Subject: [PATCH 10/11] fix(deps): update dependency react-content-loader to v7 (#12792) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- frontend/packages/shared/package.json | 2 +- yarn.lock | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/frontend/packages/shared/package.json b/frontend/packages/shared/package.json index 509bcef2ea6..c57e974bb7e 100644 --- a/frontend/packages/shared/package.json +++ b/frontend/packages/shared/package.json @@ -9,7 +9,7 @@ "classnames": "2.5.1", "qs": "6.12.1", "react": "18.3.1", - "react-content-loader": "6.2.1", + "react-content-loader": "7.0.0", "react-dnd": "16.0.1", "react-dnd-html5-backend": "16.0.1", "react-dom": "18.3.1", diff --git a/yarn.lock b/yarn.lock index f1b31cf601a..de2cd33dee1 100644 --- a/yarn.lock +++ b/yarn.lock @@ -8761,7 +8761,7 @@ __metadata: jest: "npm:29.7.0" qs: "npm:6.12.1" react: "npm:18.3.1" - react-content-loader: "npm:6.2.1" + react-content-loader: "npm:7.0.0" react-dnd: "npm:16.0.1" react-dnd-html5-backend: "npm:16.0.1" react-dom: "npm:18.3.1" @@ -18940,12 +18940,12 @@ __metadata: languageName: node linkType: hard -"react-content-loader@npm:6.2.1": - version: 6.2.1 - resolution: "react-content-loader@npm:6.2.1" +"react-content-loader@npm:7.0.0": + version: 7.0.0 + resolution: "react-content-loader@npm:7.0.0" peerDependencies: react: ">=16.0.0" - checksum: 10/9a59fa25ab5418800c40eec5a1cd7c0bb14bab9654326288370240271e6591f0a921938a08ca01f3dc6c69df909622b9e8ed0992bcf255616cfa83d9c22f4285 + checksum: 10/1f1e5e0e39c3ff627964998b10c590b5252de11f838a74e8338dc1af191f540b4831d91657bccdb3df3b807ec39eee11691dc7870535427c9afd5ec5c73cfcd1 languageName: node linkType: hard From b477008d3ae72bcf0a05f60c91bf9fa77e7d959e Mon Sep 17 00:00:00 2001 From: andreastanderen <71079896+standeren@users.noreply.github.com> Date: Mon, 13 May 2024 11:45:20 +0200 Subject: [PATCH 11/11] 12696 automatically add payment data type to applicationmetadata when adding payment task (#12776) * Add/delete dataType when taskType is payment or signing * Support multiple data types for multiple payment or signing tasks * Fix PR comments --- .../Controllers/ProcessModelingController.cs | 18 ++ .../ProcessModeling/ProcessModelingService.cs | 29 +++ .../Interfaces/IProcessModelingService.cs | 20 +++ .../AddDataTypeToApplicationMetadataTests.cs | 78 ++++++++ ...eteDataTypeFromApplicationMetadataTests.cs | 44 +++++ .../features/processEditor/ProcessEditor.tsx | 6 + .../useAddDataTypeToAppMetadata.test.ts | 23 +++ .../mutations/useAddDataTypeToAppMetadata.ts | 11 ++ .../useDeleteDataTypeFromAppMetadata.test.ts | 23 +++ .../useDeleteDataTypeFromAppMetadata.ts | 11 ++ frontend/language/src/nb.json | 1 + .../process-editor/src/ProcessEditor.test.tsx | 2 + .../process-editor/src/ProcessEditor.tsx | 6 + .../bpmnProviders/SupportedPaletteProvider.js | 15 +- .../ConfigContent/ConfigIcon/ConfigIcon.tsx | 3 + .../src/contexts/BpmnApiContext.tsx | 10 +- .../src/extensions/altinnCustomTasks.ts | 30 +++- .../src/hooks/useBpmnEditor.test.tsx | 166 ++++++++++++++---- .../process-editor/src/hooks/useBpmnEditor.ts | 42 ++++- .../src/utils/hookUtils/hookUtils.ts | 21 +++ .../test/mocks/bpmnContextMock.ts | 4 +- .../test/mocks/bpmnDetailsMock.ts | 60 ++++++- frontend/packages/shared/src/api/mutations.ts | 4 + frontend/packages/shared/src/api/paths.js | 1 + .../packages/shared/src/mocks/queriesMock.ts | 2 + 25 files changed, 582 insertions(+), 48 deletions(-) create mode 100644 backend/tests/Designer.Tests/Controllers/ProcessModelingController/AddDataTypeToApplicationMetadataTests.cs create mode 100644 backend/tests/Designer.Tests/Controllers/ProcessModelingController/DeleteDataTypeFromApplicationMetadataTests.cs create mode 100644 frontend/app-development/hooks/mutations/useAddDataTypeToAppMetadata.test.ts create mode 100644 frontend/app-development/hooks/mutations/useAddDataTypeToAppMetadata.ts create mode 100644 frontend/app-development/hooks/mutations/useDeleteDataTypeFromAppMetadata.test.ts create mode 100644 frontend/app-development/hooks/mutations/useDeleteDataTypeFromAppMetadata.ts diff --git a/backend/src/Designer/Controllers/ProcessModelingController.cs b/backend/src/Designer/Controllers/ProcessModelingController.cs index d60d59a0933..901c1b8d81d 100644 --- a/backend/src/Designer/Controllers/ProcessModelingController.cs +++ b/backend/src/Designer/Controllers/ProcessModelingController.cs @@ -146,5 +146,23 @@ await _processModelingService.SaveProcessDefinitionFromTemplateAsync(editingCont Stream processDefinitionStream = _processModelingService.GetProcessDefinitionStream(editingContext); return new FileStreamResult(processDefinitionStream, MediaTypeNames.Text.Plain); } + + [HttpPost("data-type/{dataTypeId}")] + public async Task AddDataTypeToApplicationMetadata(string org, string repo, [FromRoute] string dataTypeId, CancellationToken cancellationToken) + { + string developer = AuthenticationHelper.GetDeveloperUserName(HttpContext); + var editingContext = AltinnRepoEditingContext.FromOrgRepoDeveloper(org, repo, developer); + await _processModelingService.AddDataTypeToApplicationMetadataAsync(editingContext, dataTypeId, cancellationToken); + return Ok(); + } + + [HttpDelete("data-type/{dataTypeId}")] + public async Task DeleteDataTypeFromApplicationMetadata(string org, string repo, [FromRoute] string dataTypeId, CancellationToken cancellationToken) + { + string developer = AuthenticationHelper.GetDeveloperUserName(HttpContext); + var editingContext = AltinnRepoEditingContext.FromOrgRepoDeveloper(org, repo, developer); + await _processModelingService.DeleteDataTypeFromApplicationMetadataAsync(editingContext, dataTypeId, cancellationToken); + return Ok(); + } } } diff --git a/backend/src/Designer/Services/Implementation/ProcessModeling/ProcessModelingService.cs b/backend/src/Designer/Services/Implementation/ProcessModeling/ProcessModelingService.cs index 9dcf3dcfd96..bc6a43d8bbc 100644 --- a/backend/src/Designer/Services/Implementation/ProcessModeling/ProcessModelingService.cs +++ b/backend/src/Designer/Services/Implementation/ProcessModeling/ProcessModelingService.cs @@ -4,8 +4,10 @@ using System.Linq; using System.Threading; using System.Threading.Tasks; +using Altinn.Platform.Storage.Interface.Models; using Altinn.Studio.Designer.Infrastructure.GitRepository; using Altinn.Studio.Designer.Models; +using Altinn.Studio.Designer.Models.App; using Altinn.Studio.Designer.Services.Interfaces; using NuGet.Versioning; @@ -53,6 +55,33 @@ public Stream GetProcessDefinitionStream(AltinnRepoEditingContext altinnRepoEdit return altinnAppGitRepository.GetProcessDefinitionFile(); } + public async Task AddDataTypeToApplicationMetadataAsync(AltinnRepoEditingContext altinnRepoEditingContext, string dataTypeId, CancellationToken cancellationToken = default) + { + cancellationToken.ThrowIfCancellationRequested(); + AltinnAppGitRepository altinnAppGitRepository = _altinnGitRepositoryFactory.GetAltinnAppGitRepository(altinnRepoEditingContext.Org, altinnRepoEditingContext.Repo, altinnRepoEditingContext.Developer); + ApplicationMetadata applicationMetadata = await altinnAppGitRepository.GetApplicationMetadata(cancellationToken); + if (!applicationMetadata.DataTypes.Exists(dataType => dataType.Id == dataTypeId)) + { + applicationMetadata.DataTypes.Add(new DataType + { + Id = dataTypeId, + AllowedContentTypes = ["application/json"], + MaxCount = 1, + EnablePdfCreation = false + }); + await altinnAppGitRepository.SaveApplicationMetadata(applicationMetadata); + } + } + + public async Task DeleteDataTypeFromApplicationMetadataAsync(AltinnRepoEditingContext altinnRepoEditingContext, string dataTypeId, CancellationToken cancellationToken = default) + { + cancellationToken.ThrowIfCancellationRequested(); + AltinnAppGitRepository altinnAppGitRepository = _altinnGitRepositoryFactory.GetAltinnAppGitRepository(altinnRepoEditingContext.Org, altinnRepoEditingContext.Repo, altinnRepoEditingContext.Developer); + ApplicationMetadata applicationMetadata = await altinnAppGitRepository.GetApplicationMetadata(cancellationToken); + applicationMetadata.DataTypes.RemoveAll(dataType => dataType.Id == dataTypeId); + await altinnAppGitRepository.SaveApplicationMetadata(applicationMetadata); + } + private IEnumerable EnumerateTemplateResources(SemanticVersion version) { return typeof(ProcessModelingService).Assembly.GetManifestResourceNames() diff --git a/backend/src/Designer/Services/Interfaces/IProcessModelingService.cs b/backend/src/Designer/Services/Interfaces/IProcessModelingService.cs index 85d38e079cb..980011d9195 100644 --- a/backend/src/Designer/Services/Interfaces/IProcessModelingService.cs +++ b/backend/src/Designer/Services/Interfaces/IProcessModelingService.cs @@ -39,5 +39,25 @@ public interface IProcessModelingService /// An . /// A of a process definition file. Stream GetProcessDefinitionStream(AltinnRepoEditingContext altinnRepoEditingContext); + + /// + /// Adds a simple dataType to applicationMetadata. + /// Used for adding a dataType when signing and payment tasks are added to the process. + /// + /// An . + /// Id for the added data type + /// A that observes if operation is cancelled. + Task AddDataTypeToApplicationMetadataAsync(AltinnRepoEditingContext altinnRepoEditingContext, + string dataTypeId, CancellationToken cancellationToken = default); + + /// + /// Deletes a simple dataType from applicationMetadata. + /// Used for deleting a dataType when signing and payment tasks are removed from the process. + /// + /// An . + /// Id for the data type to remove + /// A that observes if operation is cancelled. + Task DeleteDataTypeFromApplicationMetadataAsync(AltinnRepoEditingContext altinnRepoEditingContext, + string dataTypeId, CancellationToken cancellationToken = default); } } diff --git a/backend/tests/Designer.Tests/Controllers/ProcessModelingController/AddDataTypeToApplicationMetadataTests.cs b/backend/tests/Designer.Tests/Controllers/ProcessModelingController/AddDataTypeToApplicationMetadataTests.cs new file mode 100644 index 00000000000..508c72059e0 --- /dev/null +++ b/backend/tests/Designer.Tests/Controllers/ProcessModelingController/AddDataTypeToApplicationMetadataTests.cs @@ -0,0 +1,78 @@ +using System.Collections.Generic; +using System.Net; +using System.Net.Http; +using System.Text.Json; +using System.Threading.Tasks; +using Altinn.Platform.Storage.Interface.Models; +using Designer.Tests.Controllers.ApiTests; +using Designer.Tests.Utils; +using FluentAssertions; +using Microsoft.AspNetCore.Mvc.Testing; +using Xunit; + +namespace Designer.Tests.Controllers.ProcessModelingController +{ + public class AddDataTypeToApplicationMetadataTests : DisagnerEndpointsTestsBase, IClassFixture> + { + private static string VersionPrefix(string org, string repository, string dataTypeId) => $"/designer/api/{org}/{repository}/process-modelling/data-type/{dataTypeId}"; + + public AddDataTypeToApplicationMetadataTests(WebApplicationFactory factory) : base(factory) + { + } + + [Theory] + [InlineData("ttd", "empty-app", "testUser", "paymentInformation-1234")] + public async Task AddDataTypeToApplicationMetadata_ShouldAddDataTypeAndReturnOK(string org, string app, string developer, string dataTypeId) + { + string targetRepository = TestDataHelper.GenerateTestRepoName(); + await CopyRepositoryForTest(org, app, developer, targetRepository); + string url = VersionPrefix(org, targetRepository, dataTypeId); + + using var request = new HttpRequestMessage(HttpMethod.Post, url); + using var response = await HttpClient.SendAsync(request); + response.StatusCode.Should().Be(HttpStatusCode.OK); + + string appMetadataString = TestDataHelper.GetFileFromRepo(org, targetRepository, developer, "App/config/applicationmetadata.json"); + Application appMetadata = JsonSerializer.Deserialize(appMetadataString, new JsonSerializerOptions + { + PropertyNameCaseInsensitive = true + }); + DataType expectedDataType = new() + { + Id = dataTypeId, + AllowedContentTypes = new List() { "application/json" }, + MaxCount = 1, + MinCount = 0, + EnablePdfCreation = false, + EnableFileScan = false, + ValidationErrorOnPendingFileScan = false, + EnabledFileAnalysers = new List(), + EnabledFileValidators = new List() + }; + + appMetadata.DataTypes.Count.Should().Be(2); + appMetadata.DataTypes.Find(dataType => dataType.Id == dataTypeId).Should().BeEquivalentTo(expectedDataType); + } + + [Theory] + [InlineData("ttd", "empty-app", "testUser", "ref-data-as-pdf")] + public async Task AddDataTypeToApplicationMetadataWhenExists_ShouldNotAddDataTypeAndReturnOK(string org, string app, string developer, string dataTypeId) + { + string targetRepository = TestDataHelper.GenerateTestRepoName(); + await CopyRepositoryForTest(org, app, developer, targetRepository); + string url = VersionPrefix(org, targetRepository, dataTypeId); + using var request = new HttpRequestMessage(HttpMethod.Post, url); + using var response = await HttpClient.SendAsync(request); + + response.StatusCode.Should().Be(HttpStatusCode.OK); + + string appMetadataString = TestDataHelper.GetFileFromRepo(org, targetRepository, developer, "App/config/applicationmetadata.json"); + Application appMetadata = JsonSerializer.Deserialize(appMetadataString, new JsonSerializerOptions + { + PropertyNameCaseInsensitive = true + }); + + appMetadata.DataTypes.Count.Should().Be(1); + } + } +} diff --git a/backend/tests/Designer.Tests/Controllers/ProcessModelingController/DeleteDataTypeFromApplicationMetadataTests.cs b/backend/tests/Designer.Tests/Controllers/ProcessModelingController/DeleteDataTypeFromApplicationMetadataTests.cs new file mode 100644 index 00000000000..569883b09e2 --- /dev/null +++ b/backend/tests/Designer.Tests/Controllers/ProcessModelingController/DeleteDataTypeFromApplicationMetadataTests.cs @@ -0,0 +1,44 @@ +using System.Collections.Generic; +using System.Net; +using System.Net.Http; +using System.Text.Json; +using System.Threading.Tasks; +using Altinn.Platform.Storage.Interface.Models; +using Designer.Tests.Controllers.ApiTests; +using Designer.Tests.Utils; +using FluentAssertions; +using Microsoft.AspNetCore.Mvc.Testing; +using Xunit; + +namespace Designer.Tests.Controllers.ProcessModelingController +{ + public class DeleteDataTypeFromApplicationMetadataTests : DisagnerEndpointsTestsBase, IClassFixture> + { + private static string VersionPrefix(string org, string repository, string dataTypeId) => $"/designer/api/{org}/{repository}/process-modelling/data-type/{dataTypeId}"; + + public DeleteDataTypeFromApplicationMetadataTests(WebApplicationFactory factory) : base(factory) + { + } + + [Theory] + [InlineData("ttd", "empty-app", "testUser", "ref-data-as-pdf")] + public async Task DeleteDataTypeFromApplicationMetadata_ShouldDeleteDataTypeAndReturnOK(string org, string app, string developer, string dataTypeId) + { + string targetRepository = TestDataHelper.GenerateTestRepoName(); + await CopyRepositoryForTest(org, app, developer, targetRepository); + string url = VersionPrefix(org, targetRepository, dataTypeId); + + using var request = new HttpRequestMessage(HttpMethod.Delete, url); + using var response = await HttpClient.SendAsync(request); + response.StatusCode.Should().Be(HttpStatusCode.OK); + + string appMetadataString = TestDataHelper.GetFileFromRepo(org, targetRepository, developer, "App/config/applicationmetadata.json"); + Application appMetadata = JsonSerializer.Deserialize(appMetadataString, new JsonSerializerOptions + { + PropertyNameCaseInsensitive = true + }); + + appMetadata.DataTypes.Count.Should().Be(0); + } + } +} diff --git a/frontend/app-development/features/processEditor/ProcessEditor.tsx b/frontend/app-development/features/processEditor/ProcessEditor.tsx index c42fff8aece..760f7c7ba79 100644 --- a/frontend/app-development/features/processEditor/ProcessEditor.tsx +++ b/frontend/app-development/features/processEditor/ProcessEditor.tsx @@ -19,6 +19,8 @@ import { useDeleteLayoutSetMutation } from '../../hooks/mutations/useDeleteLayou import { useAppMetadataModelIdsQuery } from 'app-shared/hooks/queries/useAppMetadataModelIdsQuery'; import { useUpdateProcessDataTypeMutation } from '../../hooks/mutations/useUpdateProcessDataTypeMutation'; import type { MetaDataForm } from 'app-shared/types/BpmnMetaDataForm'; +import { useAddDataTypeToAppMetadata } from '../../hooks/mutations/useAddDataTypeToAppMetadata'; +import { useDeleteDataTypeFromAppMetadata } from '../../hooks/mutations/useDeleteDataTypeFromAppMetadata'; enum SyncClientsName { FileSyncSuccess = 'FileSyncSuccess', @@ -45,6 +47,8 @@ export const ProcessEditor = (): React.ReactElement => { ); const { mutate: mutateDataType, isPending: updateDataTypePending } = useUpdateProcessDataTypeMutation(org, app); + const { mutate: addDataTypeToAppMetadata } = useAddDataTypeToAppMetadata(org, app); + const { mutate: deleteDataTypeFromAppMetadata } = useDeleteDataTypeFromAppMetadata(org, app); const existingCustomReceiptName: string | undefined = useCustomReceiptLayoutSetName(org, app); const { data: availableDataModelIds, isPending: availableDataModelIdsPending } = useAppMetadataModelIdsQuery(org, app); @@ -109,6 +113,8 @@ export const ProcessEditor = (): React.ReactElement => { appLibVersion={appLibData.backendVersion} bpmnXml={hasBpmnQueryError ? null : bpmnXml} mutateDataType={mutateDataType} + addDataTypeToAppMetadata={addDataTypeToAppMetadata} + deleteDataTypeFromAppMetadata={deleteDataTypeFromAppMetadata} saveBpmn={saveBpmnXml} /> ); diff --git a/frontend/app-development/hooks/mutations/useAddDataTypeToAppMetadata.test.ts b/frontend/app-development/hooks/mutations/useAddDataTypeToAppMetadata.test.ts new file mode 100644 index 00000000000..589ebe4bbce --- /dev/null +++ b/frontend/app-development/hooks/mutations/useAddDataTypeToAppMetadata.test.ts @@ -0,0 +1,23 @@ +import { renderHookWithMockStore } from '../../test/mocks'; +import { queriesMock } from 'app-shared/mocks/queriesMock'; +import { waitFor } from '@testing-library/react'; +import { useAddDataTypeToAppMetadata } from './useAddDataTypeToAppMetadata'; + +const org = 'org'; +const app = 'app'; +const dataTypeId = 'paymentInformation-1234'; + +describe('useAddDataTypeToAppMetadata', () => { + it('Calls addDataTypeToAppMetadata with correct arguments and payload', async () => { + const addDataTypeToAppMetadata = renderHookWithMockStore()(() => + useAddDataTypeToAppMetadata(org, app), + ).renderHookResult.result; + await addDataTypeToAppMetadata.current.mutateAsync({ + dataTypeId, + }); + await waitFor(() => expect(addDataTypeToAppMetadata.current.isSuccess).toBe(true)); + + expect(queriesMock.addDataTypeToAppMetadata).toHaveBeenCalledTimes(1); + expect(queriesMock.addDataTypeToAppMetadata).toHaveBeenCalledWith(org, app, dataTypeId); + }); +}); diff --git a/frontend/app-development/hooks/mutations/useAddDataTypeToAppMetadata.ts b/frontend/app-development/hooks/mutations/useAddDataTypeToAppMetadata.ts new file mode 100644 index 00000000000..832e37fe995 --- /dev/null +++ b/frontend/app-development/hooks/mutations/useAddDataTypeToAppMetadata.ts @@ -0,0 +1,11 @@ +import { useMutation } from '@tanstack/react-query'; +import { useServicesContext } from 'app-shared/contexts/ServicesContext'; + +export const useAddDataTypeToAppMetadata = (org: string, app: string) => { + const { addDataTypeToAppMetadata } = useServicesContext(); + + return useMutation({ + mutationFn: ({ dataTypeId }: { dataTypeId: string }) => + addDataTypeToAppMetadata(org, app, dataTypeId), + }); +}; diff --git a/frontend/app-development/hooks/mutations/useDeleteDataTypeFromAppMetadata.test.ts b/frontend/app-development/hooks/mutations/useDeleteDataTypeFromAppMetadata.test.ts new file mode 100644 index 00000000000..f46791a34ac --- /dev/null +++ b/frontend/app-development/hooks/mutations/useDeleteDataTypeFromAppMetadata.test.ts @@ -0,0 +1,23 @@ +import { renderHookWithMockStore } from '../../test/mocks'; +import { queriesMock } from 'app-shared/mocks/queriesMock'; +import { useDeleteDataTypeFromAppMetadata } from './useDeleteDataTypeFromAppMetadata'; +import { waitFor } from '@testing-library/react'; + +const org = 'org'; +const app = 'app'; +const dataTypeId = 'paymentInformation-1234'; + +describe('useDeleteDataTypeFromAppMetadata', () => { + it('Calls deleteDataTypeFromAppMetadata with correct arguments and payload', async () => { + const deleteDataTypeFromAppMetadata = renderHookWithMockStore()(() => + useDeleteDataTypeFromAppMetadata(org, app), + ).renderHookResult.result; + await deleteDataTypeFromAppMetadata.current.mutateAsync({ + dataTypeId, + }); + await waitFor(() => expect(deleteDataTypeFromAppMetadata.current.isSuccess).toBe(true)); + + expect(queriesMock.deleteDataTypeFromAppMetadata).toHaveBeenCalledTimes(1); + expect(queriesMock.deleteDataTypeFromAppMetadata).toHaveBeenCalledWith(org, app, dataTypeId); + }); +}); diff --git a/frontend/app-development/hooks/mutations/useDeleteDataTypeFromAppMetadata.ts b/frontend/app-development/hooks/mutations/useDeleteDataTypeFromAppMetadata.ts new file mode 100644 index 00000000000..cd87e4328ae --- /dev/null +++ b/frontend/app-development/hooks/mutations/useDeleteDataTypeFromAppMetadata.ts @@ -0,0 +1,11 @@ +import { useMutation } from '@tanstack/react-query'; +import { useServicesContext } from 'app-shared/contexts/ServicesContext'; + +export const useDeleteDataTypeFromAppMetadata = (org: string, app: string) => { + const { deleteDataTypeFromAppMetadata } = useServicesContext(); + + return useMutation({ + mutationFn: ({ dataTypeId }: { dataTypeId: string }) => + deleteDataTypeFromAppMetadata(org, app, dataTypeId), + }); +}; diff --git a/frontend/language/src/nb.json b/frontend/language/src/nb.json index 99f6fd280f9..c3f99dcd389 100644 --- a/frontend/language/src/nb.json +++ b/frontend/language/src/nb.json @@ -776,6 +776,7 @@ "process_editor.configuration_panel_name_label": "Navn: ", "process_editor.configuration_panel_no_task_message": "Velg en oppgave i diagrammet til venstre for å se detaljer om valgt oppgave.", "process_editor.configuration_panel_no_task_title": "Ingen oppgave er valgt", + "process_editor.configuration_panel_payment_task": "Oppgave: Betaling", "process_editor.configuration_panel_select_datamodel": "Velg en datamodell", "process_editor.configuration_panel_set_datamodel": "Datamodell:", "process_editor.configuration_panel_set_datamodel_link": "Legg til datamodell", diff --git a/frontend/packages/process-editor/src/ProcessEditor.test.tsx b/frontend/packages/process-editor/src/ProcessEditor.test.tsx index b6665b08429..0b140751d16 100644 --- a/frontend/packages/process-editor/src/ProcessEditor.test.tsx +++ b/frontend/packages/process-editor/src/ProcessEditor.test.tsx @@ -22,6 +22,8 @@ const defaultProps: ProcessEditorProps = { deleteLayoutSet: jest.fn(), mutateLayoutSet: jest.fn(), mutateDataType: jest.fn(), + addDataTypeToAppMetadata: jest.fn(), + deleteDataTypeFromAppMetadata: jest.fn(), }; const renderProcessEditor = (bpmnXml: string) => { diff --git a/frontend/packages/process-editor/src/ProcessEditor.tsx b/frontend/packages/process-editor/src/ProcessEditor.tsx index cc9a8e3754b..bedcb25574a 100644 --- a/frontend/packages/process-editor/src/ProcessEditor.tsx +++ b/frontend/packages/process-editor/src/ProcessEditor.tsx @@ -24,6 +24,8 @@ export type ProcessEditorProps = { deleteLayoutSet: BpmnApiContextProps['deleteLayoutSet']; mutateLayoutSet: BpmnApiContextProps['mutateLayoutSet']; mutateDataType: BpmnApiContextProps['mutateDataType']; + addDataTypeToAppMetadata: BpmnApiContextProps['addDataTypeToAppMetadata']; + deleteDataTypeFromAppMetadata: BpmnApiContextProps['deleteDataTypeFromAppMetadata']; saveBpmn: (bpmnXml: string, metaData?: MetaDataForm) => void; }; @@ -38,6 +40,8 @@ export const ProcessEditor = ({ deleteLayoutSet, mutateLayoutSet, mutateDataType, + addDataTypeToAppMetadata, + deleteDataTypeFromAppMetadata, saveBpmn, }: ProcessEditorProps): JSX.Element => { const { t } = useTranslation(); @@ -61,6 +65,8 @@ export const ProcessEditor = ({ deleteLayoutSet={deleteLayoutSet} mutateLayoutSet={mutateLayoutSet} mutateDataType={mutateDataType} + addDataTypeToAppMetadata={addDataTypeToAppMetadata} + deleteDataTypeFromAppMetadata={deleteDataTypeFromAppMetadata} saveBpmn={saveBpmn} > diff --git a/frontend/packages/process-editor/src/bpmnProviders/SupportedPaletteProvider.js b/frontend/packages/process-editor/src/bpmnProviders/SupportedPaletteProvider.js index 2b33da4ef61..3cdf7df1877 100644 --- a/frontend/packages/process-editor/src/bpmnProviders/SupportedPaletteProvider.js +++ b/frontend/packages/process-editor/src/bpmnProviders/SupportedPaletteProvider.js @@ -1,4 +1,5 @@ import { shouldDisplayFeature } from 'app-shared/utils/featureToggleUtils'; +import { generateRandomId } from 'app-shared/utils/generateRandomId'; const supportedEntries = ['create.exclusive-gateway', 'create.start-event', 'create.end-event']; @@ -58,8 +59,16 @@ class SupportedPaletteProvider { }), signatureConfig: bpmnFactory.create('altinn:SignatureConfig', { dataTypesToSign: bpmnFactory.create('altinn:DataTypesToSign', { - dataType: ['Model'], + dataTypes: [], }), + signatureDataType: bpmnFactory.create( + 'altinn:SignatureDataType', + { + dataType: bpmnFactory.create('altinn:DataType', { + dataType: `signatureInformation-${generateRandomId(4)}`, + }), + }, // What about uniqueFromSignaturesInDataTypes + ), }), }), ], @@ -127,7 +136,9 @@ class SupportedPaletteProvider { }), paymentConfig: bpmnFactory.create('altinn:PaymentConfig', { paymentDataType: bpmnFactory.create('altinn:PaymentDataType', { - dataType: ['paymentInformation'], + dataType: bpmnFactory.create('altinn:DataType', { + dataType: `paymentInformation-${generateRandomId(4)}`, + }), }), }), }), diff --git a/frontend/packages/process-editor/src/components/ConfigPanel/ConfigContent/ConfigIcon/ConfigIcon.tsx b/frontend/packages/process-editor/src/components/ConfigPanel/ConfigContent/ConfigIcon/ConfigIcon.tsx index 2639a4a4500..9267e1adbcf 100644 --- a/frontend/packages/process-editor/src/components/ConfigPanel/ConfigContent/ConfigIcon/ConfigIcon.tsx +++ b/frontend/packages/process-editor/src/components/ConfigPanel/ConfigContent/ConfigIcon/ConfigIcon.tsx @@ -5,6 +5,7 @@ import { ConfirmationTaskIcon, DataTaskIcon, FeedbackTaskIcon, + PaymentTaskIcon, ReceiptIcon, SignTaskIcon, } from '@studio/icons'; @@ -23,6 +24,8 @@ export const ConfigIcon = ({ taskType }: ConfigIconProps): React.ReactElement => return ; case 'signing': return ; + case 'payment': + return ; case 'endEvent': return ; } diff --git a/frontend/packages/process-editor/src/contexts/BpmnApiContext.tsx b/frontend/packages/process-editor/src/contexts/BpmnApiContext.tsx index 5f926e3229b..4dff932dc6c 100644 --- a/frontend/packages/process-editor/src/contexts/BpmnApiContext.tsx +++ b/frontend/packages/process-editor/src/contexts/BpmnApiContext.tsx @@ -11,7 +11,9 @@ export type BpmnApiContextProps = { addLayoutSet: (data: { layoutSetIdToUpdate: string; layoutSetConfig: LayoutSetConfig }) => void; deleteLayoutSet: (data: { layoutSetIdToUpdate: string }) => void; mutateLayoutSet: (data: { layoutSetIdToUpdate: string; newLayoutSetId: string }) => void; - mutateDataType: (dataTypeChange: DataTypeChange) => void; + mutateDataType: (dataTypeId: DataTypeChange) => void; + addDataTypeToAppMetadata: (data: { dataTypeId: string }) => void; + deleteDataTypeFromAppMetadata: (data: { dataTypeId: string }) => void; saveBpmn: (bpmnXml: string, metaData?: MetaDataForm) => void; }; @@ -27,6 +29,8 @@ export type BpmnApiContextProviderProps = { deleteLayoutSet: (data: { layoutSetIdToUpdate: string }) => void; mutateLayoutSet: (data: { layoutSetIdToUpdate: string; newLayoutSetId: string }) => void; mutateDataType: (data: DataTypeChange) => void; + addDataTypeToAppMetadata: (data: { dataTypeId: string }) => void; + deleteDataTypeFromAppMetadata: (data: { dataTypeId: string }) => void; saveBpmn: (bpmnXml: string, metaData?: MetaDataForm) => void; }; export const BpmnApiContextProvider = ({ @@ -39,6 +43,8 @@ export const BpmnApiContextProvider = ({ deleteLayoutSet, mutateLayoutSet, mutateDataType, + addDataTypeToAppMetadata, + deleteDataTypeFromAppMetadata, saveBpmn, }: Partial) => { return ( @@ -52,6 +58,8 @@ export const BpmnApiContextProvider = ({ deleteLayoutSet, mutateLayoutSet, mutateDataType, + addDataTypeToAppMetadata, + deleteDataTypeFromAppMetadata, saveBpmn, }} > diff --git a/frontend/packages/process-editor/src/extensions/altinnCustomTasks.ts b/frontend/packages/process-editor/src/extensions/altinnCustomTasks.ts index 4eacdda2a59..b18b0a541aa 100644 --- a/frontend/packages/process-editor/src/extensions/altinnCustomTasks.ts +++ b/frontend/packages/process-editor/src/extensions/altinnCustomTasks.ts @@ -72,7 +72,7 @@ export const altinnCustomTasks = { { name: 'signatureDataType', isMany: false, - type: 'String', + type: 'SignatureDataType', }, ], }, @@ -90,20 +90,42 @@ export const altinnCustomTasks = { name: 'PaymentDataType', properties: [ { - name: 'paymentType', + name: 'dataType', isMany: false, isAttr: false, - type: 'String', + type: 'DataType', }, ], }, { - name: 'DataTypesToSign', + name: 'SignatureDataType', properties: [ { name: 'dataType', + isMany: false, + isAttr: false, + type: 'DataType', + }, + ], + }, + { + name: 'DataTypesToSign', + properties: [ + { + name: 'dataTypes', isMany: true, isAttr: false, + type: 'DataType', + }, + ], + }, + { + name: 'DataType', + properties: [ + { + name: 'dataType', + isMany: false, + isBody: true, type: 'String', }, ], diff --git a/frontend/packages/process-editor/src/hooks/useBpmnEditor.test.tsx b/frontend/packages/process-editor/src/hooks/useBpmnEditor.test.tsx index 212807fb5ba..fe65708665f 100644 --- a/frontend/packages/process-editor/src/hooks/useBpmnEditor.test.tsx +++ b/frontend/packages/process-editor/src/hooks/useBpmnEditor.test.tsx @@ -6,37 +6,38 @@ import { BpmnApiContextProvider } from '../contexts/BpmnApiContext'; import { useBpmnModeler } from './useBpmnModeler'; import { getBpmnEditorDetailsFromBusinessObject } from '../utils/hookUtils'; import type { BpmnDetails } from '../types/BpmnDetails'; -import { BpmnTypeEnum } from '../enum/BpmnTypeEnum'; import type { BpmnTaskType } from '../types/BpmnTaskType'; import type { LayoutSets } from 'app-shared/types/api/LayoutSetsResponse'; -import { mockBpmnDetails, mockBpmnElement } from '../../test/mocks/bpmnDetailsMock'; +import { getMockBpmnElementForTask, mockBpmnDetails } from '../../test/mocks/bpmnDetailsMock'; +import { mockModelerRef } from '../../test/mocks/bpmnModelerMock'; -const taskId = 'testId'; const layoutSetId = 'someLayoutSetId'; - const layoutSetsMock: LayoutSets = { sets: [ { id: layoutSetId, - tasks: [taskId], + tasks: [mockBpmnDetails.id], }, ], }; class BpmnModelerMockImpl { public readonly _currentEventName: string; + public readonly _currentTaskType: BpmnTaskType; private readonly eventBus: any; - constructor(currentEventName: string) { + constructor(currentEventName: string, currentTaskType: BpmnTaskType) { this._currentEventName = currentEventName; + this._currentTaskType = currentTaskType; this.eventBus = { _currentEventName: this._currentEventName, + _currentTaskType: this._currentTaskType, on: this.on, }; } on(eventName: string, listener: (event: any) => void) { if (eventName === this._currentEventName) { - listener({ element: mockBpmnElement }); + listener({ element: getMockBpmnElementForTask(this._currentTaskType) }); } } get(elementName: string) { @@ -70,7 +71,7 @@ const setBpmnDetailsMock = jest.fn(); const overrideUseBpmnContext = () => { (useBpmnContext as jest.Mock).mockReturnValue({ getUpdatedXml: jest.fn(), - modelerRef: { current: null }, + modelerRef: mockModelerRef, setBpmnDetails: setBpmnDetailsMock, }); }; @@ -79,9 +80,9 @@ jest.mock('./useBpmnModeler', () => ({ useBpmnModeler: jest.fn().mockReturnValue({}), })); -const overrideUseBpmnModeler = (currentEventName: string) => { +const overrideUseBpmnModeler = (currentEventName: string, currentTaskType: BpmnTaskType) => { (useBpmnModeler as jest.Mock).mockReturnValue({ - getModeler: () => new BpmnModelerMockImpl(currentEventName), + getModeler: () => new BpmnModelerMockImpl(currentEventName, currentTaskType), }); }; @@ -94,6 +95,8 @@ const wrapper = ({ children }) => ( @@ -105,6 +108,8 @@ const wrapper = ({ children }) => ( const saveBpmnMock = jest.fn(); const addLayoutSetMock = jest.fn(); const deleteLayoutSetMock = jest.fn(); +const deleteDataTypeFromAppMetadataMock = jest.fn(); +const addDataTypeToAppMetadataMock = jest.fn(); describe('useBpmnEditor', () => { afterEach(() => { @@ -131,18 +136,16 @@ describe('useBpmnEditor', () => { expect(setBpmnDetailsMock).toHaveBeenCalledWith(mockBpmnDetails); }); - it.each(['confirmation', 'signing', 'feedback', 'endEvent'])( - 'should not call saveBpmn when "shape.add" event is triggered on modelerInstance when taskType is not data', + it.each(['confirmation', 'signing', 'payment', 'feedback', 'endEvent'])( + 'should not call addLayoutSet when "shape.add" event is triggered on modelerInstance when taskType is %s', (taskType: BpmnTaskType) => { const mockBpmnDetailsNotData: BpmnDetails = { - id: 'otherTestId', - name: 'mockName', - type: BpmnTypeEnum.Task, - taskType: taskType, - element: mockBpmnElement, + ...mockBpmnDetails, + taskType, + element: getMockBpmnElementForTask(taskType), }; const currentEventName = 'shape.add'; - renderUseBpmnEditor(true, currentEventName, mockBpmnDetailsNotData); + renderUseBpmnEditor(true, currentEventName, taskType, mockBpmnDetailsNotData); expect(addLayoutSetMock).not.toHaveBeenCalled(); expect(setBpmnDetailsMock).toHaveBeenCalledTimes(1); @@ -150,17 +153,16 @@ describe('useBpmnEditor', () => { }, ); - it.each(['data', 'confirmation', 'signing', 'feedback', 'endEvent'])( - 'should call deleteLayoutSet when "shape.remove" event is triggered on modelerInstance and the task has a connected layout set', + it.each(['data', 'confirmation', 'signing', 'payment', 'feedback', 'endEvent'])( + 'should call deleteLayoutSet when "shape.remove" event is triggered on modelerInstance and the task has a connected layout set for taskType %s', (taskType: BpmnTaskType) => { const mockBpmnDetailsWithConnectedLayoutSet: BpmnDetails = { - id: taskId, - name: 'mockName', - type: BpmnTypeEnum.Task, - taskType: taskType, + ...mockBpmnDetails, + taskType, + element: getMockBpmnElementForTask(taskType), }; const currentEventName = 'shape.remove'; - renderUseBpmnEditor(true, currentEventName, mockBpmnDetailsWithConnectedLayoutSet); + renderUseBpmnEditor(true, currentEventName, taskType, mockBpmnDetailsWithConnectedLayoutSet); expect(deleteLayoutSetMock).toHaveBeenCalledTimes(1); expect(deleteLayoutSetMock).toHaveBeenCalledWith({ layoutSetIdToUpdate: layoutSetId }); @@ -169,15 +171,118 @@ describe('useBpmnEditor', () => { }, ); + it.each(['data', 'confirmation', 'feedback', 'endEvent'])( + 'should not call addDataTypeToApplicationMetadata when "shape.add" event is triggered on modelerInstance and taskType is %s', + (taskType: BpmnTaskType) => { + const mockBpmnDetailsNotPayOrSign: BpmnDetails = { + ...mockBpmnDetails, + taskType, + element: getMockBpmnElementForTask(taskType), + }; + const currentEventName = 'shape.add'; + renderUseBpmnEditor(true, currentEventName, taskType, mockBpmnDetailsNotPayOrSign); + + expect(addDataTypeToAppMetadataMock).not.toHaveBeenCalled(); + expect(setBpmnDetailsMock).toHaveBeenCalled(); + }, + ); + + it('should call addDataTypeToApplicationMetadata when "shape.add" event is triggered on modelerInstance and taskType is signing', () => { + const taskType: BpmnTaskType = 'signing'; + const mockBpmnDetailsSigningTask: BpmnDetails = { + ...mockBpmnDetails, + taskType, + element: getMockBpmnElementForTask(taskType), + }; + const currentEventName = 'shape.add'; + renderUseBpmnEditor(true, currentEventName, taskType, mockBpmnDetailsSigningTask); + + expect(addDataTypeToAppMetadataMock).toHaveBeenCalledTimes(1); + expect(addDataTypeToAppMetadataMock).toHaveBeenCalledWith({ + dataTypeId: 'signatureInformation-1234', + }); + expect(setBpmnDetailsMock).toHaveBeenCalled(); + }); + + it('should call addDataTypeToApplicationMetadata when "shape.add" event is triggered on modelerInstance and taskType is payment', () => { + const taskType: BpmnTaskType = 'payment'; + const mockBpmnDetailsPaymentTask: BpmnDetails = { + ...mockBpmnDetails, + taskType, + element: getMockBpmnElementForTask(taskType), + }; + const currentEventName = 'shape.add'; + renderUseBpmnEditor(true, currentEventName, taskType, mockBpmnDetailsPaymentTask); + + expect(addDataTypeToAppMetadataMock).toHaveBeenCalledTimes(1); + expect(addDataTypeToAppMetadataMock).toHaveBeenCalledWith({ + dataTypeId: 'paymentInformation-1234', + }); + expect(setBpmnDetailsMock).toHaveBeenCalled(); + }); + + it.each(['data', 'confirmation', 'feedback', 'endEvent'])( + 'should not call deleteDataTypeFromAppMetadata when "shape.remove" event is triggered on modelerInstance and taskType is %s', + (taskType: BpmnTaskType) => { + const mockBpmnDetailsNotPayOrSign: BpmnDetails = { + ...mockBpmnDetails, + taskType, + element: getMockBpmnElementForTask(taskType), + }; + const currentEventName = 'shape.remove'; + renderUseBpmnEditor(true, currentEventName, taskType, mockBpmnDetailsNotPayOrSign); + + expect(deleteDataTypeFromAppMetadataMock).not.toHaveBeenCalled(); + expect(setBpmnDetailsMock).toHaveBeenCalled(); + }, + ); + + it('should call deleteDataTypeFromAppMetadata when "shape.remove" event is triggered on modelerInstance and taskType is signing', () => { + const taskType: BpmnTaskType = 'signing'; + const mockBpmnDetailsSigningTask: BpmnDetails = { + ...mockBpmnDetails, + taskType, + element: getMockBpmnElementForTask(taskType), + }; + const currentEventName = 'shape.remove'; + renderUseBpmnEditor(true, currentEventName, taskType, mockBpmnDetailsSigningTask); + + expect(deleteDataTypeFromAppMetadataMock).toHaveBeenCalledTimes(1); + expect(deleteDataTypeFromAppMetadataMock).toHaveBeenCalledWith({ + dataTypeId: 'signatureInformation-1234', + }); + expect(setBpmnDetailsMock).toHaveBeenCalled(); + }); + + it('should call deleteDataTypeFromAppMetadataMock when "shape.remove" event is triggered on modelerInstance and taskType is payment', () => { + const taskType: BpmnTaskType = 'payment'; + const mockBpmnDetailsPaymentTask: BpmnDetails = { + ...mockBpmnDetails, + taskType, + element: getMockBpmnElementForTask(taskType), + }; + const currentEventName = 'shape.remove'; + renderUseBpmnEditor(true, currentEventName, taskType, mockBpmnDetailsPaymentTask); + + expect(deleteDataTypeFromAppMetadataMock).toHaveBeenCalledTimes(1); + expect(deleteDataTypeFromAppMetadataMock).toHaveBeenCalledWith({ + dataTypeId: 'paymentInformation-1234', + }); + expect(setBpmnDetailsMock).toHaveBeenCalled(); + }); + it('should not call deleteLayoutSet when "shape.remove" event is triggered on modelerInstance and deleted task has no layoutSet', () => { const mockBpmnDetailsWithoutConnectedLayoutSet: BpmnDetails = { + ...mockBpmnDetails, id: 'TaskIdNotPresetInLayoutSets', - name: 'mockName', - type: BpmnTypeEnum.Task, - taskType: 'data', }; const currentEventName = 'shape.remove'; - renderUseBpmnEditor(true, currentEventName, mockBpmnDetailsWithoutConnectedLayoutSet); + renderUseBpmnEditor( + true, + currentEventName, + mockBpmnDetailsWithoutConnectedLayoutSet.taskType, + mockBpmnDetailsWithoutConnectedLayoutSet, + ); expect(deleteLayoutSetMock).not.toHaveBeenCalled(); expect(setBpmnDetailsMock).toHaveBeenCalled(); @@ -196,10 +301,11 @@ describe('useBpmnEditor', () => { const renderUseBpmnEditor = ( overrideBpmnContext: boolean, currentEventName: string, + currentTaskType: BpmnTaskType = 'data', bpmnDetails = mockBpmnDetails, ) => { overrideBpmnContext && overrideUseBpmnContext(); overrideGetBpmnEditorDetailsFromBusinessObject(bpmnDetails); - overrideUseBpmnModeler(currentEventName); + overrideUseBpmnModeler(currentEventName, currentTaskType); renderHook(() => useBpmnEditor(), { wrapper }); }; diff --git a/frontend/packages/process-editor/src/hooks/useBpmnEditor.ts b/frontend/packages/process-editor/src/hooks/useBpmnEditor.ts index 75fc4db1d93..8606b211a07 100644 --- a/frontend/packages/process-editor/src/hooks/useBpmnEditor.ts +++ b/frontend/packages/process-editor/src/hooks/useBpmnEditor.ts @@ -7,7 +7,10 @@ import { getBpmnEditorDetailsFromBusinessObject } from '../utils/hookUtils'; import { useBpmnConfigPanelFormContext } from '../contexts/BpmnConfigPanelContext'; import { useBpmnApiContext } from '../contexts/BpmnApiContext'; import { BpmnTypeEnum } from '../enum/BpmnTypeEnum'; -import { getLayoutSetIdFromTaskId } from '../utils/hookUtils/hookUtils'; +import { + getDataTypeIdFromBusinessObject, + getLayoutSetIdFromTaskId, +} from '../utils/hookUtils/hookUtils'; // Wrapper around bpmn-js to Reactify it @@ -21,8 +24,14 @@ export const useBpmnEditor = (): UseBpmnViewerResult => { const canvasRef = useRef(null); const { metaDataFormRef, resetForm } = useBpmnConfigPanelFormContext(); const { getModeler } = useBpmnModeler(); - const { addLayoutSet, deleteLayoutSet, saveBpmn, layoutSets } = useBpmnApiContext(); - //let modelerRef: BpmnModeler | null = null; + const { + addLayoutSet, + deleteLayoutSet, + addDataTypeToAppMetadata, + deleteDataTypeFromAppMetadata, + saveBpmn, + layoutSets, + } = useBpmnApiContext(); const handleCommandStackChanged = async () => { saveBpmn(await getUpdatedXml(), metaDataFormRef.current || null); @@ -31,16 +40,22 @@ export const useBpmnEditor = (): UseBpmnViewerResult => { const handleShapeAdd = (e) => { const bpmnDetails = getBpmnEditorDetailsFromBusinessObject(e?.element?.businessObject); - setBpmnDetails({ - ...bpmnDetails, - element: e.element, - }); if (bpmnDetails.taskType === 'data') { addLayoutSet({ layoutSetIdToUpdate: bpmnDetails.id, layoutSetConfig: { id: bpmnDetails.id, tasks: [bpmnDetails.id] }, }); } + if (bpmnDetails.taskType === 'payment' || bpmnDetails.taskType === 'signing') { + const dataTypeId = getDataTypeIdFromBusinessObject( + bpmnDetails.taskType, + e.element.businessObject, + ); + addDataTypeToAppMetadata({ + dataTypeId, + }); + } + handleSetBpmnDetails(e); }; const handleShapeRemove = (e) => { @@ -53,6 +68,15 @@ export const useBpmnEditor = (): UseBpmnViewerResult => { }); } } + if (bpmnDetails.taskType === 'payment' || bpmnDetails.taskType === 'signing') { + const dataTypeId = getDataTypeIdFromBusinessObject( + bpmnDetails.taskType, + e.element.businessObject, + ); + deleteDataTypeFromAppMetadata({ + dataTypeId, + }); + } setBpmnDetails(null); }; @@ -94,11 +118,11 @@ export const useBpmnEditor = (): UseBpmnViewerResult => { console.log('Canvas reference is not yet available in the DOM.'); } // GetModeler can only be fetched from this hook once since the modeler creates a - // new instance and will attach the same canvasRef container to all instances it fetches + // new instance and will attach the same canvasRef container to all instances it fetches. + // Set modelerRef.current to the Context so that it can be used in other components modelerRef.current = getModeler(canvasRef.current); initializeEditor(); initializeBpmnChanges(); - // set modelerRef.current to the Context so that it can be used in other components }, []); // Missing dependencies are not added to avoid getModeler to be called multiple times useEffect(() => { diff --git a/frontend/packages/process-editor/src/utils/hookUtils/hookUtils.ts b/frontend/packages/process-editor/src/utils/hookUtils/hookUtils.ts index 4a884621c71..d77d143cfda 100644 --- a/frontend/packages/process-editor/src/utils/hookUtils/hookUtils.ts +++ b/frontend/packages/process-editor/src/utils/hookUtils/hookUtils.ts @@ -2,6 +2,18 @@ import type { BpmnDetails } from '../../types/BpmnDetails'; import type { BpmnBusinessObjectViewer } from '../../types/BpmnBusinessObjectViewer'; import type { BpmnBusinessObjectEditor } from '../../types/BpmnBusinessObjectEditor'; import type { LayoutSets } from 'app-shared/types/api/LayoutSetsResponse'; +import type { BpmnTaskType } from '@altinn/process-editor/types/BpmnTaskType'; + +export const bpmnTaskConfig = { + payment: { + configNode: 'paymentConfig', + dataTypeName: 'paymentDataType', + }, + signing: { + configNode: 'signatureConfig', + dataTypeName: 'signatureDataType', + }, +}; /** * Gets the bpmn details from the business object in viewer mode @@ -44,6 +56,15 @@ export const getBpmnEditorDetailsFromBusinessObject = ( }; }; +export const getDataTypeIdFromBusinessObject = ( + bpmnTaskType: BpmnTaskType, + businessObject: BpmnBusinessObjectEditor, +): string => { + const configNode = bpmnTaskConfig[bpmnTaskType].configNode; + const dataTypeName = bpmnTaskConfig[bpmnTaskType].dataTypeName; + return businessObject?.extensionElements?.values[0][configNode][dataTypeName]?.dataType?.dataType; +}; + export const getLayoutSetIdFromTaskId = (bpmnDetails: BpmnDetails, layoutSets: LayoutSets) => { const layoutSet = layoutSets.sets.find((set) => set.tasks[0] === bpmnDetails.id); return layoutSet?.id; diff --git a/frontend/packages/process-editor/test/mocks/bpmnContextMock.ts b/frontend/packages/process-editor/test/mocks/bpmnContextMock.ts index 49cc919430a..21f09da65b9 100644 --- a/frontend/packages/process-editor/test/mocks/bpmnContextMock.ts +++ b/frontend/packages/process-editor/test/mocks/bpmnContextMock.ts @@ -39,7 +39,9 @@ export const mockBpmnApiContextValue: BpmnApiContextProps = { availableDataModelIds: [], addLayoutSet: jest.fn(), deleteLayoutSet: jest.fn(), - mutateDataType: jest.fn(), mutateLayoutSet: jest.fn(), + mutateDataType: jest.fn(), + addDataTypeToAppMetadata: jest.fn(), + deleteDataTypeFromAppMetadata: jest.fn(), saveBpmn: jest.fn(), }; diff --git a/frontend/packages/process-editor/test/mocks/bpmnDetailsMock.ts b/frontend/packages/process-editor/test/mocks/bpmnDetailsMock.ts index a597a1111ae..64ad15e8f81 100644 --- a/frontend/packages/process-editor/test/mocks/bpmnDetailsMock.ts +++ b/frontend/packages/process-editor/test/mocks/bpmnDetailsMock.ts @@ -1,6 +1,7 @@ import type { BpmnDetails } from '../../src/types/BpmnDetails'; import { BpmnTypeEnum } from '../../src/enum/BpmnTypeEnum'; import type { ModdleElement } from 'bpmn-js/lib/model/Types'; +import type { BpmnTaskType } from '@altinn/process-editor/types/BpmnTaskType'; export const mockBpmnId: string = 'testId'; export const mockBpmnName: string = 'testName'; @@ -31,12 +32,69 @@ export const mockBpmnElement: ModdleElement = { }, }; +export const getMockBpmnElementForTask = (taskType: BpmnTaskType) => { + switch (taskType) { + case 'data': + return mockBpmnElement; + case 'confirmation': + return { + businessObject: { + extensionElements: { + values: [ + { + actions: confirmationActions, + }, + ], + }, + }, + }; + case 'signing': + return { + businessObject: { + extensionElements: { + values: [ + { + actions: signingActions, + signatureConfig: { + signatureDataType: { + dataType: { + dataType: 'signatureInformation-1234', + }, + }, + }, + }, + ], + }, + }, + }; + case 'payment': + return { + businessObject: { + extensionElements: { + values: [ + { + actions: paymentActions, + paymentConfig: { + paymentDataType: { + dataType: { + dataType: 'paymentInformation-1234', + }, + }, + }, + }, + ], + }, + }, + }; + } +}; + export const mockBpmnDetails: BpmnDetails = { id: mockBpmnId, name: mockBpmnName, taskType: 'data', type: BpmnTypeEnum.Task, - element: mockBpmnElement, + element: getMockBpmnElementForTask('data'), }; export const confirmationActions = { diff --git a/frontend/packages/shared/src/api/mutations.ts b/frontend/packages/shared/src/api/mutations.ts index 1e39605861f..9c60232dbc4 100644 --- a/frontend/packages/shared/src/api/mutations.ts +++ b/frontend/packages/shared/src/api/mutations.ts @@ -34,6 +34,7 @@ import { resourceAccessListPath, processEditorPathPut, layoutSetPath, + processEditorDataTypePath, processEditorDataTypeChangePath, } from 'app-shared/api/paths'; import type { AddLanguagePayload } from 'app-shared/types/api/AddLanguagePayload'; @@ -121,6 +122,9 @@ export const updatePolicy = (org: string, repo: string, id: string, payload: Pol export const updateResource = (org: string, repo: string, payload: Resource) => put(resourceEditPath(org, repo), payload); // ProcessEditor + +export const addDataTypeToAppMetadata = (org: string, app: string, dataTypeId: string) => post(processEditorDataTypePath(org, app, dataTypeId)); +export const deleteDataTypeFromAppMetadata = (org: string, app: string, dataTypeId: string) => del(processEditorDataTypePath(org, app, dataTypeId)); export const updateBpmnXml = (org: string, app: string, form: any) => put(processEditorPathPut(org, app), form, { headers: { diff --git a/frontend/packages/shared/src/api/paths.js b/frontend/packages/shared/src/api/paths.js index 902c6272e33..d1fd8bd2258 100644 --- a/frontend/packages/shared/src/api/paths.js +++ b/frontend/packages/shared/src/api/paths.js @@ -151,3 +151,4 @@ export const processEditorPath = (org, app) => `${basePath}/${org}/${app}/proces export const processEditorWebSocketHub = () => '/sync-hub'; export const processEditorPathPut = (org, app) => `${basePath}/${org}/${app}/process-modelling/process-definition-latest`; export const processEditorDataTypeChangePath = (org, app) => `${basePath}/${org}/${app}/process-modelling/data-type`; +export const processEditorDataTypePath = (org, app, dataTypeId) => `${basePath}/${org}/${app}/process-modelling/data-type/${dataTypeId}`; diff --git a/frontend/packages/shared/src/mocks/queriesMock.ts b/frontend/packages/shared/src/mocks/queriesMock.ts index b3f54f63c4e..9970ddc43a9 100644 --- a/frontend/packages/shared/src/mocks/queriesMock.ts +++ b/frontend/packages/shared/src/mocks/queriesMock.ts @@ -164,6 +164,7 @@ export const queriesMock: ServicesContextProps = { // Mutations addAppAttachmentMetadata: jest.fn().mockImplementation(() => Promise.resolve()), + addDataTypeToAppMetadata: jest.fn().mockImplementation(() => Promise.resolve()), addLayoutSet: jest.fn().mockImplementation(() => Promise.resolve()), addLanguageCode: jest.fn().mockImplementation(() => Promise.resolve()), addRepo: jest.fn().mockImplementation(() => Promise.resolve(repository)), @@ -180,6 +181,7 @@ export const queriesMock: ServicesContextProps = { .mockImplementation(() => Promise.resolve(createRepoCommitPayload)), deleteAppAttachmentMetadata: jest.fn().mockImplementation(() => Promise.resolve()), deleteDatamodel: jest.fn().mockImplementation(() => Promise.resolve()), + deleteDataTypeFromAppMetadata: jest.fn().mockImplementation(() => Promise.resolve()), deleteFormLayout: jest.fn().mockImplementation(() => Promise.resolve()), deleteLanguageCode: jest.fn().mockImplementation(() => Promise.resolve()), deleteLayoutSet: jest.fn().mockImplementation(() => Promise.resolve()),