﻿<?xml version="1.0" encoding="UTF-8"?>
<xs:schema 
	xmlns:xs="http://www.w3.org/2001/XMLSchema" 
	targetNamespace="https://tnventures.fi/modelgenerator/xmlschemas/service/v1"
    xmlns="https://tnventures.fi/modelgenerator/xmlschemas/service/v1"
	elementFormDefault="qualified">
	
	<xs:complexType name="ParameterType">
		<xs:annotation>
			<xs:documentation>Defines a method parameter — name, type, mandatory flag, and optional binding hints (route / query / body).</xs:documentation>
		</xs:annotation>
		<xs:attribute name="name" type="xs:string" use="required">
			<xs:annotation>
				<xs:documentation>Required. The name of the parameter. This will be used as the parameter name in generated code. If the method route contains {name}, this parameter will be treated as a route parameter; otherwise it will be a query parameter (for GET methods) or body parameter (for other HTTP methods).</xs:documentation>
			</xs:annotation>
		</xs:attribute>
		<xs:attribute name="type" use="required">
			<xs:annotation>
				<xs:documentation>Required. The data type of the parameter. Supported types: String, Int, Decimal, Bool, Id, DateTime, Date, Json, Xml, File, FilePath, DirPath, Enum (requires enum), Model (requires model; for a collection add `collection="List"`), Object (requires object).</xs:documentation>
			</xs:annotation>
			<xs:simpleType>
				<xs:restriction base="xs:string">
					<xs:enumeration value="String"/>
					<xs:enumeration value="Int"/>
					<xs:enumeration value="Decimal"/>
					<xs:enumeration value="Bool"/>
					<xs:enumeration value="Id"/>
					<xs:enumeration value="DateTime"/>
					<xs:enumeration value="Date"/>
					<xs:enumeration value="Enum"/>
					<xs:enumeration value="Model"/>
					<xs:enumeration value="Object"/>
					<xs:enumeration value="File"/>
					<xs:enumeration value="Json"/>
					<xs:enumeration value="Xml"/>
					<xs:enumeration value="DirPath"/>
					<xs:enumeration value="FilePath"/>
				</xs:restriction>
			</xs:simpleType>
		</xs:attribute>
		<xs:attribute name="mandatory" type="xs:boolean" default="false">
			<xs:annotation>
				<xs:documentation>Optional. Indicates whether the parameter is mandatory (not nullable). Default is false.</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 to use for this parameter.</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 type.</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 (e.g., "Dictionary&lt;String, object&gt;" for C#).</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, Array. Default is List.</xs:documentation>
			</xs:annotation>
			<xs:simpleType>
				<xs:restriction base="xs:string">
					<xs:enumeration value="List"/>
					<xs:enumeration value="Array"/>
				</xs:restriction>
			</xs:simpleType>
		</xs:attribute>
		<xs:attribute name="objectNamespace" type="xs:string">
			<xs:annotation>
				<xs:documentation>Optional. Relevant if type is Object. If empty namespaces according imports / usings.</xs:documentation>
			</xs:annotation>
		</xs:attribute>
		<xs:attribute name="modelNamespace" type="xs:string">
			<xs:annotation>
				<xs:documentation>Optional. Relevant if type is Model. If empty namespaces according imports / usings.</xs:documentation>
			</xs:annotation>
		</xs:attribute>
		<xs:attribute name="enumNamespace" type="xs:string">
			<xs:annotation>
				<xs:documentation>Optional. Relevant if type is Enum. If empty namespaces according imports / usings.</xs:documentation>
			</xs:annotation>
		</xs:attribute>
		<xs:attribute name="documentation" type="xs:string">
			<xs:annotation>
				<xs:documentation>Optional. Documentation comments for the parameter. This will be included in generated code documentation.</xs:documentation>
			</xs:annotation>
		</xs:attribute>
	</xs:complexType>
	
	<xs:complexType name="ReturnParameterType">
		<xs:annotation>
			<xs:documentation>Defines the return type of a method — type and optional collection / model / object metadata.</xs:documentation>
		</xs:annotation>
		<xs:attribute name="name" type="xs:string">
			<xs:annotation>
				<xs:documentation>Optional. The name of the return parameter. Typically not used but can be specified for documentation purposes.</xs:documentation>
			</xs:annotation>
		</xs:attribute>
		<xs:attribute name="type" use="required">
			<xs:annotation>
				<xs:documentation>Required. The data type of the return value. Supported types: Void (no return value), String, Int, Decimal, Bool, Id, DateTime, Date, File, FilePath, DirPath, Json, Xml, Enum (requires enum), Model (requires model; for a collection add `collection="List"`), Object (requires object).</xs:documentation>
			</xs:annotation>
			<xs:simpleType>
				<xs:restriction base="xs:string">
					<xs:enumeration value="Void"/>
					<xs:enumeration value="String"/>
					<xs:enumeration value="Int"/>
					<xs:enumeration value="Decimal"/>
					<xs:enumeration value="Bool"/>
					<xs:enumeration value="Id"/>
					<xs:enumeration value="DateTime"/>
					<xs:enumeration value="Date"/>
					<xs:enumeration value="Enum"/>
					<xs:enumeration value="Model"/>
					<xs:enumeration value="Object"/>
					<xs:enumeration value="File"/>
					<xs:enumeration value="Json"/>
					<xs:enumeration value="Xml"/>
					<xs:enumeration value="DirPath"/>
					<xs:enumeration value="FilePath"/>
				</xs:restriction>
			</xs:simpleType>
		</xs:attribute>
		<xs:attribute name="mandatory" type="xs:boolean" default="false">
			<xs:annotation>
				<xs:documentation>Optional. Indicates whether the return value is mandatory (not nullable). Default is false. Not applicable when type is void.</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 for the return value.</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 type for the return value.</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, Array. Default is List.</xs:documentation>
			</xs:annotation>
			<xs:simpleType>
				<xs:restriction base="xs:string">
					<xs:enumeration value="List"/>
					<xs:enumeration value="Array"/>
				</xs:restriction>
			</xs:simpleType>
		</xs:attribute>
		<xs:attribute name="objectNamespace" type="xs:string">
			<xs:annotation>
				<xs:documentation>Optional. Relevant if type is Object. If empty namespaces according imports / usings.</xs:documentation>
			</xs:annotation>
		</xs:attribute>
		<xs:attribute name="modelNamespace" type="xs:string">
			<xs:annotation>
				<xs:documentation>Optional. Relevant if type is Model. If empty namespaces according imports / usings.</xs:documentation>
			</xs:annotation>
		</xs:attribute>
		<xs:attribute name="enumNamespace" type="xs:string">
			<xs:annotation>
				<xs:documentation>Optional. Relevant if type is Enum. If empty namespaces according imports / usings.</xs:documentation>
			</xs:annotation>
		</xs:attribute>
	</xs:complexType>
	
	<xs:complexType name="MethodType">
		<xs:annotation>
			<xs:documentation>Defines a service method / endpoint — name, HTTP verb, route, parameters, return type, authentication / authorization metadata, and documentation.</xs:documentation>
		</xs:annotation>
		<xs:sequence>
			<xs:element name="Parameter" type="ParameterType" minOccurs="0" maxOccurs="unbounded"/>
			<xs:element name="ReturnParameter" type="ReturnParameterType" minOccurs="0" maxOccurs="1"/>
			<xs:element name="Implementation" type="MethodImplementationType" minOccurs="0" maxOccurs="1">
				<xs:annotation>
					<xs:documentation>Optional. Declarative binding to a domain-service or sibling-service method. When present the generator emits the method body that delegates to the bound method, removing the need for an AI-implementation pass on this method. Without it the method is abstract on the base service and the AI implementation phase fills in the body. Same semantics as the equivalent block on AssistantSchema's `&lt;Tool&gt;`.</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 method. This will be used as the method name in generated code and as part of the route if endpoint is not specified.</xs:documentation>
			</xs:annotation>
		</xs:attribute>
		<xs:attribute name="route" type="xs:string">
			<xs:annotation>
				<xs:documentation>Optional. The complete HTTP route for the method. If not specified, the route is constructed from segment route, version, endpoint, and method name.</xs:documentation>
			</xs:annotation>
		</xs:attribute>
		<xs:attribute name="segment" type="xs:string">
			<xs:annotation>
				<xs:documentation>Optional. The segment name for grouping related methods. Used when methods are not nested within a Segment element.</xs:documentation>
			</xs:annotation>
		</xs:attribute>
		<xs:attribute name="version" type="xs:string">
			<xs:annotation>
				<xs:documentation>Optional. The API version identifier (e.g., "v1", "v2"). Used in route construction when route is not explicitly specified.</xs:documentation>
			</xs:annotation>
		</xs:attribute>
		<xs:attribute name="endpoint" type="xs:string">
			<xs:annotation>
				<xs:documentation>Optional. Additional endpoint path segment. Used in route construction when route is not explicitly specified. If not provided, the method name is used.</xs:documentation>
			</xs:annotation>
		</xs:attribute>
		<xs:attribute name="method" use="required">
			<xs:annotation>
				<xs:documentation>Required. The HTTP method type for this endpoint. Determines parameter handling: GET methods use query parameters, others use body parameters (unless specified in route as route parameters).</xs:documentation>
			</xs:annotation>
			<xs:simpleType>
				<xs:restriction base="xs:string">
					<xs:enumeration value="Get"/>
					<xs:enumeration value="Post"/>
					<xs:enumeration value="Put"/>
					<xs:enumeration value="Delete"/>
					<xs:enumeration value="Patch"/>
				</xs:restriction>
			</xs:simpleType>
		</xs:attribute>
		<xs:attribute name="targetService" type="xs:string">
			<xs:annotation>
				<xs:documentation>Optional. The target service implementation class name. If not specified, defaults to the service name.</xs:documentation>
			</xs:annotation>
		</xs:attribute>
		<xs:attribute name="targetMethod" type="xs:string">
			<xs:annotation>
				<xs:documentation>Optional. The target method name in the service implementation. If not specified, uses the method name.</xs:documentation>
			</xs:annotation>
		</xs:attribute>
		<xs:attribute name="authenticationRequired" type="xs:boolean" default="true">
			<xs:annotation>
				<xs:documentation>Optional. Indicates whether authentication is required for this method. Default is true.</xs:documentation>
			</xs:annotation>
		</xs:attribute>
		<xs:attribute name="documentation" type="xs:string">
			<xs:annotation>
				<xs:documentation>Optional. Summary documentation for the method. 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 method documentation. This will be included in generated code documentation as remarks section.</xs:documentation>
			</xs:annotation>
		</xs:attribute>
		<xs:attribute name="mapping" type="xs:string">
			<xs:annotation>
				<xs:documentation>Optional. Name of mapping to convert api models domain models.</xs:documentation>
			</xs:annotation>
		</xs:attribute>
		<xs:attribute name="async" type="xs:boolean">
			<xs:annotation>
				<xs:documentation>Optional. Is async method. Default is true.</xs:documentation>
			</xs:annotation>
		</xs:attribute>
		<xs:attribute name="userRight" type="xs:string">
			<xs:annotation>
				<xs:documentation>Optional. User-right bucket the caller must hold to invoke this method. Generator emits [RequireUserRight(userRight, userRightCommand?)] on the controller method; an ASP.NET filter (registered via services.AddUserRightsAuthorization) reads the JWT roles, runs them through IUserRightsResolver, and returns 403 when the resolved UserRights doesn't grant access. Mirrors the client-side UserContext.HasUserRight call emitted on the same right/command pair in the WPF/React VM. Omit to leave the method open to any authenticated caller.</xs:documentation>
			</xs:annotation>
		</xs:attribute>
		<xs:attribute name="userRightCommand" type="xs:string">
			<xs:annotation>
				<xs:documentation>Optional. Command-level key within the `userRight` bucket. Defaults to the method name. Use when several controller methods share a single command-level right (e.g. multiple admin endpoints all behind "AdminOps") or when the right name needs to differ from the method name.</xs:documentation>
			</xs:annotation>
		</xs:attribute>
		<xs:attribute name="signed" type="xs:boolean">
			<xs:annotation>
				<xs:documentation>Optional. Per-method override for the parent Service's `signed` setting. When set true, this method's request body must arrive with a valid X-Body-Signature header and the response is signed; when false, signing is skipped even if the parent Service has signed="true". Omit to inherit. Issue #79.</xs:documentation>
			</xs:annotation>
		</xs:attribute>
	</xs:complexType>

	<xs:complexType name="SegmentType">
		<xs:annotation>
			<xs:documentation>Groups related service methods under a shared route prefix. The segment's name is prepended to each child method's route, so methods sharing a logical area can be declared together.</xs:documentation>
		</xs:annotation>
		<xs:sequence>
			<xs:element name="Method" type="MethodType" minOccurs="0" maxOccurs="unbounded"/>
			<xs:element name="Segment" type="SegmentType" minOccurs="0" maxOccurs="unbounded"/>
		</xs:sequence>
		<xs:attribute name="name" type="xs:string" use="required">
			<xs:annotation>
				<xs:documentation>Required. The name of the segment. Used to logically group related methods in generated code.</xs:documentation>
			</xs:annotation>
		</xs:attribute>
		<xs:attribute name="route" type="xs:string">
			<xs:annotation>
				<xs:documentation>Optional. The route prefix for all methods within this segment. This route prefix is inherited by nested methods and segments.</xs:documentation>
			</xs:annotation>
		</xs:attribute>
	</xs:complexType>
	
	<!-- Root Element: Service definition -->
	<xs:element name="Service">
		<xs:complexType>
			<xs:sequence>
				<xs:element name="Methods" minOccurs="0" maxOccurs="1">
					<xs:complexType>
						<xs:choice minOccurs="0" maxOccurs="unbounded">
							<xs:element name="Method" type="MethodType"/>
							<xs:element name="Segment" type="SegmentType"/>
						</xs:choice>
					</xs:complexType>
				</xs:element>
			</xs:sequence>
			<xs:attribute name="name" type="xs:string" use="required">
				<xs:annotation>
					<xs:documentation>Required. The name of the service. This will be used as the service 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 service. This defines the namespace for generated service code.</xs:documentation>
				</xs:annotation>
			</xs:attribute>
			<xs:attribute name="partial" type="xs:boolean" default="false">
				<xs:annotation>
					<xs:documentation>Optional. Indicates whether the service 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="documentation" type="xs:string">
				<xs:annotation>
					<xs:documentation>Optional. Summary documentation for the service. 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 service documentation. This will be included in generated code documentation as remarks section.</xs:documentation>
				</xs:annotation>
			</xs:attribute>
			<xs:attribute name="mapping" type="xs:string">
				<xs:annotation>
					<xs:documentation>Optional. Name of mapping to convert api models domain models.</xs:documentation>
				</xs:annotation>
			</xs:attribute>
			<xs:attribute name="authentication" default="Forms">
				<xs:annotation>
					<xs:documentation>Optional. Authentication mechanism. Forms = username/password JWT, Windows = Windows identity SSO, WindowsAndForms = both, None = anonymous (no auth scheme / no /auth/* login methods — for public/registration services whose callers are not logged in yet; per-method authenticationRequired can still gate individual methods). Default is Forms.</xs:documentation>
				</xs:annotation>
				<xs:simpleType>
					<xs:restriction base="xs:string">
						<xs:enumeration value="Forms"/>
						<xs:enumeration value="Windows"/>
						<xs:enumeration value="WindowsAndForms"/>
						<xs:enumeration value="None"/>
					</xs:restriction>
				</xs:simpleType>
			</xs:attribute>
			<xs:attribute name="signed" type="xs:boolean" default="false">
				<xs:annotation>
					<xs:documentation>Optional. When true, every request and response is HMAC-SHA256-signed and verified end-to-end. Default false (no signing) for backward compatibility. Per-method override available via the same attribute on the Method element. Requires the ApiSigning:Secret config key to be set on both client and server.</xs:documentation>
				</xs:annotation>
			</xs:attribute>
			<xs:attribute name="emitAuthEndpoints" type="xs:boolean" default="true">
				<xs:annotation>
					<xs:documentation>Optional. When true (default), the WebApi controller generator emits the framework auth action methods at the fixed routes /auth/form, /auth/windows, /auth/refresh. When false, those routes are skipped — the AuthenticateXxx interface methods are still emitted on the service so the controller can still call them, but no public HTTP endpoint is registered. Set to false on internal/back-office services that share an ASP.NET project with another `authentication`-enabled service which already exposes the auth surface; otherwise both controllers register identical routes and AspNetCore throws AmbiguousMatchException at request time. Has no effect when `authentication` is the default Forms (single-service project) or when emitting non-WebApi service shapes.</xs:documentation>
				</xs:annotation>
			</xs:attribute>
			<xs:attribute name="emitFileEndpoints" type="xs:boolean" default="true">
				<xs:annotation>
					<xs:documentation>Optional. When true (default), the WebApi controller generator emits the framework file-IO action methods at the fixed routes /upload-file, /download-file/{fileName}, /download-from-path. When false, those three routes are skipped. Same use case as `emitAuthEndpoints`: a project with two WebApi controllers in the same ASP.NET host needs ONE of them to expose these routes; the other must opt out, otherwise AspNetCore throws AmbiguousMatchException at request time. Independent of `emitAuthEndpoints` so projects can mix and match (rare in practice — usually both off together on the secondary service).</xs:documentation>
				</xs:annotation>
			</xs:attribute>
			<xs:attribute name="emitWizardEndpoints" type="xs:boolean" default="false">
				<xs:annotation>
					<xs:documentation>Optional. When true, the controller emits the six wizard-session routes (POST /wizards/start, GET /wizards/{sessionId}, POST /wizards/{sessionId}/steps/{step}, POST /wizards/{sessionId}/steps/{step}/error, POST /wizards/{sessionId}/cancel, POST /wizards/{sessionId}/finalize) backed by the runtime `IWizardSessionConnector` (resolved via `WizardSessionConnectorFactory`). Default false — wizard backplane is opt-in because not every project ships a wizard, and a multi-service host can only have ONE service own /wizards/* without the framework throwing on duplicate routes. Pair with the `WizardSessionConnectors:Default:Provider` config block to pick the storage backend (InMemory dev/tests, Db single-instance prod, Redis multi-instance prod).</xs:documentation>
				</xs:annotation>
			</xs:attribute>
			<xs:attribute name="kind">
				<xs:annotation>
					<xs:documentation>Optional, and usually redundant — prefer to omit. The container type the XML lives in is the single source of truth: an `ApiService` container implies kind="Api"; a `DomainService` container implies kind="Domain". When the attribute is set, SaveXml hard-errors on a mismatch (kind="Domain" XML inside an ApiService container, or vice versa) and surfaces a Warning when the attribute is set to the value the container already implies — drop it to keep one source of truth. `Api` keeps every HTTP-facing behavior: controller emit, service clients for every target, auth + file endpoints. `Domain` opts out of those — no controller, no service client on any target, no auth/file endpoints, no signed-request wrapping — while still emitting the BaseXService + XService scaffold for in-process callers (`&lt;Implementation kind="ServiceMethod" service="X"/&gt;` from sibling Services or Process steps). `authentication`, `googleAuth`, `appleAuth`, `emailAuth`, `signed`, `emitAuthEndpoints`, `emitFileEndpoints` are ignored when kind resolves to "Domain". (Hand-written `CustomDomainService` containers hold plain .cs and have no XML to set this attribute on.)</xs:documentation>
				</xs:annotation>
				<xs:simpleType>
					<xs:restriction base="xs:string">
						<xs:enumeration value="Api"/>
						<xs:enumeration value="Domain"/>
					</xs:restriction>
				</xs:simpleType>
			</xs:attribute>
			<xs:attribute name="googleAuth" type="xs:boolean" default="false">
				<xs:annotation>
					<xs:documentation>Optional (issue #153). When true, the WebApi controller exposes POST /auth/google: the client posts a Google id_token, the controller validates it against Google's JWKS (audience = config `Auth:Google:ClientId`), then calls the service's `AuthenticateGoogle(subject, email)` to resolve the local user and returns the same AuthenticationReply as the form/windows endpoints. Independent of `authentication` — a service can offer Forms + Google + Apple in any combination. Pair with `&lt;Auth&gt;&lt;Method type="Google"/&gt;` in Application.xml to render the login-screen button.</xs:documentation>
				</xs:annotation>
			</xs:attribute>
			<xs:attribute name="appleAuth" type="xs:boolean" default="false">
				<xs:annotation>
					<xs:documentation>Optional (issue #153). Apple Sign In counterpart of `googleAuth`. Exposes POST /auth/apple; validates the id_token against Apple's JWKS (audience = config `Auth:Apple:ClientId`), then calls `AuthenticateApple(subject, email)`. Pair with `&lt;Auth&gt;&lt;Method type="Apple"/&gt;` in Application.xml.</xs:documentation>
				</xs:annotation>
			</xs:attribute>
			<xs:attribute name="emailAuth" type="xs:boolean" default="false">
				<xs:annotation>
					<xs:documentation>Optional (issue #153). Passwordless email-link / email-code counterpart of `googleAuth` / `appleAuth`. Exposes POST /auth/email/send-login-email (issues a one-time login token, sends as link or 6-digit code per the verification mode) and POST /auth/email/login (consumes the token and returns the AuthenticationReply). Pair with `&lt;Auth&gt;&lt;Method type="Email" verification="Link|Code"/&gt;` in Application.xml. Was previously documented on the `authentication` and `googleAuth` notes but missing from the XSD declaration; declared explicitly here so SaveXml's schema validator no longer raises "attribute is not declared" errors on services that use it.</xs:documentation>
				</xs:annotation>
			</xs:attribute>
		</xs:complexType>
	</xs:element>

	<!-- ============================================================================
	     Declarative method bindings (mirrors AssistantSchema's <Tool>/<Implementation>)
	     ============================================================================ -->

	<xs:complexType name="MethodImplementationType">
		<xs:annotation>
			<xs:documentation>Where a service method's body comes from. Four kinds:
- ServiceMethod: bind 1:1 to another Service's method (sibling-service delegation).
- DomainMethod: bind to a method on a hand-written domain service class.
- ProcessMethod: delegate to a sibling generated Process (RunAsync + Result projection).
- Custom: omitted entirely — the generator emits an abstract stub the AI implementation phase fills in (current default behavior).

When ServiceMethod / DomainMethod / ProcessMethod is declared the generator wires up arg passing + the call + return serialization deterministically; no AI pass is needed for that method.</xs:documentation>
		</xs:annotation>
		<xs:attribute name="kind" use="required">
			<xs:annotation>
				<xs:documentation>Required. ServiceMethod | DomainMethod | ProcessMethod. (Custom is implied by the absence of the entire &lt;Implementation&gt; block.)</xs:documentation>
			</xs:annotation>
			<xs:simpleType>
				<xs:restriction base="xs:string">
					<xs:enumeration value="ServiceMethod"/>
					<xs:enumeration value="DomainMethod"/>
					<xs:enumeration value="ProcessMethod"/>
				</xs:restriction>
			</xs:simpleType>
		</xs:attribute>
		<xs:attribute name="service" type="xs:string">
			<xs:annotation>
				<xs:documentation>Required when `kind="ServiceMethod"`. Name of the bound sibling Service (matched on its XML's `name=` attribute, namespace resolved through `-import`).</xs:documentation>
			</xs:annotation>
		</xs:attribute>
		<xs:attribute name="domainService" type="xs:string">
			<xs:annotation>
				<xs:documentation>Required when `kind="DomainMethod"`. Name of the domain-service class. Resolved by walking the workspace's DomainService containers (or by reading hand-written `*.cs` reachable via `-import`).</xs:documentation>
			</xs:annotation>
		</xs:attribute>
		<xs:attribute name="process" type="xs:string">
			<xs:annotation>
				<xs:documentation>Required when `kind="ProcessMethod"`. Name of the bound sibling Process (matched on its XML's `name=` attribute). The generator emits `new {Process}().RunAsync(input)` from same-named method parameters; the Result is projected back through the method's return type (single Model field today; Void returns just await).</xs:documentation>
			</xs:annotation>
		</xs:attribute>
		<xs:attribute name="method" type="xs:string">
			<xs:annotation>
				<xs:documentation>Required for ServiceMethod / DomainMethod. Method name on the bound class. Ignored for ProcessMethod (the sub-Process entry point is always RunAsync). Must be signature-compatible with the declaring method's `&lt;Parameter&gt;` list — the workspace orchestrator validates this before generation runs.</xs:documentation>
			</xs:annotation>
		</xs:attribute>
		<xs:attribute name="namespace" type="xs:string">
			<xs:annotation>
				<xs:documentation>Optional C# namespace of the target class / process. When set the Service generator lifts a `using` line; otherwise the workspace index resolves it (same pattern as Process-step ProcessMethod / ServiceMethod targets).</xs:documentation>
			</xs:annotation>
		</xs:attribute>
	</xs:complexType>

</xs:schema>
