<?xml version="1.0" encoding="UTF-8"?>
<!--XML schema for Northstar Master Data Model (EBX Scripting / Low-Code Ready)-->
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
           xmlns:fmt="urn:ebx-schemas:format_1.0"
           xmlns:osd="urn:ebx-schemas:common_1.0"
           xmlns:ebxs="urn:ebx-schemas:session_1.0">
    <xs:import namespace="urn:ebx-schemas:common_1.0" schemaLocation="http://schema.orchestranetworks.com/common_1.0.xsd"/>
    <xs:import namespace="urn:ebx-schemas:session_1.0" schemaLocation="http://schema.orchestranetworks.com/session_1.0.xsd"/>

    <xs:annotation>
        <xs:appinfo>
            <osd:validation>
                <validationMessageThreshold>1000</validationMessageThreshold>
            </osd:validation>
            <osd:inheritance>
                <dataSetInheritance>none</dataSetInheritance>
            </osd:inheritance>
        </xs:appinfo>
    </xs:annotation>

    <xs:element name="root" osd:access="--">
        <xs:complexType>
            <xs:sequence>
                <!-- =================================================================== -->
                <!-- Table: SourceSystem                                                 -->
                <!-- =================================================================== -->
                <xs:element name="SourceSystem" minOccurs="0" maxOccurs="unbounded">
                    <xs:annotation>
                        <xs:documentation xml:lang="en-US">
                            <osd:label>Source System</osd:label>
                            <osd:description>Registry of upstream contributing systems, authority scopes, and boundaries.</osd:description>
                        </xs:documentation>
                        <xs:appinfo>
                            <osd:table>
                                <primaryKeys>/source_system_id</primaryKeys>
                                <defaultLabel>${./system_name} (${./source_system_id})</defaultLabel>
                            </osd:table>
                        </xs:appinfo>
                    </xs:annotation>
                    <xs:complexType>
                        <xs:sequence>
                            <xs:element name="source_system_id" type="xs:string" minOccurs="1" maxOccurs="1">
                                <xs:annotation>
                                    <xs:documentation xml:lang="en-US">
                                        <osd:label>System Code</osd:label>
                                        <osd:description>Unique technical identifier for the source system (e.g. CRM, ERP, Commerce).</osd:description>
                                    </xs:documentation>
                                </xs:annotation>
                            </xs:element>
                            <xs:element name="system_name" type="xs:string" minOccurs="0" maxOccurs="1">
                                <xs:annotation>
                                    <xs:documentation xml:lang="en-US">
                                        <osd:label>System Name</osd:label>
                                        <osd:description>Human-readable system label.</osd:description>
                                    </xs:documentation>
                                </xs:annotation>
                            </xs:element>
                            <xs:element name="authority_scope" type="xs:string" minOccurs="0" maxOccurs="1">
                                <xs:annotation>
                                    <xs:documentation xml:lang="en-US">
                                        <osd:label>Authority Scope</osd:label>
                                        <osd:description>Declared business authority domain (e.g. Orders, Customer Loyalty, SKU Lifecycle).</osd:description>
                                    </xs:documentation>
                                </xs:annotation>
                            </xs:element>
                        </xs:sequence>
                    </xs:complexType>
                </xs:element>

                <!-- =================================================================== -->
                <!-- Table: Customer                                                     -->
                <!-- =================================================================== -->
                <xs:element name="Customer" minOccurs="0" maxOccurs="unbounded">
                    <xs:annotation>
                        <xs:documentation xml:lang="en-US">
                            <osd:label>Customer</osd:label>
                            <osd:description>Northstar customer records across source systems and mastered candidates.</osd:description>
                        </xs:documentation>
                        <xs:appinfo>
                            <osd:table>
                                <primaryKeys>/customer_id</primaryKeys>
                                <defaultLabel>${./name} (${./email})</defaultLabel>
                            </osd:table>
                        </xs:appinfo>
                    </xs:annotation>
                    <xs:complexType>
                        <xs:sequence>
                            <xs:element name="customer_id" type="xs:string" minOccurs="1" maxOccurs="1">
                                <xs:annotation>
                                    <xs:documentation xml:lang="en-US">
                                        <osd:label>Customer ID</osd:label>
                                        <osd:description>Unique internal customer entity identifier.</osd:description>
                                    </xs:documentation>
                                </xs:annotation>
                            </xs:element>
                            <xs:element name="source_system_id" type="xs:string" minOccurs="0" maxOccurs="1">
                                <xs:annotation>
                                    <xs:documentation xml:lang="en-US">
                                        <osd:label>Source System</osd:label>
                                        <osd:description>Originating system reference.</osd:description>
                                    </xs:documentation>
                                    <xs:appinfo>
                                        <osd:otherFacets>
                                            <osd:tableRef>
                                                <tablePath>/root/SourceSystem</tablePath>
                                            </osd:tableRef>
                                        </osd:otherFacets>
                                    </xs:appinfo>
                                </xs:annotation>
                            </xs:element>
                            <xs:element name="source_id" type="xs:string" minOccurs="0" maxOccurs="1">
                                <xs:annotation>
                                    <xs:documentation xml:lang="en-US">
                                        <osd:label>Source System ID</osd:label>
                                        <osd:description>Identifier in the contributing system (e.g. C-1007, WEB-882).</osd:description>
                                    </xs:documentation>
                                </xs:annotation>
                            </xs:element>
                            <xs:element name="name" type="xs:string" minOccurs="0" maxOccurs="1">
                                <xs:annotation>
                                    <xs:documentation xml:lang="en-US">
                                        <osd:label>Customer Name</osd:label>
                                        <osd:description>Full name of the customer.</osd:description>
                                    </xs:documentation>
                                </xs:annotation>
                            </xs:element>
                            <xs:element name="email" type="xs:string" minOccurs="0" maxOccurs="1">
                                <xs:annotation>
                                    <xs:documentation xml:lang="en-US">
                                        <osd:label>Email Address</osd:label>
                                        <osd:description>Primary contact email address.</osd:description>
                                    </xs:documentation>
                                </xs:annotation>
                            </xs:element>
                            <xs:element name="country" type="xs:string" minOccurs="0" maxOccurs="1">
                                <xs:annotation>
                                    <xs:documentation xml:lang="en-US">
                                        <osd:label>Country</osd:label>
                                        <osd:description>Country code or representation.</osd:description>
                                    </xs:documentation>
                                </xs:annotation>
                            </xs:element>
                            <xs:element name="loyalty_tier" type="xs:string" minOccurs="0" maxOccurs="1">
                                <xs:annotation>
                                    <xs:documentation xml:lang="en-US">
                                        <osd:label>Loyalty Tier</osd:label>
                                        <osd:description>Customer loyalty tier designation.</osd:description>
                                    </xs:documentation>
                                </xs:annotation>
                            </xs:element>
                        </xs:sequence>
                    </xs:complexType>
                </xs:element>

                <!-- =================================================================== -->
                <!-- Table: Product                                                      -->
                <!-- =================================================================== -->
                <xs:element name="Product" minOccurs="0" maxOccurs="unbounded">
                    <xs:annotation>
                        <xs:documentation xml:lang="en-US">
                            <osd:label>Product</osd:label>
                            <osd:description>Northstar product catalog items across ERP, PIM, and Commerce.</osd:description>
                        </xs:documentation>
                        <xs:appinfo>
                            <osd:table>
                                <primaryKeys>/product_id</primaryKeys>
                                <defaultLabel>${./product_name} (${./sku})</defaultLabel>
                            </osd:table>
                        </xs:appinfo>
                    </xs:annotation>
                    <xs:complexType>
                        <xs:sequence>
                            <xs:element name="product_id" type="xs:string" minOccurs="1" maxOccurs="1">
                                <xs:annotation>
                                    <xs:documentation xml:lang="en-US">
                                        <osd:label>Product ID</osd:label>
                                        <osd:description>Unique internal product entity identifier.</osd:description>
                                    </xs:documentation>
                                </xs:annotation>
                            </xs:element>
                            <xs:element name="source_system_id" type="xs:string" minOccurs="0" maxOccurs="1">
                                <xs:annotation>
                                    <xs:documentation xml:lang="en-US">
                                        <osd:label>Source System</osd:label>
                                        <osd:description>Originating catalog or system reference.</osd:description>
                                    </xs:documentation>
                                    <xs:appinfo>
                                        <osd:otherFacets>
                                            <osd:tableRef>
                                                <tablePath>/root/SourceSystem</tablePath>
                                            </osd:tableRef>
                                        </osd:otherFacets>
                                    </xs:appinfo>
                                </xs:annotation>
                            </xs:element>
                            <xs:element name="source_id" type="xs:string" minOccurs="0" maxOccurs="1">
                                <xs:annotation>
                                    <xs:documentation xml:lang="en-US">
                                        <osd:label>Source System ID</osd:label>
                                        <osd:description>Identifier in the contributing system (e.g. P-200, 7781).</osd:description>
                                    </xs:documentation>
                                </xs:annotation>
                            </xs:element>
                            <xs:element name="sku" type="xs:string" minOccurs="0" maxOccurs="1">
                                <xs:annotation>
                                    <xs:documentation xml:lang="en-US">
                                        <osd:label>SKU</osd:label>
                                        <osd:description>Stock Keeping Unit code.</osd:description>
                                    </xs:documentation>
                                </xs:annotation>
                            </xs:element>
                            <xs:element name="product_name" type="xs:string" minOccurs="0" maxOccurs="1">
                                <xs:annotation>
                                    <xs:documentation xml:lang="en-US">
                                        <osd:label>Product Name</osd:label>
                                        <osd:description>Official product title.</osd:description>
                                    </xs:documentation>
                                </xs:annotation>
                            </xs:element>
                            <xs:element name="status" type="xs:string" minOccurs="0" maxOccurs="1">
                                <xs:annotation>
                                    <xs:documentation xml:lang="en-US">
                                        <osd:label>Status</osd:label>
                                        <osd:description>Lifecycle status (e.g. Active, Discontinued).</osd:description>
                                    </xs:documentation>
                                </xs:annotation>
                            </xs:element>
                            <xs:element name="category" type="xs:string" minOccurs="0" maxOccurs="1">
                                <xs:annotation>
                                    <xs:documentation xml:lang="en-US">
                                        <osd:label>Category</osd:label>
                                        <osd:description>Catalog classification hierarchy.</osd:description>
                                    </xs:documentation>
                                </xs:annotation>
                            </xs:element>
                        </xs:sequence>
                    </xs:complexType>
                </xs:element>

            </xs:sequence>
        </xs:complexType>
    </xs:element>
</xs:schema>
