<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema
    xmlns:xsd="http://www.w3.org/2001/XMLSchema"
    xmlns:tns="https://schemas.rutdev.se/xsd/entities/level2/organization-1.0.xsd"
    xmlns:strings="https://schemas.rutdev.se/xsd/types/strings-1.0.xsd"
    targetNamespace="https://schemas.rutdev.se/xsd/entities/level2/organization-1.0.xsd"
    elementFormDefault="qualified"
    version="1.0">

    <!--
      Organization Schema

      Description: Organization is a legal or administrative entity that has responsibilities in the statistical metadata lifecycle. It represents agencies, institutions, departments, or other organizational units invol...
      Version: 1.0
      Generated: 2026-04-22T06:56:44Z
      Source: specs/entities/level2/organization-1.0.md
    -->

    <!-- Import common type definitions -->
    <xsd:import
        namespace="https://schemas.rutdev.se/xsd/types/strings-1.0.xsd"
        schemaLocation="../../../types/strings-1.0.xsd"
    />

    <!-- Properties type: all data fields from entity specification -->
    <xsd:complexType name="OrganizationPropertiesType">
        <xsd:sequence>
            <xsd:element name="IdAtOrigin" type="strings:IdentifierToken">
                <xsd:annotation>
                    <xsd:documentation>
                        Identifier at the source system for the organization. Used during import to determine if the entity already exists in the target system (update) or is new (create). Must remain stable in the source system for the same entity.
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:element>
            <xsd:element name="Title" type="strings:MultilingualLongString" maxOccurs="unbounded">
                <xsd:annotation>
                    <xsd:documentation>
                        The official title or name of the organization
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:element>
            <xsd:element name="Description" type="strings:MultilingualLongString" minOccurs="0" maxOccurs="unbounded">
                <xsd:annotation>
                    <xsd:documentation>
                        Detailed description of the organization
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:element>
        </xsd:sequence>
    </xsd:complexType>

    <!-- Main entity type -->
    <xsd:complexType name="OrganizationType">
        <xsd:sequence>
            <xsd:element name="properties" type="tns:OrganizationPropertiesType" minOccurs="0"/>
        </xsd:sequence>
    </xsd:complexType>

    <!-- Collection type -->
    <xsd:complexType name="OrganizationListType">
        <xsd:sequence>
            <xsd:element name="organization" type="tns:OrganizationType" minOccurs="0" maxOccurs="unbounded"/>
        </xsd:sequence>
    </xsd:complexType>

    <!-- Root elements -->
    <xsd:element name="Organization" type="tns:OrganizationType"/>
    <xsd:element name="OrganizationList" type="tns:OrganizationListType"/>

</xsd:schema>