﻿<?xml version="1.0" encoding="UTF-8"?>
<xs:schema
	xmlns:xs="http://www.w3.org/2001/XMLSchema"
	targetNamespace="https://tnventures.fi/modelgenerator/xmlschemas/model/v1"
    xmlns="https://tnventures.fi/modelgenerator/xmlschemas/model/v1"
	elementFormDefault="qualified">

	<!-- ============================================================================
	     File structure:
	       1. Root <Model> element (directly below) — the outline of the whole tree,
	          wired together with `type="XxxType"` references. Read this first to
	          understand the shape of a Model XML.
	       2. Named complexTypes follow below. Each describes one element's shape
	          and carries its own <xs:documentation> block. To add or rename an
	          attribute, edit the named complexType — not the root outline.

	     Key types:
	       PropertyType               — a single property (field) of a Model.
	       PropertyMappingType        — binds a Property to a target column/name.
	       PropertyViewType           — per-view presentation of a Property.
	       PropertyGroupType          — groups Properties with shared defaults.
	       MappingType                — a Model's mapping to a DB / other Model.
	       RepositoryType             — a persistence binding (Operational/Audit/Archive/DW).
	       EnumerationType            — a named enum (with items + mappings).
	       EnumerationItemType        — a single item inside an Enumeration.
	       EnumerationItemMappingType — redirects an item to another enumeration.
	       ModelViewType              — a generated view's layout for one mode.
	       CommandType                — a VM command (button/action).
	       ModelViewModelType         — a ViewModel bundle: ModelViews + Commands.
	       DwModelType                — a data-warehouse binding for the model.
	       IndexType / IndexPropertyType — DB index definitions.

	     ==========================================================================
	     Sidecar classes auto-generated with every Model (C# + Python targets)
	     ==========================================================================
	     Whenever a Model is generated, three auxiliary types are emitted ALONGSIDE
	     the Model class, in the same namespace. They are not tied to repositories —
	     they exist for every Model, regardless of mappings. TypeScript / React
	     frontends do NOT emit these (they consume server-side API projections).

	       [Model]Filter       — search-criteria DTO (one instance per property rules below)
	       [Model]OrderBy      — { Property: [Model]OrderByProperty, Direction: OrderByDirection }
	       [Model]QueryResult  — paginated result: { Items: List<[Model]>, TotalCount, Page, PageSize }
	       [Model]OrderByProperty (enum) — one value per non-collection, non-reference,
	                                       non-File/Xml/Json scalar property.

	     [Model]Filter — per-property field-generation rules:
	       | Property Type                                            | Fields emitted on Filter
	       |==========================================================|===========================================
	       | String / Bool / Id / Enum / Model reference / FilePath   | direct equality field  [Property]
	       | Int / Decimal / Money                                    | [Property]Low   +  [Property]High
	       | Date / DateTime                                          | [Property]Start +  [Property]End
	       | Json / Xml / File / Object                               | (no equality field — Null/NotNull only)
	       | (any of the above, when Property.mandatory="false")      | PLUS  Is[Property]Null + Is[Property]NotNull
	     Filters also carry OrFilters[] / AndFilters[] for compound expressions.

	     ==========================================================================
	     colSpan inheritance chain
	     ==========================================================================
	     colSpan can be set on four tiers. Resolution is MOST-SPECIFIC WINS:

	         PropertyView.colSpan          (1) highest precedence — wins if set
	         Property.colSpan              (2) — deprecated; prefer PropertyView
	         PropertyGroup.colSpan         (3) — group-level default for contained Properties
	         ModelView.colSpan             (4) lowest — view-wide fallback when none of above set

	     If none of the four sets colSpan, the property spans 1 column.
	     Same chain applies to ViewModel XMLs (ViewModelPropertyView > Property >
	     ViewModelPropertyGroup > ViewModelView).
	     ============================================================================ -->

	<!-- Root Element -->
	<xs:element name="Model">
		<xs:complexType>
			<xs:all>
				<xs:element name="Comment" type="xs:string" minOccurs="0" />
				<xs:element name="Enumerations" minOccurs="0" >
					<xs:complexType>
						<xs:sequence>
							<xs:element name="Enumeration" type="EnumerationType" maxOccurs="unbounded"></xs:element>
						</xs:sequence>
					</xs:complexType>
				</xs:element>
				<xs:element name="Mappings" minOccurs="0" >
					<xs:complexType>
						<xs:sequence>
							<xs:element name="Mapping" type="MappingType" maxOccurs="unbounded"></xs:element>
						</xs:sequence>
					</xs:complexType>
				</xs:element>
				<xs:element name="Repositories" minOccurs="0" >
					<xs:complexType>
						<xs:sequence>
							<xs:element name="Repository" type="RepositoryType" maxOccurs="unbounded"/>
						</xs:sequence>
					</xs:complexType>
				</xs:element>
				<xs:element name="Properties" minOccurs="0" >
					<xs:complexType>
						<xs:choice maxOccurs="unbounded">
							<xs:element name="Property" type="PropertyType" maxOccurs="unbounded"></xs:element>
							<xs:element name="PropertyGroup" type="PropertyGroupType"/>
						</xs:choice>
					</xs:complexType>
				</xs:element>

				<xs:element name="ModelViewModels" minOccurs="0" maxOccurs="1">
					<xs:complexType>
						<xs:sequence>
							<xs:element name="ModelViewModel" type="ModelViewModelType" maxOccurs="unbounded"/>
						</xs:sequence>
					</xs:complexType>
				</xs:element>

				<xs:element name="DwModels" minOccurs="0">
					<xs:complexType>
						<xs:sequence>
							<xs:element name="DwModel" type="DwModelType" minOccurs="1" maxOccurs="unbounded"/>
						</xs:sequence>
					</xs:complexType>
				</xs:element>
				<xs:element name="Indexes" minOccurs="0">
					<xs:complexType>
						<xs:sequence>
							<xs:element name="Index" type="IndexType" minOccurs="1" maxOccurs="unbounded"/>
						</xs:sequence>
					</xs:complexType>
				</xs:element>


			</xs:all>
			<xs:attribute name="name" type="xs:string" use="required">
				<xs:annotation>
					<xs:documentation>Required. The name of the model. This will be used as the model class name in generated code.</xs:documentation>
				</xs:annotation>
			</xs:attribute>
			<xs:attribute name="namespace" type="xs:string" use="required">
				<xs:annotation>
					<xs:documentation>Required. The namespace for the model. This defines the namespace for generated model code.</xs:documentation>
				</xs:annotation>
			</xs:attribute>
			<xs:attribute name="partial" type="xs:boolean" default="false">
				<xs:annotation>
					<xs:documentation>Optional. Indicates whether the model class should be generated as a partial class, allowing for additional manual implementation. Default is false.</xs:documentation>
				</xs:annotation>
			</xs:attribute>
			<xs:attribute name="inherits" type="xs:string">
				<xs:annotation>
					<xs:documentation>Optional. Name of another Model this one extends. The generated class becomes a subclass of the named parent and inherits all its properties (no need to redeclare Id, audit columns, etc.). The inherited model cannot declare its own &lt;Repository&gt; — the parent owns the table; setting both raises a generator error. Use for variant types that share the parent's identity + storage but add their own fields.</xs:documentation>
				</xs:annotation>
			</xs:attribute>

			<xs:attribute name="documentation" type="xs:string">
				<xs:annotation>
					<xs:documentation>Optional. Summary documentation for the model. This will be included in generated code documentation.</xs:documentation>
				</xs:annotation>
			</xs:attribute>
			<xs:attribute name="documentationRemarks" type="xs:string">
				<xs:annotation>
					<xs:documentation>Optional. Additional remarks for the model documentation. This will be included in generated code documentation as remarks section.</xs:documentation>
				</xs:annotation>
			</xs:attribute>
			<xs:attribute name="displayName" type="xs:string">
				<xs:annotation>
					<xs:documentation>Optional. The heading text for display name fields of this model (e.g., "Customer Name"). Used in UI generation.</xs:documentation>
				</xs:annotation>
			</xs:attribute>
			<xs:attribute name="displayPluralName" type="xs:string">
				<xs:annotation>
					<xs:documentation>Optional. Plural display name for this model (e.g., "Customers"). Supports multilingual format. Used as page titles for list views and similar UI labels. Falls back to `displayName` + locale-appropriate plural suffix when omitted.</xs:documentation>
				</xs:annotation>
			</xs:attribute>
			<xs:attribute name="displayShortName" type="xs:string">
				<xs:annotation>
					<xs:documentation>Optional. Short/abbreviated display name for this model. Falls back to `displayName` when omitted.</xs:documentation>
				</xs:annotation>
			</xs:attribute>
			<xs:attribute name="displayCode" type="xs:string">
				<xs:annotation>
					<xs:documentation>Optional. The heading text for display code fields of this model (e.g., "Customer Code"). Used in UI generation.</xs:documentation>
				</xs:annotation>
			</xs:attribute>
			<xs:attribute name="displayNumber" type="xs:string">
				<xs:annotation>
					<xs:documentation>Optional. The heading text for display number fields of this model (e.g., "Customer Number"). Used when a property is marked as displayNumber. Used in UI generation.</xs:documentation>
				</xs:annotation>
			</xs:attribute>
			<xs:attribute name="userOwned" type="xs:boolean" default="false">
				<xs:annotation>
					<xs:documentation>Set by the reverse generator when the model's source-of-truth is a hand-written POCO (.cs/.py) in a reverse-engineered container. The forward generator emits a partial-class companion (methods + interface only) instead of a full class — the user's POCO supplies the property declarations. Hand-authoring this attribute is unnecessary; the assistant flags it automatically.</xs:documentation>
				</xs:annotation>
			</xs:attribute>
			<xs:attribute name="userHasValidateMethod" type="xs:boolean" default="false">
				<xs:annotation>
					<xs:documentation>Set by the reverse generator on user-owned models when the source POCO already declares a Validate(...) method. Tells the forward partial-class emitter to skip emitting its own Validate so the user's implementation wins.</xs:documentation>
				</xs:annotation>
			</xs:attribute>
			<xs:attribute name="userHasEqualsMethod" type="xs:boolean" default="false">
				<xs:annotation>
					<xs:documentation>Set by the reverse generator on user-owned models when the source POCO already declares an Equals method matching the multi-param shape (T, bool ignoreKey, ...). Tells the forward partial-class emitter to skip its own Equals.</xs:documentation>
				</xs:annotation>
			</xs:attribute>
			<xs:attribute name="userIsRecord" type="xs:boolean" default="false">
				<xs:annotation>
					<xs:documentation>Set by the reverse generator on user-owned models when the source declaration is a C# `record` (positional or not). Records carry compiler-synthesized Equals/GetHashCode; the forward partial-class emitter skips its own Equals to avoid CS0102 duplicates.</xs:documentation>
				</xs:annotation>
			</xs:attribute>
		</xs:complexType>
	</xs:element>

	<!-- ========================================================================
	     Named types below. Each maps to a single XML element and is referenced
	     from the <Model> root tree. Extracting these
	     to named types keeps the root element compact and lets each type carry
	     its own documentation block.
	     ======================================================================== -->
	
	<xs:complexType name="PropertyMappingType">
		<xs:annotation>
			<xs:documentation>Maps a Property to a target field in a specific Mapping. Used when the default naming rule (property name == target column name + Mapping's targetFieldPrefix/Suffix) doesn't apply, OR when the DB-side storage limits differ from the Property's app-level limits (length / decimals / precision).</xs:documentation>
		</xs:annotation>
		<xs:attribute name="mapping" type="xs:string">
			<xs:annotation>
				<xs:documentation>The name of the mapping referring to Mapping element name. Not required if only one mapping of type Model. Optional.</xs:documentation>
			</xs:annotation>
		</xs:attribute>
		<xs:attribute name="targetName" type="xs:string">
			<xs:annotation>
				<xs:documentation>The target name for the mapping. Typically field name in database. Optional.</xs:documentation>
			</xs:annotation>
		</xs:attribute>
		<xs:attribute name="length" type="xs:integer">
			<xs:annotation>
				<xs:documentation>Optional. DB column length for String properties. Overrides Property.maxLength as the column size. When absent, the column falls back to Property.maxLength (or the DB's default for the data type if Property has no maxLength either).</xs:documentation>
			</xs:annotation>
		</xs:attribute>
		<xs:attribute name="lengthTruncate" type="xs:boolean" default="true">
			<xs:annotation>
				<xs:documentation>Optional. Whether values exceeding `length` should be truncated on write. Default true. Mirrors Property.maxLengthTruncate, but applies to the DB column boundary specifically.</xs:documentation>
			</xs:annotation>
		</xs:attribute>
		<xs:attribute name="decimals" type="xs:integer">
			<xs:annotation>
				<xs:documentation>Optional. Decimal places for Decimal/Money columns. Overrides Property.decimals at the DB layer.</xs:documentation>
			</xs:annotation>
		</xs:attribute>
		<xs:attribute name="precision" type="xs:integer">
			<xs:annotation>
				<xs:documentation>Optional. Numeric precision for Decimal/Money columns (total digits, e.g. 18 in DECIMAL(18,2)).</xs:documentation>
			</xs:annotation>
		</xs:attribute>
	</xs:complexType>

	<xs:complexType name="PropertyViewType">
		<xs:annotation>
			<xs:documentation>Per-view presentation of a Property. Overrides (or supplements) Property-level defaults for one specific view (by viewName or mode). Covers labels, visibility, styles, help text, lookup config, input hints, and layout (colSpan, labelOrientation, labelWidth, lineCount).</xs:documentation>
		</xs:annotation>
		<xs:attribute name="viewName" type="xs:string">
			<xs:annotation>
				<xs:documentation>Optional if mode given and mode is unique in ModelView definitions. The name of the view these attributes are applied. Ending View not required.</xs:documentation>
			</xs:annotation>
		</xs:attribute>
		<xs:attribute name="mode">
			<xs:annotation>
				<xs:documentation>Optional. Mode of view.</xs:documentation>
			</xs:annotation>
			<xs:simpleType>
				<xs:restriction base="xs:string">
					<xs:enumeration value="Update"/>
					<xs:enumeration value="Read"/>
					<xs:enumeration value="List"/>
				</xs:restriction>
			</xs:simpleType>
		</xs:attribute>
		<xs:attribute name="label" type="xs:string">
			<xs:annotation>
				<xs:documentation>Name of property visible in this view. Optional.</xs:documentation>
			</xs:annotation>
		</xs:attribute>
		<xs:attribute name="sectionName" type="xs:string">
			<xs:annotation>
				<xs:documentation>Per-view section assignment. Place the property under the named section in this specific view. Setting it ALSO opts the property into the view (no need to ALSO set Property-level updateViewSectionName / readViewSectionName for inclusion). Wins over the Property-level section name when both are set; Property-level value is the per-property default used by every view that doesn't override here.</xs:documentation>
			</xs:annotation>
		</xs:attribute>
		<xs:attribute name="readOnly" type="xs:boolean" default="false">
			<xs:annotation>
				<xs:documentation>Is property read only in this view. Optional.</xs:documentation>
			</xs:annotation>
		</xs:attribute>
		<xs:attribute name="hidden" type="xs:boolean" default="false">
			<xs:annotation>
				<xs:documentation>Is property hidden in this view. Optional.</xs:documentation>
			</xs:annotation>
		</xs:attribute>
		<xs:attribute name="labelStyle" type="xs:string">
			<xs:annotation>
				<xs:documentation>Style definition given for label part of control. Optional.</xs:documentation>
			</xs:annotation>
		</xs:attribute>
		<xs:attribute name="controlStyle" type="xs:string">
			<xs:annotation>
				<xs:documentation>Style definition given for actual control (input) part of control. Optional.</xs:documentation>
			</xs:annotation>
		</xs:attribute>
		<xs:attribute name="feedbackStyle" type="xs:string">
			<xs:annotation>
				<xs:documentation>Style definition given for feedback (error message) part of control. Optional.</xs:documentation>
			</xs:annotation>
		</xs:attribute>
		<xs:attribute name="groupStyle" type="xs:string">
			<xs:annotation>
				<xs:documentation>Style definition given for governing group element around control. Optional.</xs:documentation>
			</xs:annotation>
		</xs:attribute>
		<xs:attribute name="instruction" type="xs:string">
			<xs:annotation>
				<xs:documentation>Optional. Instruction text appearing below component. Language text.</xs:documentation>
			</xs:annotation>
		</xs:attribute>
		<xs:attribute name="popover" type="xs:string">
			<xs:annotation>
				<xs:documentation>Optional. Instruction text appearing in help box next to label. Language text.</xs:documentation>
			</xs:annotation>
		</xs:attribute>
		<xs:attribute name="tooltip" type="xs:string">
			<xs:annotation>
				<xs:documentation>Optional. Instruction text appearing in tooltip. Language text.</xs:documentation>
			</xs:annotation>
		</xs:attribute>
		<xs:attribute name="placeholder" type="xs:string">
			<xs:annotation>
				<xs:documentation>Optional. Placeholder text for text inputs. Language text.</xs:documentation>
			</xs:annotation>
		</xs:attribute>
		<xs:attribute name="listColumn" type="xs:integer">
			<xs:annotation>
				<xs:documentation>Specifies the column order for the default list view. Optional.</xs:documentation>
			</xs:annotation>
		</xs:attribute>
		<xs:attribute name="listSearchParameter" type="xs:integer">
			<xs:annotation>
				<xs:documentation>Optional. Specifies the order if property is used as search parameter in default list view.</xs:documentation>
			</xs:annotation>
		</xs:attribute>
		<xs:attribute name="lookupMode">
			<xs:annotation>
				<xs:documentation>Optional. Mode of lookup component to select values for ModelReference. Optional.</xs:documentation>
			</xs:annotation>
			<xs:simpleType>
				<xs:restriction base="xs:string">
					<xs:enumeration value="Memory"/>
					<xs:enumeration value="AutoSearch"/>
					<xs:enumeration value="ManualSearch"/>
					<xs:enumeration value="Dropdown"/>
				</xs:restriction>
			</xs:simpleType>
		</xs:attribute>
		<xs:attribute name="lookupCode" type="xs:string">
			<xs:annotation>
				<xs:documentation>Optional. Property name of the referenced model to use as code in lookup. Valid only for ModelReference properties.</xs:documentation>
			</xs:annotation>
		</xs:attribute>
		<xs:attribute name="lookupCodeLabel" type="xs:string">
			<xs:annotation>
				<xs:documentation>Optional. Display name for code property in lookup. Language text. Valid only for ModelReference properties.</xs:documentation>
			</xs:annotation>
		</xs:attribute>
		<xs:attribute name="lookupName" type="xs:string">
			<xs:annotation>
				<xs:documentation>Optional. Property name of the referenced model to use as name in lookup. Valid only for ModelReference properties.</xs:documentation>
			</xs:annotation>
		</xs:attribute>
		<xs:attribute name="lookupNameLabel" type="xs:string">
			<xs:annotation>
				<xs:documentation>Optional. Display name for name property in lookup. Language text. Valid only for ModelReference properties.</xs:documentation>
			</xs:annotation>
		</xs:attribute>
		<xs:attribute name="lookupNumber" type="xs:string">
			<xs:annotation>
				<xs:documentation>Optional. Property name of the referenced model to use as number in lookup. Valid only for ModelReference properties.</xs:documentation>
			</xs:annotation>
		</xs:attribute>
		<xs:attribute name="lookupNumberLabel" type="xs:string">
			<xs:annotation>
				<xs:documentation>Optional. Display name for number property in lookup. Language text. Valid only for ModelReference properties.</xs:documentation>
			</xs:annotation>
		</xs:attribute>
		<xs:attribute name="lookupStatus" type="xs:string">
			<xs:annotation>
				<xs:documentation>Optional. Property name of the referenced model to use as 'status' in lookup. Valid only for ModelReference properties.</xs:documentation>
			</xs:annotation>
		</xs:attribute>
		<xs:attribute name="lookupStatusLabel" type="xs:string">
			<xs:annotation>
				<xs:documentation>Optional. Display name for 'status' property in lookup. Language text. Valid only for ModelReference properties.</xs:documentation>
			</xs:annotation>
		</xs:attribute>
		<xs:attribute name="inputType">
			<xs:annotation>
				<xs:documentation>Optional. Specifies type of text input. Valid only if type is String.</xs:documentation>
			</xs:annotation>
			<xs:simpleType>
				<xs:restriction base="xs:string">
					<xs:enumeration value="None"/>
					<xs:enumeration value="Text"/>
					<xs:enumeration value="Email"/>
					<xs:enumeration value="Password"/>
					<xs:enumeration value="Numeric"/>
					<xs:enumeration value="Phone"/>
					<xs:enumeration value="Code"/>
				</xs:restriction>
			</xs:simpleType>
		</xs:attribute>
		<xs:attribute name="codeType">
			<xs:annotation>
				<xs:documentation>Optional. Specifies format of code input. Valid only if type is String and inputType is Code.</xs:documentation>
			</xs:annotation>
			<xs:simpleType>
				<xs:restriction base="xs:string">
					<xs:enumeration value="Any"/>
					<xs:enumeration value="Numeric"/>
					<xs:enumeration value="Letters"/>
					<xs:enumeration value="UpperLetters"/>
				</xs:restriction>
			</xs:simpleType>
		</xs:attribute>
		<xs:attribute name="inputMode">
			<xs:annotation>
				<xs:documentation>Optional. Specifies input mode (keyboard type) for text inputs.</xs:documentation>
			</xs:annotation>
			<xs:simpleType>
				<xs:restriction base="xs:string">
					<xs:enumeration value="Text"/>
					<xs:enumeration value="Email"/>
					<xs:enumeration value="Numeric"/>
					<xs:enumeration value="Tel"/>
					<xs:enumeration value="Url"/>
				</xs:restriction>
			</xs:simpleType>
		</xs:attribute>
		<xs:attribute name="autocompleteMode">
			<xs:annotation>
				<xs:documentation>Optional. Specifies autocomplete mode for text inputs.</xs:documentation>
			</xs:annotation>
			<xs:simpleType>
				<xs:restriction base="xs:string">
					<xs:enumeration value="AddressStreet"/>
					<xs:enumeration value="AddressCity"/>
					<xs:enumeration value="AddressZip"/>
					<xs:enumeration value="AddressCountry"/>
					<xs:enumeration value="LastName"/>
					<xs:enumeration value="FirstName"/>
					<xs:enumeration value="CompanyName"/>
					<xs:enumeration value="Email"/>
					<xs:enumeration value="Phone"/>
					<xs:enumeration value="Url"/>
					<xs:enumeration value="Username"/>
					<xs:enumeration value="Password"/>
					<xs:enumeration value="NewPassword"/>
					<xs:enumeration value="OneTimeCode"/>
					<xs:enumeration value="Off"/>
				</xs:restriction>
			</xs:simpleType>
		</xs:attribute>
		<xs:attribute name="lineCount" type="xs:integer">
			<xs:annotation>
				<xs:documentation>Optional. For String / Xml / Json properties: render as a multi-line text area with this many visible lines. Values &gt; 1 trigger a &lt;textarea&gt; (React) / multi-line TextBox with wrapping (WPF). Default 1 (single line). Xml and Json default to 10 lines automatically.</xs:documentation>
			</xs:annotation>
		</xs:attribute>
		<xs:attribute name="colSpan" type="xs:integer">
			<xs:annotation>
				<xs:documentation>Optional. Number of form columns this field spans (most-specific tier in the colSpan inheritance chain: PropertyView &gt; Property &gt; PropertyGroup &gt; ModelView). Default 1. Useful for wide controls (e.g. multi-line text areas) in multi-column layouts.</xs:documentation>
			</xs:annotation>
		</xs:attribute>
		<xs:attribute name="labelOrientation">
			<xs:annotation>
				<xs:documentation>Optional. Where the label sits relative to the input. "Top" (default) stacks label above control; "Side" places the label to the left of the control on the same row.</xs:documentation>
			</xs:annotation>
			<xs:simpleType>
				<xs:restriction base="xs:string">
					<xs:enumeration value="Top"/>
					<xs:enumeration value="Side"/>
				</xs:restriction>
			</xs:simpleType>
		</xs:attribute>
		<xs:attribute name="labelWidth">
			<xs:annotation>
				<xs:documentation>Optional. Side-layout label column width. Three levels: "Narrow" (~80px), "Normal" (~120px, default), "Wide" (~200px). Ignored when labelOrientation is "Top".</xs:documentation>
			</xs:annotation>
			<xs:simpleType>
				<xs:restriction base="xs:string">
					<xs:enumeration value="Narrow"/>
					<xs:enumeration value="Normal"/>
					<xs:enumeration value="Wide"/>
				</xs:restriction>
			</xs:simpleType>
		</xs:attribute>
	</xs:complexType>

	<xs:complexType name="PropertyType">
		<xs:annotation>
			<xs:documentation>A single field of a Model. Holds data-type info (type/enum/model), persistence hints (repository / mapping flags), per-view presentation via nested PropertyView children, and validation / formatting attributes.</xs:documentation>
		</xs:annotation>
		<xs:sequence>
			<xs:element name="PropertyMapping" type="PropertyMappingType" minOccurs="0" maxOccurs="unbounded">
				<xs:annotation>
					<xs:documentation>PropertyMapping element required if target name (database field name) not same as Property name or not follows rules defined in Mapping element (prefix). Optional.</xs:documentation>
				</xs:annotation>
			</xs:element>
			<xs:element name="PropertyView" type="PropertyViewType" minOccurs="0" maxOccurs="unbounded">
				<xs:annotation>
					<xs:documentation>PropertyView describes view-specific attributes like styles, labels, help text, and layout for this Property.</xs:documentation>
				</xs:annotation>
			</xs:element>
		</xs:sequence>
		<xs:attribute name="name" type="xs:string" use="required">
			<xs:annotation>
				<xs:documentation>Required. The name of the property. This will be used as the property name in generated code. For ModelReference properties without collection, the name will automatically have "Key" suffix appended if not present.</xs:documentation>
			</xs:annotation>
		</xs:attribute>
		<xs:attribute name="type">
			<xs:annotation>
				<xs:documentation>Required. The data type of the property. Supported types: String, Decimal, Id, Bool, Int, DateTime, Date, Money, Enum (requires `enum`), File, FilePath, DirPath, Model (requires `model`; set `collection="List"` for a collection of models), Xml, Json, Object (requires `object`).</xs:documentation>
			</xs:annotation>
			<xs:simpleType>
				<xs:restriction base="xs:string">
					<xs:enumeration value="String"/>
					<xs:enumeration value="Decimal"/>
					<xs:enumeration value="Id"/>

					<xs:enumeration value="Bool"/>
					<xs:enumeration value="Int"/>
					<xs:enumeration value="DateTime"/>
					<xs:enumeration value="Date"/>
					<xs:enumeration value="Money"/>
					<xs:enumeration value="Enum"/>
					<xs:enumeration value="File"/>
					<xs:enumeration value="FilePath"/>
					<xs:enumeration value="DirPath"/>

					<xs:enumeration value="Model"/>
					<xs:enumeration value="Xml"/>
					<xs:enumeration value="Json"/>
					<xs:enumeration value="Object"/>
				</xs:restriction>
			</xs:simpleType>
		</xs:attribute>
		<xs:attribute name="default" type="xs:string">
			<xs:annotation>
				<xs:documentation>Optional. Default value initialized for the property. For Enum types, can be specified as integer value or as enumeration name (with or without type prefix, e.g., "Active" or "Status.Active").</xs:documentation>
			</xs:annotation>
		</xs:attribute>
		<xs:attribute name="mandatory" type="xs:boolean" default="false">
			<xs:annotation>
				<xs:documentation>Optional. Indicates whether the property is mandatory (not nullable). Default is false. Key properties are always mandatory. Enum properties default to mandatory if not explicitly specified (for legacy support).</xs:documentation>
			</xs:annotation>
		</xs:attribute>
		<xs:attribute name="defaultAllowed" type="xs:boolean" default="true">
			<xs:annotation>
				<xs:documentation>Optional. Indicates whether default values (like 0, empty GUID, etc.) are allowed for mandatory properties. Default is true. For mandatory Guid, Date, DateTime, and ModelReference types, defaults to false unless explicitly set to true.</xs:documentation>
			</xs:annotation>
		</xs:attribute>
		<xs:attribute name="key" type="xs:boolean" default="false">
			<xs:annotation>
				<xs:documentation>Optional. Indicates whether the property is a primary key. Default is false. Key properties are automatically set to mandatory.</xs:documentation>
			</xs:annotation>
		</xs:attribute>
		<xs:attribute name="unique" type="xs:boolean" default="false">
			<xs:annotation>
				<xs:documentation>Optional. Indicates whether the property must have unique values. Default is false.</xs:documentation>
			</xs:annotation>
		</xs:attribute>
		<xs:attribute name="readOnly" type="xs:boolean" default="false">
			<xs:annotation>
				<xs:documentation>Optional. Indicates whether the property is read-only. Default is false.</xs:documentation>
			</xs:annotation>
		</xs:attribute>
		<xs:attribute name="updateReadOnly" type="xs:boolean" default="false">
			<xs:annotation>
				<xs:documentation>Optional. Indicates whether the property is read-only in update mode (but editable during creation). Default is false.</xs:documentation>
			</xs:annotation>
		</xs:attribute>
		<xs:attribute name="sequence" type="xs:boolean" default="false">
			<xs:annotation>
				<xs:documentation>Optional. Indicates whether the property is a sequence. Only allowed for types Int, String, or ModelReference with KeyType Int or String. Default is false.</xs:documentation>
			</xs:annotation>
		</xs:attribute>
		<xs:attribute name="identity" type="xs:boolean" default="false">
			<xs:annotation>
				<xs:documentation>Optional. Indicates whether the property is an auto-increment identity column. Only allowed for type Int or Model with KeyType Int. Default is false.</xs:documentation>
			</xs:annotation>
		</xs:attribute>
		<xs:attribute name="displayName" type="xs:boolean" default="false">
			<xs:annotation>
				<xs:documentation>Optional. Indicates whether this property should be used as the display name for the model. Default is false.</xs:documentation>
			</xs:annotation>
		</xs:attribute>
		<xs:attribute name="displayCode" type="xs:boolean" default="false">
			<xs:annotation>
				<xs:documentation>Optional. Indicates whether this property should be used as the display code (short identifier) for the model. Default is false.</xs:documentation>
			</xs:annotation>
		</xs:attribute>
		<xs:attribute name="displayNumber" type="xs:boolean" default="false">
			<xs:annotation>
				<xs:documentation>Optional. Indicates whether this property should be used as the display number for the model. Default is false.</xs:documentation>
			</xs:annotation>
		</xs:attribute>
		<xs:attribute name="colSpan" type="xs:integer">
			<xs:annotation>
				<xs:documentation>Optional. Number of form columns this property spans (Property tier in the colSpan inheritance chain: PropertyView &gt; Property &gt; PropertyGroup &gt; ModelView). Default 1.</xs:documentation>
			</xs:annotation>
		</xs:attribute>
		<xs:attribute name="controlled" type="xs:boolean" default="false">
			<xs:annotation>
				<xs:documentation>Optional. REACT ONLY. When true, the generated React ViewModel emits an `on[Property]ChangedBase(oldValue)` wrapper that calls the derived-class `on[Property]Changed(oldValue)` hook. The hook fires AFTER updateField writes the new value, with the previous value passed in. Use for side-effects tied to property changes (recalculations, cascading updates, revalidation beyond validate()). NOTE: WPF emits plain `On[Property]Changed()` (no oldValue parameter) for EVERY property regardless of this flag; the attribute is a no-op on WPF. Default false.</xs:documentation>
			</xs:annotation>
		</xs:attribute>
		<xs:attribute name="label" type="xs:string" >
			<xs:annotation>
				<xs:documentation>Optional. The display name text for this property when shown in views. Supports multilingual text format. If not specified, automatically generated from property name using camel case conversion (with "Key" suffix removed for references).</xs:documentation>
			</xs:annotation>
		</xs:attribute>

		<xs:attribute name="enum" type="xs:string">
			<xs:annotation>
				<xs:documentation>Required if type is Enum. Specifies the name of the enumeration type. The enumeration must be defined in the same model's Enumerations section.</xs:documentation>
			</xs:annotation>
		</xs:attribute>
		<xs:attribute name="model" type="xs:string">
			<xs:annotation>
				<xs:documentation>Required if type is Model. Specifies the name of the referenced model. For collections of models use `type="Model"` with `collection="List"`.</xs:documentation>
			</xs:annotation>
		</xs:attribute>
		<xs:attribute name="keyType">
			<xs:annotation>
				<xs:documentation>Optional. Only meaningful when type is Model. The foreign-key column type normally mirrors the referenced model's own key property and is inferred automatically — you do not need to set this. Provide it only as an explicit fallback for cases where the referenced model cannot be resolved at parse/validation time (e.g. cross-container references). When the referenced model can be resolved, the inferred key type takes precedence over this value. Allowed values: Id, Int, String. Default is Id.</xs:documentation>
			</xs:annotation>
			<xs:simpleType>
				<xs:restriction base="xs:string">
					<xs:pattern value="[Ii][Dd]|[Ii][Nn][Tt]|[Ss][Tt][Rr][Ii][Nn][Gg]"/>
				</xs:restriction>
			</xs:simpleType>
		</xs:attribute>
		<xs:attribute name="userAuthoredNav" type="xs:boolean" default="false">
			<xs:annotation>
				<xs:documentation>Set by the reverse generator on Model-typed properties when the user-owned source POCO already declares the navigation property alongside the foreign-key column (e.g. both `User? Approver` and `Guid? ApproverId`). Tells the forward partial generator to skip emitting a nav sidecar for this property — otherwise the partial would duplicate the nav declaration the user already wrote. Hand-authoring this attribute on non-reverse XML is unnecessary.</xs:documentation>
			</xs:annotation>
		</xs:attribute>
		<xs:attribute name="object" type="xs:string">
			<xs:annotation>
				<xs:documentation>Required if type is Object. Specifies the custom type definition using target language types directly.</xs:documentation>
			</xs:annotation>
		</xs:attribute>
		<xs:attribute name="collection">
			<xs:annotation>
				<xs:documentation>Optional. Specifies the type of collection when the property represents a collection. Options: List. Default is List.</xs:documentation>
			</xs:annotation>
			<xs:simpleType>
				<xs:restriction base="xs:string">
					<xs:enumeration value="List"/>

				</xs:restriction>
			</xs:simpleType>
		</xs:attribute>
		<xs:attribute name="excludedMappings" type="xs:string">
			<xs:annotation>
				<xs:documentation>Optional. Comma-separated list of mapping names where this property should be excluded.</xs:documentation>
			</xs:annotation>
		</xs:attribute>
		<xs:attribute name="includedSubModels" type="xs:string">
			<xs:annotation>
				<xs:documentation>Optional. Comma-separated list of sub-model projection names this property belongs to. Each name is the class name of a generated projection and triggers an independent class containing every property tagged with that name plus all key properties, and a `To[Model]()` upcast method back to the full parent. Listing multiple names makes the property appear in each of those projections. Example: `includedSubModels="PublicCustomer,MinimalCustomer"` produces classes `PublicCustomer` and `MinimalCustomer`.</xs:documentation>
			</xs:annotation>
		</xs:attribute>
		<xs:attribute name="excludedDw" type="xs:boolean">
			<xs:annotation>
				<xs:documentation>Optional. Indicates whether the property should be excluded from data warehouse models. Overrides general inclusion rules. Can also be specified via excludedMappings.</xs:documentation>
			</xs:annotation>
		</xs:attribute>
		<xs:attribute name="includedDw" type="xs:boolean">
			<xs:annotation>
				<xs:documentation>Optional. Indicates whether the property should be included in data warehouse models. Overrides general exclusion rules.</xs:documentation>
			</xs:annotation>
		</xs:attribute>
		<xs:attribute name="documentation" type="xs:string">
			<xs:annotation>
				<xs:documentation>Optional. Summary documentation for the property. This will be included in generated code documentation.</xs:documentation>
			</xs:annotation>
		</xs:attribute>


		<xs:attribute name="documentationRemarks" type="xs:string">
			<xs:annotation>
				<xs:documentation>Optional. Additional remarks for the property documentation. This will be included in generated code documentation as remarks section.</xs:documentation>
			</xs:annotation>
		</xs:attribute>
		<xs:attribute name="obsolete" type="xs:string">
			<xs:annotation>
				<xs:documentation>Optional. Marks the property as obsolete with the specified message. This will add the Obsolete attribute in generated code.</xs:documentation>
			</xs:annotation>
		</xs:attribute>
		<xs:attribute name="maxLength" type="xs:integer">
			<xs:annotation>
				<xs:documentation>Optional. Maximum length for String properties. Values exceeding this length will be truncated if maxLengthTruncate is true, otherwise validation fails.</xs:documentation>
			</xs:annotation>
		</xs:attribute>
		<xs:attribute name="maxLengthTruncate" type="xs:boolean" default="true">
			<xs:annotation>
				<xs:documentation>Optional. Indicates whether property values should be automatically truncated if they exceed maxLength. Default is true.</xs:documentation>
			</xs:annotation>
		</xs:attribute>
		<!-- maxLengthRepository / maxLengthRepositoryTruncate / decimalsRepository / precisionRepository
		     used to live here. Moved to <PropertyMapping> (issue #131) so DB-side storage limits
		     are declared in the mapping that controls the column, not on the model-level Property.
		     Property's maxLength + decimals remain as both app-level limits AND fallback values
		     used by the column emission when no PropertyMapping override is set. -->

		<xs:attribute name="decimals" type="xs:integer">
			<xs:annotation>
				<xs:documentation>Optional. Number of decimal places for decimal/Money properties at the application level. Also acts as the DB column scale when no &lt;PropertyMapping decimals=…&gt; override is provided.</xs:documentation>
			</xs:annotation>
		</xs:attribute>
		<xs:attribute name="rounding">
			<xs:annotation>
				<xs:documentation>Optional. Specifies how to handle values with more decimal places than allowed. Options: Trunc (truncate extra decimals), Round (round to nearest), Exception (throw error). Default is Exception.</xs:documentation>
			</xs:annotation>
			<xs:simpleType>
				<xs:restriction base="xs:string">
					<xs:enumeration value="Trunc"/>
					<xs:enumeration value="Round"/>
					<xs:enumeration value="Exception"/>
				</xs:restriction>
			</xs:simpleType>
		</xs:attribute>
		<xs:attribute name="readViewSectionName" type="xs:string">
			<xs:annotation>
				<xs:documentation>Specifies the section name for the default read view. Optional.</xs:documentation>
			</xs:annotation>
		</xs:attribute>
		<xs:attribute name="updateViewSectionName" type="xs:string">
			<xs:annotation>
				<xs:documentation>Specifies the section name for the default update view. Optional.</xs:documentation>
			</xs:annotation>
		</xs:attribute>
		<xs:attribute name="listColumn" type="xs:integer">
			<xs:annotation>
				<xs:documentation>Specifies the column order for the default list view. Optional.</xs:documentation>
			</xs:annotation>
		</xs:attribute>
		<xs:attribute name="listSearchParameter" type="xs:integer">
			<xs:annotation>
				<xs:documentation>Optional. Specifies the order if property is used as search parameter in default list view.</xs:documentation>
			</xs:annotation>
		</xs:attribute>
		<xs:attribute name="hidden" type="xs:boolean" default="false">
			<xs:annotation>
				<xs:documentation>Specifies if the field is hidden in default view. Default is false.</xs:documentation>
			</xs:annotation>
		</xs:attribute>
		<xs:attribute name="path" type="xs:string" default="false">
			<xs:annotation>
				<xs:documentation>Specifies the base path for type FilePath properties. Mandatory if type is FilePath. Optional.</xs:documentation>
			</xs:annotation>
		</xs:attribute>
		<xs:attribute name="container" type="xs:string">
			<xs:annotation>
				<xs:documentation>Optional. Names a logical storage container declared in the host's `Storage:Containers:&lt;name&gt;` config block. Routes this FilePath property's IO through that container's `IFileStorage` impl (Local / AzureBlob / etc.). Omit to use the "Default" container. Applies only to type="FilePath".</xs:documentation>
			</xs:annotation>
		</xs:attribute>
		<xs:attribute name="state" type="xs:boolean" default="false">
			<xs:annotation>
				<xs:documentation>Optional. Indicates whether the property describes the current state of the entity (e.g., Active/Inactive status). State properties are typically excluded from data warehouse models by default. Default is false.</xs:documentation>
			</xs:annotation>
		</xs:attribute>
		<xs:attribute name="isInsertTimestamp" type="xs:boolean" default="false">
			<xs:annotation>
				<xs:documentation>Optional. Indicates whether the property stores the insert/creation timestamp of the entity. Default is false. This is automatically populated during entity creation.</xs:documentation>
			</xs:annotation>
		</xs:attribute>
		<xs:attribute name="isUpdateTimestamp" type="xs:boolean" default="false">
			<xs:annotation>
				<xs:documentation>Optional. Indicates whether the property stores the last update timestamp of the entity. Default is false. This is automatically updated during entity modifications.</xs:documentation>
			</xs:annotation>
		</xs:attribute>
		<xs:attribute name="isInsertUserName" type="xs:boolean" default="false">
			<xs:annotation>
				<xs:documentation>Optional. Indicates whether the property stores the username who created the entity. Default is false. This is automatically populated during entity creation.</xs:documentation>
			</xs:annotation>
		</xs:attribute>
		<xs:attribute name="isUpdateUserName" type="xs:boolean" default="false">
			<xs:annotation>
				<xs:documentation>Optional. Indicates whether the property stores the username who last updated the entity. Default is false. This is automatically updated during entity modifications.</xs:documentation>
			</xs:annotation>
		</xs:attribute>
		<xs:attribute name="isInsertApplicationCode" type="xs:boolean" default="false">
			<xs:annotation>
				<xs:documentation>Optional. Indicates whether the property stores the application code that created the entity. Default is false. This is automatically populated during entity creation.</xs:documentation>
			</xs:annotation>
		</xs:attribute>
		<xs:attribute name="isUpdateApplicationCode" type="xs:boolean" default="false">
			<xs:annotation>
				<xs:documentation>Optional. Indicates whether the property stores the application code that last updated the entity. Default is false. This is automatically updated during entity modifications.</xs:documentation>
			</xs:annotation>
		</xs:attribute>
		<xs:attribute name="isUpdateStamp" type="xs:boolean" default="false">
			<xs:annotation>
				<xs:documentation>Optional. Indicates whether the property is an automatically generated update stamp for optimistic concurrency control. Default is false.</xs:documentation>
			</xs:annotation>
		</xs:attribute>
		<xs:attribute name="validation">
			<xs:annotation>
				<xs:documentation>Optional. Specifies the validation rule for the property. Built-in rules (`Email`, `Phone`, `Zip`, `BankAccount`, `Ssn`, `Bic`, `SsnOrBic`, `Range`, `ValueList`, `IsTrue`, `Regex`) emit the corresponding check inline. `Custom` emits a CALL to a `Validate[PropertyName]Custom()` method that YOU must provide on the partial class; it should return `null` on success or an error message string. The generator does NOT emit the hook method itself — supply it yourself.</xs:documentation>
			</xs:annotation>
			<xs:simpleType>
				<xs:restriction base="xs:string">
					<xs:enumeration value="Range"/>
					<xs:enumeration value="ValueList"/>
					<xs:enumeration value="IsTrue"/>
					<xs:enumeration value="Regex"/>
					<xs:enumeration value="Email"/>
					<xs:enumeration value="Zip"/>
					<xs:enumeration value="BankAccount"/>
					<xs:enumeration value="Phone"/>
					<xs:enumeration value="Ssn"/>
					<xs:enumeration value="Bic"/>
					<xs:enumeration value="SsnOrBic"/>
					<xs:enumeration value="CreditCard"/>
					<xs:enumeration value="Custom"/>
				</xs:restriction>
			</xs:simpleType>

		</xs:attribute>
		<xs:attribute name="validationContext" type="xs:string">
			<xs:annotation>
				<xs:documentation>Optional. Specifies validation context for the property. Typically country code like FI that defines detailed validation logic. Give model property where context is read with syntax: {propertyName}. Typically f.ex {CountryCode}. For validation types Ssn, Bic, SsnOrBic: use country code (mandatory). For validation types BankAccount, Phone: use country code (optional). For Regex: give reqex here.</xs:documentation>
			</xs:annotation>
		</xs:attribute>
		<xs:attribute name="validationMessage" type="xs:string">
			<xs:annotation>
				<xs:documentation>Optional. Specifies validation message when validation fails. Use {FieldName}, {MinValue}, {MaxValue}, {ValueList}, {Context} tags if needed. Language text.</xs:documentation>
			</xs:annotation>
		</xs:attribute>
		<xs:attribute name="validationMinValue" type="xs:string">
			<xs:annotation>
				<xs:documentation>Optional. Specifies min value for validation rule. Decimal format. Required if validation is Range.</xs:documentation>
			</xs:annotation>
		</xs:attribute>
		<xs:attribute name="validationMaxValue" type="xs:string">
			<xs:annotation>
				<xs:documentation>Optional. Specifies max value for validation rule. Decimal format. Required if validation is Range.</xs:documentation>
			</xs:annotation>
		</xs:attribute>
		<xs:attribute name="validationValueList" type="xs:string">
			<xs:annotation>
				<xs:documentation>Optional. Allowed options for validation. Comma separated list. Required if validation is ValueList.</xs:documentation>
			</xs:annotation>
		</xs:attribute>
		<xs:attribute name="validationCondition" type="xs:string">
			<xs:annotation>
				<xs:documentation>Optional. Specify condition when validation check is valid. Use native language syntax.</xs:documentation>
			</xs:annotation>
		</xs:attribute>
		<xs:attribute name="required" type="xs:boolean">
			<xs:annotation>
				<xs:documentation>Optional. Specifies if field is required.</xs:documentation>
			</xs:annotation>
		</xs:attribute>
		<xs:attribute name="requiredMessage" type="xs:string">
			<xs:annotation>
				<xs:documentation>Optional. Specifies error message when required check fails. Use {FieldName} tag if needed. Language text.</xs:documentation>
			</xs:annotation>
		</xs:attribute>
		<xs:attribute name="requiredCondition" type="xs:string">
			<xs:annotation>
				<xs:documentation>Optional. Specify condition when required check is valid. Use native language syntax.</xs:documentation>
			</xs:annotation>
		</xs:attribute>


	</xs:complexType>


	<xs:complexType name="EnumerationItemMappingType">
		<xs:annotation>
			<xs:documentation>Per-mapping redirect of an Item to a target enumeration + item when generating for an alternate model / repository.</xs:documentation>
		</xs:annotation>
		<xs:attribute name="mapping" type="xs:string">
			<xs:annotation>
				<xs:documentation>Optional. The name of the mapping. If not specified, the default model mapping is used.</xs:documentation>
			</xs:annotation>
		</xs:attribute>
		<xs:attribute name="targetEnumeration" type="xs:string" use="required">
			<xs:annotation>
				<xs:documentation>Required. The name of the target enumeration for the mapping.</xs:documentation>
			</xs:annotation>
		</xs:attribute>
		<xs:attribute name="targetItem" type="xs:string" use="required">
			<xs:annotation>
				<xs:documentation>Required. The name of the target item in the target enumeration.</xs:documentation>
			</xs:annotation>
		</xs:attribute>
		<xs:attribute name="reverseTargetItems" type="xs:string">
			<xs:annotation>
				<xs:documentation>Optional. Comma-separated list of reverse target items for bidirectional mapping.</xs:documentation>
			</xs:annotation>
		</xs:attribute>
	</xs:complexType>

	<xs:complexType name="EnumerationItemType">
		<xs:annotation>
			<xs:documentation>A single named value inside an Enumeration. Carries value/code/label plus optional mappings to items in other enumerations.</xs:documentation>
		</xs:annotation>
		<xs:sequence>
			<xs:element name="EnumerationItemMapping" type="EnumerationItemMappingType" minOccurs="0" maxOccurs="unbounded"/>
		</xs:sequence>
		<xs:attribute name="name" type="xs:string" use="required">
			<xs:annotation>
				<xs:documentation>Required. The name of the enumeration item. This will be used as the enumeration value name in generated code.</xs:documentation>
			</xs:annotation>
		</xs:attribute>
		<xs:attribute name="value" type="xs:string">
			<xs:annotation>
				<xs:documentation>Optional. The numeric value of the enumeration item. If not specified, values are assigned sequentially starting from the configured EnumerationStartValue (default 1), or incrementing from the previous item's value.</xs:documentation>
			</xs:annotation>
		</xs:attribute>
		<xs:attribute name="code" type="xs:string">
			<xs:annotation>
				<xs:documentation>Optional. A code identifier for the enumeration item. This can be used for additional identification purposes.</xs:documentation>
			</xs:annotation>
		</xs:attribute>
		<xs:attribute name="documentation" type="xs:string">
			<xs:annotation>
				<xs:documentation>Optional. Documentation comments for the enumeration item. This will be included in generated code documentation.</xs:documentation>
			</xs:annotation>
		</xs:attribute>
		<xs:attribute name="label" type="xs:string">
			<xs:annotation>
				<xs:documentation>Optional. User-facing description of the enumeration item. Supports multilingual text format where translations are given after language code in square brackets (e.g., "Default text[fi]Suomenkielinen teksti"). If empty, a display name is automatically generated from the item name using camel case conversion.</xs:documentation>
			</xs:annotation>
		</xs:attribute>
	</xs:complexType>

	<xs:complexType name="EnumerationType">
		<xs:annotation>
			<xs:documentation>A named set of Items. Drives generated enum types and lookup controls. Declares shared attributes (mappings, null inclusion).</xs:documentation>
		</xs:annotation>
		<xs:sequence>
			<xs:element name="EnumerationItem" type="EnumerationItemType" maxOccurs="unbounded"/>
		</xs:sequence>
		<xs:attribute name="name" type="xs:string" use="required">
			<xs:annotation>
				<xs:documentation>Required. The name of the enumeration type. This will be used as the enumeration type name in generated code.</xs:documentation>
			</xs:annotation>
		</xs:attribute>
		<xs:attribute name="nullIncluded" type="xs:boolean" default="true">
			<xs:annotation>
				<xs:documentation>Optional. Indicates whether a NULL value (with numeric value 0) should be automatically added to the enumeration. Default is true.</xs:documentation>
			</xs:annotation>
		</xs:attribute>
		<xs:attribute name="nullDescription" type="xs:string" >
			<xs:annotation>
				<xs:documentation>Optional. The description text for the NULL value when nullIncluded is true. Default is '-'.</xs:documentation>
			</xs:annotation>
		</xs:attribute>
	</xs:complexType>

	<xs:complexType  name="MappingType">
		<xs:annotation>
			<xs:documentation>Maps a Model to a target entity (database table, view, archive table, datawarehouse dim/stage) for one persistence flavour. Each Mapping carries the target entity name, optional field-name prefix, and per-flavour overrides (view, audit-trail, archive, datawarehouse).</xs:documentation>
		</xs:annotation>
		<xs:attribute name="name" type="xs:string" >
			<xs:annotation>
				<xs:documentation>The name of the mapping. Optional.</xs:documentation>
			</xs:annotation>
		</xs:attribute>

		<xs:attribute name="targetFieldPrefix" type="xs:string">
			<xs:annotation>
				<xs:documentation>The prefix for target fields. Optional.</xs:documentation>
			</xs:annotation>
		</xs:attribute>
		<xs:attribute name="targetFieldSuffix" type="xs:string">
			<xs:annotation>
				<xs:documentation>The suffix appended to target fields. Optional. Composed with targetFieldPrefix and the property name when an explicit &lt;PropertyMapping targetName=…&gt; is not provided: `{prefix}{PropertyName}{suffix}`.</xs:documentation>
			</xs:annotation>
		</xs:attribute>
		<xs:attribute name="targetNameCase">
			<xs:annotation>
				<xs:documentation>Optional. Naming convention applied to the property name when composing the column name on the implicit path: `{prefix}{transform(PropertyName)}{suffix}`. Default is Preserve (no transform — keep the property's original casing). Use Snake for snake_case columns, Kebab for kebab-case, Camel / Pascal for cross-language naming bridges, UpperSnake for SCREAMING_SNAKE constants-style identifiers.</xs:documentation>
			</xs:annotation>
			<xs:simpleType>
				<xs:restriction base="xs:string">
					<xs:enumeration value="Preserve"/>
					<xs:enumeration value="Snake"/>
					<xs:enumeration value="Kebab"/>
					<xs:enumeration value="Camel"/>
					<xs:enumeration value="Pascal"/>
					<xs:enumeration value="UpperSnake"/>
				</xs:restriction>
			</xs:simpleType>
		</xs:attribute>
		<xs:attribute name="targetEntity" type="xs:string" use="required">
			<xs:annotation>
				<xs:documentation>The target entity for the mapping (e.g. database table name, name of other model). Required.</xs:documentation>
			</xs:annotation>
		</xs:attribute>
		<xs:attribute name="targetPath" type="xs:string" use="optional">
			<xs:annotation>
				<xs:documentation>File path to the target entity if target is other model. Required if type is Model and target model is located in other directory.</xs:documentation>
			</xs:annotation>
		</xs:attribute>
		<xs:attribute name="type" use="required">
			<xs:annotation>
				<xs:documentation>The type of the mapping (e.g., Model, OperationalEntity). Model mapping describe how 2 models are mapped. Entity mappings describe how model is mapped to repository entity (database table). </xs:documentation>
			</xs:annotation>
			<xs:simpleType>
				<xs:restriction base="xs:string">
					<xs:enumeration value="OperationalEntity"/>
					<xs:enumeration value="AuditTrailEntity"/>
					<xs:enumeration value="ArchiveEntity"/>
					<xs:enumeration value="DatawarehouseEntity"/>
					<xs:enumeration value="Model"/>
				</xs:restriction>
			</xs:simpleType>
		</xs:attribute>
		<xs:attribute name="viewEntity" type="xs:string">
			<xs:annotation>
				<xs:documentation>The target entity for the mapping regarding simple views (e.g. database view name). Optional.</xs:documentation>
			</xs:annotation>
		</xs:attribute>
		<xs:attribute name="extendedViewEntity" type="xs:string">
			<xs:annotation>
				<xs:documentation>The target entity for the mapping regarding extended views (e.g. database view name). Optional.</xs:documentation>
			</xs:annotation>
		</xs:attribute>
		<xs:attribute name="stageEntity" type="xs:string">
			<xs:annotation>
				<xs:documentation>The target entity for the mapping regarding staging tables. Optional.</xs:documentation>
			</xs:annotation>
		</xs:attribute>
	</xs:complexType>



	<xs:complexType name="RepositoryType">
		<xs:annotation>
			<xs:documentation>A storage binding for a Model. Repositories describe WHERE the model is persisted: Operational (live table), AuditTrail (history), Archive / ArchivePartition (cold storage, optionally partitioned), or Datawarehouse (BI). A model can declare several repositories and cross-reference them (e.g. Operational → archiveRepositoryName).</xs:documentation>
		</xs:annotation>
		<xs:attribute name="name" type="xs:string">
			<xs:annotation>
				<xs:documentation>The name of the repository. Required only if multiple repositories per type.</xs:documentation>
			</xs:annotation>
		</xs:attribute>
		<xs:attribute name="mappingName" type="xs:string">
			<xs:annotation>
				<xs:documentation>Optional. The name of the mapping associated with the repository. If not given mapping is implicitely created for repository. This is typical if database table and field names are equivalent to property names.</xs:documentation>
			</xs:annotation>
		</xs:attribute>
		<xs:attribute name="default" type="xs:boolean" default="false">
			<xs:annotation>
				<xs:documentation>Indicates if this is the default repository. REQUIRED when multiple repositories share the same `type`; automatically promoted to `true` when only ONE repository of a given type exists (so in the common case you can omit it). Default is false.</xs:documentation>
			</xs:annotation>
		</xs:attribute>
		<xs:attribute name="type" use="required">
			<xs:annotation>
				<xs:documentation>The type of the repository (e.g. Operational, AuditTrail, etc.).</xs:documentation>
			</xs:annotation>
			<xs:simpleType>
				<xs:restriction base="xs:string">
					<xs:enumeration value="Operational"/>
					<xs:enumeration value="AuditTrail"/>
					<xs:enumeration value="Archive"/>
					<xs:enumeration value="ArchivePartition"/>
					<xs:enumeration value="Datawarehouse"/>
				</xs:restriction>
			</xs:simpleType>
		</xs:attribute>
		<xs:attribute name="archiveRepositoryName" type="xs:string">
			<xs:annotation>
				<xs:documentation>The name of the related archive repository. Only for Operational repositories. Not needed if only 1 archive repository. Optional.</xs:documentation>
			</xs:annotation>
		</xs:attribute>
		<xs:attribute name="auditTrailRepositoryName" type="xs:string">
			<xs:annotation>
				<xs:documentation>The name of the audit trail repository. Only for Operational repositories. Not needed if only 1 audit trail repository. Optional.</xs:documentation>
			</xs:annotation>
		</xs:attribute>
		<xs:attribute name="datawarehouseRepositoryName" type="xs:string">
			<xs:annotation>
				<xs:documentation>The name of the datawarehouse repository. Only for Operational repositories. Not needed if only 1 datawarehouse repository. Optional.</xs:documentation>
			</xs:annotation>
		</xs:attribute>
		<xs:attribute name="partitionProperty" type="xs:string">
			<xs:annotation>
				<xs:documentation>If partitioned archive (type Archive), name of the property used for partitioning. Allowed Int, Date, DateTime properties. Optional.</xs:documentation>
			</xs:annotation>
		</xs:attribute>
		<xs:attribute name="partitionStart" type="xs:string">
			<xs:annotation>
				<xs:documentation>If archive partition, start of partition. Allowed Int, Date, DateTime properties. Optional.</xs:documentation>
			</xs:annotation>
		</xs:attribute>
		<xs:attribute name="partitionEnd" type="xs:string">
			<xs:annotation>
				<xs:documentation>If archive partition, end of partition. Allowed Int, Date, DateTime properties. Optional.</xs:documentation>
			</xs:annotation>
		</xs:attribute>
	</xs:complexType>

	<xs:complexType name="PropertyGroupType">
		<xs:annotation>
			<xs:documentation>Groups a set of Properties for organizational + UI purposes. Group-level settings (readOnly, hidden, colSpan, section names, mapping exclusions, DW flags) cascade to every child Property unless overridden at Property or PropertyView level.</xs:documentation>
		</xs:annotation>
		<xs:sequence>
			<xs:element name="Property" type="PropertyType" maxOccurs="unbounded"/>
		</xs:sequence>
		<xs:attribute name="name" type="xs:string">
			<xs:annotation>
				<xs:documentation>Optional. The name of the property group. Used for grouping related properties together for organizational or UI purposes.</xs:documentation>
			</xs:annotation>
		</xs:attribute>
		<xs:attribute name="excludedMappings" type="xs:string">
			<xs:annotation>
				<xs:documentation>Optional. Comma-separated list of mapping names where all properties in this group should be excluded.</xs:documentation>
			</xs:annotation>
		</xs:attribute>
		<xs:attribute name="readViewSectionName" type="xs:string">
			<xs:annotation>
				<xs:documentation>Optional. Section name for the default read view. All properties in this group will be included in the specified section.</xs:documentation>
			</xs:annotation>
		</xs:attribute>
		<xs:attribute name="updateViewSectionName" type="xs:string">
			<xs:annotation>
				<xs:documentation>Optional. Section name for the default update view. All properties in this group will be included in the specified section.</xs:documentation>
			</xs:annotation>
		</xs:attribute>
		<xs:attribute name="readOnly" type="xs:boolean" default="false">
			<xs:annotation>
				<xs:documentation>Optional. Indicates whether all properties in this group are read-only. Default is false.</xs:documentation>
			</xs:annotation>
		</xs:attribute>
		<xs:attribute name="excludedDw" type="xs:boolean" default="false">
			<xs:annotation>
				<xs:documentation>Optional. Indicates whether all properties in this group should be excluded from data warehouse models. Default is false.</xs:documentation>
			</xs:annotation>
		</xs:attribute>
		<xs:attribute name="includedDw" type="xs:boolean" default="false">
			<xs:annotation>
				<xs:documentation>Optional. Indicates whether all properties in this group should be included in data warehouse models. Default is false.</xs:documentation>
			</xs:annotation>
		</xs:attribute>
		<xs:attribute name="state" type="xs:boolean" default="false">
			<xs:annotation>
				<xs:documentation>Optional. Indicates whether all properties in this group describe the state of the entity. Default is false.</xs:documentation>
			</xs:annotation>
		</xs:attribute>
		<xs:attribute name="hidden" type="xs:boolean" default="false">
			<xs:annotation>
				<xs:documentation>Optional. Indicates whether all properties in this group are hidden in the default view. Default is false.</xs:documentation>
			</xs:annotation>
		</xs:attribute>
		<xs:attribute name="colSpan" type="xs:integer">
			<xs:annotation>
				<xs:documentation>Optional. Group-level default for colSpan in the inheritance chain (PropertyView &gt; Property &gt; PropertyGroup &gt; ModelView). Applies to every child Property that does not set its own colSpan or PropertyView.colSpan.</xs:documentation>
			</xs:annotation>
		</xs:attribute>
	</xs:complexType>

	<xs:complexType name="ModelViewType">
		<xs:annotation>
			<xs:documentation>A single view (Update / Read / List) rendered for this model. Drives generated view artifacts (XAML / TSX). The `mode` of the parent ModelViewModel determines what kind of view this is; attributes here describe the view's layout (colCount, colSpan default, column-name hints).</xs:documentation>
		</xs:annotation>
		<xs:attribute name="name" type="xs:string">
			<xs:annotation>
				<xs:documentation>Optional. The name of the model view. Defaults to [modelName][mode]View. Mandatory if default leads to duplicate.</xs:documentation>
			</xs:annotation>
		</xs:attribute>
		<xs:attribute name="namespace" type="xs:string">
			<xs:annotation>
				<xs:documentation>Optional. The namespace of the model view. Defaults to model view model namespace.</xs:documentation>
			</xs:annotation>
		</xs:attribute>
		<xs:attribute name="default" type="xs:boolean" default="false">
			<xs:annotation>
				<xs:documentation>Indicates if this is the default view. Default is false.</xs:documentation>
			</xs:annotation>
		</xs:attribute>
		<xs:attribute name="includeAllProperties" type="xs:boolean" default="false">
			<xs:annotation>
				<xs:documentation>Sugar shortcut that bubbles up to set includeAllProperties=true on the parent ModelViewModel — see that attribute for the selection semantics. No independent meaning when set only on the View.</xs:documentation>
			</xs:annotation>
		</xs:attribute>
		<xs:attribute name="genericSearchParameterDisplayName" type="xs:string">
			<xs:annotation>
				<xs:documentation>The display name for the generic search parameter. Language text. Optional.</xs:documentation>
			</xs:annotation>
		</xs:attribute>
		<xs:attribute name="showInactiveSearchParameterDisplayName" type="xs:string">
			<xs:annotation>
				<xs:documentation>The display name for the show inactive search parameter. Language text. Optional.</xs:documentation>
			</xs:annotation>
		</xs:attribute>
		<xs:attribute name="colCount" type="xs:int">
			<xs:annotation>
				<xs:documentation>Number of columns in view. Preferred name (columnCount accepted as legacy alt). Default 2.</xs:documentation>
			</xs:annotation>
		</xs:attribute>
		<xs:attribute name="colSpan" type="xs:integer">
			<xs:annotation>
				<xs:documentation>Optional. View-level fallback default (lowest tier in the colSpan inheritance chain: PropertyView &gt; Property &gt; PropertyGroup &gt; ModelView). Applies only when none of the higher tiers set colSpan.</xs:documentation>
			</xs:annotation>
		</xs:attribute>
		<xs:attribute name="displayName" type="xs:string">
			<xs:annotation>
				<xs:documentation>View name on screen. Language text. Optional.</xs:documentation>
			</xs:annotation>
		</xs:attribute>
	</xs:complexType>

	<xs:complexType name="CommandType">
		<xs:annotation>
			<xs:documentation>A button / operation exposed by a ModelViewModel. The generator emits VM methods + their canExecute guards from these. `type` classifies the semantic role (Save/Close/Search/Execute/Cancel/View/Custom); `Custom` is the default and allows arbitrary user-defined actions.</xs:documentation>
		</xs:annotation>
		<xs:attribute name="name" type="xs:string" use="required">
			<xs:annotation>
				<xs:documentation>The name of the command.</xs:documentation>
			</xs:annotation>
		</xs:attribute>
		<xs:attribute name="type">
			<xs:annotation>
				<xs:documentation>
Optional. Defaults to `Custom`. Determines whether this entry adds a brand-new
command (`Custom`) or OVERRIDES one of the framework's built-in commands that the
generator emits implicitly for the enclosing view-model's mode.

Built-in (framework) commands — declare a `&lt;Command type="..."/&gt;` with the matching
`type` to inject custom `label`, `message`, `customUserRight` /
`customUserRightCommand` and `canExecuteCondition`. The
generator finds the entry by `type`, applies your attributes, and keeps the
mode-specific wiring (IsAsync, IsNavigationCommand, CanExecuteWithValidationErrors,
…) the framework attaches to that command type:

  * `Save`   — implicit on Update view models. Commit-the-edits action; default
               CanExecute requires HasErrors == false.
  * `Search` — implicit on List view models. Re-runs the paginated search.
  * `View`   — implicit on List view models (one per Model-reference property).
               Opens the selected row's Read / Update view.
  * `Cancel` — implicit on Update / Read view models. Discard / back navigation;
               CanExecute ignores validation errors.
  * `Close`  — implicit on Update / Read view models. Closes the page;
               CanExecute ignores validation errors.

`Custom` (default) — defines a NEW command with the given `name` that the
framework knows nothing about. The generator emits an abstract method (and its
wrapper) which the derived class implements. Use for project-specific actions
(Approve, Archive, Recalc, ...).
				</xs:documentation>
			</xs:annotation>
			<xs:simpleType>
				<xs:restriction base="xs:string">
					<xs:enumeration value="Save"/>
					<xs:enumeration value="View"/>
					<xs:enumeration value="Search"/>
					<xs:enumeration value="Cancel"/>
					<xs:enumeration value="Close"/>
					<xs:enumeration value="Create"/>
					<xs:enumeration value="Custom"/>
				</xs:restriction>
			</xs:simpleType>
		</xs:attribute>
		<xs:attribute name="message" type="xs:string">
			<xs:annotation>
				<xs:documentation>Optional. Message shown after successful execution. Language text.</xs:documentation>
			</xs:annotation>
		</xs:attribute>
		<xs:attribute name="label" type="xs:string">
			<xs:annotation>
				<xs:documentation>The display name of the command. Optional.</xs:documentation>
			</xs:annotation>
		</xs:attribute>
		<xs:attribute name="customUserRight" type="xs:string">
			<xs:annotation>
				<xs:documentation>Optional override for the user-right bucket the command's `hasUserRight(...)` check resolves against. Defaults to the parent ViewModel's name (= the auto-derived bucket). Set when the command should be governed by a different bucket than its hosting VM (e.g. a single "ProductEditing" bucket shared by Save + Close on the Update view).</xs:documentation>
			</xs:annotation>
		</xs:attribute>
		<xs:attribute name="customUserRightCommand" type="xs:string">
			<xs:annotation>
				<xs:documentation>Optional override for the command-level key spliced into `hasUserRight(bucket, command)`. Defaults to the command's `name` attribute. Set when multiple commands should share a single command-level right (e.g. Save + Close both use `customUserRightCommand="EditProducts"`), to align with an existing org-defined right name, or to decouple the displayed label from the underlying right.</xs:documentation>
			</xs:annotation>
		</xs:attribute>
		<xs:attribute name="canExecuteCondition" type="xs:string">
			<xs:annotation>
				<xs:documentation>Optional. Boolean expression spliced into the button's enable check. Use the host language's own syntax (TypeScript for React, C# for WPF, ...).

Multi-flavour syntax (same shape as `label`'s language tags) lets ONE attribute cover multiple view-model types when the expression has to differ:

    [react]this.amount &gt; 0[wpf]Amount &gt; 0[reactNative]this.amount &gt; 0

Rules:
  * Plain text without `[...]` markers is used as-is for every view-model type.
  * Text BEFORE the first `[` is the default fallback when no marker matches.
  * Each `[code]value` segment targets one view-model type. Codes:
        react        — React VM
        wpf          — WPF VM
        reactNative  — React Native VM
    Codes are case-insensitive, order doesn't matter.
  * Markers are picked at code-generation time, so each generated VM gets only its own variant.</xs:documentation>
			</xs:annotation>
		</xs:attribute>
		<xs:attribute name="selectedParameter" type="xs:boolean" default="false">
			<xs:annotation>
				<xs:documentation>Optional. Indicates if this is targeted to selected row in list view. Default is false.</xs:documentation>
			</xs:annotation>
		</xs:attribute>
		<xs:attribute name="relatedProperty" type="xs:string">
			<xs:annotation>
				<xs:documentation>Optional. Name of a model property the command operates on (e.g. a Ref property the command opens / loads / searches against). Used to bind the command to a specific RelatedViewModelProperty so the generator can wire the abstract / wrapper pair against that property.</xs:documentation>
			</xs:annotation>
		</xs:attribute>
		<xs:attribute name="documentation" type="xs:string">
			<xs:annotation>
				<xs:documentation>Optional. Summary documentation for the command. Becomes the abstract method's doc summary in the generated derived-class stub so the AI / dev reads the intent (e.g. "open ProductReadView") while filling in the body.</xs:documentation>
			</xs:annotation>
		</xs:attribute>
		<xs:attribute name="style" type="xs:string">
			<xs:annotation>
				<xs:documentation>Optional. Extra CSS class name(s) appended to the generated button's className (React) / Style (Xaml). Use to target the button in a per-view stylesheet without having to scope by the mode/section wrapper classes — e.g. `style="primary-cta"` makes `&lt;BsButton className="primary-cta mg-bs-..."/&gt;`. Whitespace-separated values are emitted verbatim.</xs:documentation>
			</xs:annotation>
		</xs:attribute>
	</xs:complexType>

	<xs:complexType name="ModelViewModelType">
		<xs:annotation>
			<xs:documentation>A generated ViewModel bundle tied to a Model and a mode (Read / Update / List / Dialog). Contains 0..N ModelViews (the visual layouts) and 0..N Commands (operations wired to the VM). Drives the ViewModel class generation.</xs:documentation>
		</xs:annotation>
		<xs:all>
			<xs:element name="ModelViews" minOccurs="0" maxOccurs="1">
				<xs:complexType>
					<xs:sequence>
						<xs:element name="ModelView" type="ModelViewType" maxOccurs="unbounded"/>
					</xs:sequence>
				</xs:complexType>
			</xs:element>
			<xs:element name="Commands" minOccurs="0" maxOccurs="1">
				<xs:complexType>
					<xs:sequence>
						<xs:element name="Command" type="CommandType" maxOccurs="unbounded"/>
					</xs:sequence>
				</xs:complexType>
			</xs:element>
		</xs:all>
		<xs:attribute name="name" type="xs:string">
			<xs:annotation>
				<xs:documentation>Optional. The name of the model view model. Defaults to [modelName][mode]ViewModel. Mandatory only if the default would lead to a duplicate within the model.</xs:documentation>
			</xs:annotation>
		</xs:attribute>
		<xs:attribute name="mode" use="required">
			<xs:annotation>
				<xs:documentation>The mode of the model view model. Default is Read. Only Read / Update / List are valid for model-driven view models — the WPF and React MVM generators reject Dialog / Page / Wizard at parse time. Use a standalone &lt;ViewModel&gt; XML for Dialog / Page / Wizard view models.</xs:documentation>
			</xs:annotation>
			<xs:simpleType>
				<xs:restriction base="xs:string">
					<xs:enumeration value="Read"/>
					<xs:enumeration value="Update"/>
					<xs:enumeration value="List"/>
				</xs:restriction>
			</xs:simpleType>
		</xs:attribute>
		<xs:attribute name="namespace" type="xs:string">
			<xs:annotation>
				<xs:documentation>Optional. The namespace of the model view model. Inherited from the parent model when omitted.</xs:documentation>
			</xs:annotation>
		</xs:attribute>
		<xs:attribute name="includeAllProperties" type="xs:boolean" default="false">
			<xs:annotation>
				<xs:documentation>When true, every model property is auto-included in the matching view (Update / Read). When false (default), inclusion is per-property:

  * Update view: include only properties that carry updateViewSectionName="..." (placed under that named section).
  * Read view:   include only properties that carry readViewSectionName="..."   (placed under that named section).
  * List view:   includeAllProperties has NO effect — List always selects per-property via listColumn / listSearchParameter (set on Property or on a child PropertyView). Set the flag freely on a List ModelViewModel; it's silently ignored.

A property can also opt into a single specific view via a child &lt;PropertyView viewName="..."/&gt; (or mode="..."), independent of the flags above.</xs:documentation>
			</xs:annotation>
		</xs:attribute>
		<xs:attribute name="includeGenericSearchParameter" type="xs:boolean" default="false">
			<xs:annotation>
				<xs:documentation>Optional. Only for mode=List. When true, the generated ListViewModel exposes a `GenericSearchParameter : string` property that binds to the view's generic search box. The repository Search/Select call ORs this across all string-searchable columns. Default false.</xs:documentation>
			</xs:annotation>
		</xs:attribute>
		<xs:attribute name="includeShowInactiveSearchParameter" type="xs:boolean" default="false">
			<xs:annotation>
				<xs:documentation>Optional. Only for mode=List. When true, the generated ListViewModel exposes a `ShowInactiveSearchParameter : bool` property that binds to a "show inactive" toggle in the view. Toggling it widens the repository query to include rows marked as inactive via the Model's `state` property. Default false.</xs:documentation>
			</xs:annotation>
		</xs:attribute>
		<xs:attribute name="customUserRight" type="xs:string">
			<xs:annotation>
				<xs:documentation>Optional override for the user-right bucket all commands on this ModelViewModel resolve against. Three meanings: (1) unset → bucket = the ModelViewModel's name (the default). (2) "None" → the `&amp;&amp; UserContext.hasUserRight(...)` clause is OMITTED from every canExecute getter on this VM; use for anonymous / sign-up flows where every command runs before the user has earned any rights. (3) any other value → bucket = that value (e.g. `customUserRight="ProductEditing"` on the Update VM shares the bucket across multiple VMs). A per-`&lt;Command&gt;` `customUserRight` still wins over this VM-level setting.</xs:documentation>
			</xs:annotation>
		</xs:attribute>
	</xs:complexType>

	<xs:complexType name="DwModelType">
		<xs:annotation>
			<xs:documentation>A single data-warehouse-model binding. Defines the DW entity type (Dim/Fact) and property-inclusion rule for this model in DW generation.</xs:documentation>
		</xs:annotation>
		<xs:attribute name="type" use="required">
			<xs:annotation>
				<xs:documentation>The type of the datawarehouse entity.</xs:documentation>
			</xs:annotation>
			<xs:simpleType>
				<xs:restriction base="xs:string">
					<xs:enumeration value="Dim"/>
					<xs:enumeration value="Fact"/>
				</xs:restriction>
			</xs:simpleType>
		</xs:attribute>
		<xs:attribute name="name" type="xs:string" use="required"/>
		<xs:attribute name="stageModelName" type="xs:string" use="required"/>
		<xs:attribute name="includeProperties" use="required">
			<xs:annotation>
				<xs:documentation>Rule how properties are included in Dw model. Property specific definitions override this.</xs:documentation>
			</xs:annotation>
			<xs:simpleType>
				<xs:restriction base="xs:string">
					<xs:enumeration value="All"/>
					<xs:enumeration value="AllButStateAndAudit"/>
					<xs:enumeration value="AllButState"/>
					<xs:enumeration value="AllButAudit"/>
					<xs:enumeration value="None"/>
				</xs:restriction>
			</xs:simpleType>
		</xs:attribute>
	</xs:complexType>

	<xs:complexType name="IndexPropertyType">
		<xs:annotation>
			<xs:documentation>One property reference inside a database Index.</xs:documentation>
		</xs:annotation>
		<xs:attribute name="name" type="xs:string" use="required"/>
	</xs:complexType>

	<xs:complexType name="IndexType">
		<xs:annotation>
			<xs:documentation>A database index definition on the model. Contains one or more IndexProperty children defining the indexed columns in order.</xs:documentation>
		</xs:annotation>
		<xs:sequence>
			<xs:element name="IndexProperty" type="IndexPropertyType" minOccurs="1" maxOccurs="unbounded"/>
		</xs:sequence>
		<xs:attribute name="name" type="xs:string" use="required"/>
	</xs:complexType>


</xs:schema>
