<?xml version="1.0" encoding="utf-8"?>
<!--
  Mock metadata allineato a SAP S/4HANA OData API:
  API_BUSINESS_PARTNER (OData V2)

  Subset delle entity usate dal wizard BP.
  In sistema reale: /sap/opu/odata/sap/API_BUSINESS_PARTNER/

  CompanyRegistry* NON è standard S/4: simula un servizio esterno (Camera di Commercio).
-->
<edmx:Edmx Version="1.0"
	xmlns:edmx="http://schemas.microsoft.com/ado/2007/06/edmx"
	xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata"
	xmlns:sap="http://www.sap.com/Protocols/SAPData">
	<edmx:DataServices m:DataServiceVersion="2.0">
		<Schema Namespace="API_BUSINESS_PARTNER" xml:lang="en" sap:schema-version="1"
			xmlns="http://schemas.microsoft.com/ado/2008/09/edm">

			<EntityType Name="A_BusinessPartnerType" sap:content-version="1" sap:label="Business Partner">
				<Key>
					<PropertyRef Name="BusinessPartner"/>
				</Key>
				<Property Name="BusinessPartner" Type="Edm.String" Nullable="false" MaxLength="10" sap:label="Business Partner" sap:creatable="false" sap:updatable="false"/>
				<Property Name="BusinessPartnerCategory" Type="Edm.String" MaxLength="1" sap:label="BP Category" sap:quickinfo="1=Person, 2=Organization"/>
				<Property Name="BusinessPartnerGrouping" Type="Edm.String" MaxLength="4" sap:label="Grouping"/>
				<Property Name="OrganizationBPName1" Type="Edm.String" MaxLength="40" sap:label="Name 1"/>
				<Property Name="OrganizationBPName2" Type="Edm.String" MaxLength="40" sap:label="Name 2"/>
				<Property Name="OrganizationBPName3" Type="Edm.String" MaxLength="40" sap:label="Name 3"/>
				<Property Name="OrganizationBPName4" Type="Edm.String" MaxLength="40" sap:label="Name 4"/>
				<Property Name="FirstName" Type="Edm.String" MaxLength="40" sap:label="First Name"/>
				<Property Name="LastName" Type="Edm.String" MaxLength="40" sap:label="Last Name"/>
				<Property Name="LegalForm" Type="Edm.String" MaxLength="2" sap:label="Legal Form"/>
				<Property Name="Industry" Type="Edm.String" MaxLength="10" sap:label="Industry"/>
				<Property Name="SearchTerm1" Type="Edm.String" MaxLength="20" sap:label="Search Term 1"/>
				<Property Name="SearchTerm2" Type="Edm.String" MaxLength="20" sap:label="Search Term 2"/>
				<Property Name="Customer" Type="Edm.String" MaxLength="10" sap:label="Customer"/>
				<Property Name="Supplier" Type="Edm.String" MaxLength="10" sap:label="Supplier"/>
				<Property Name="BusinessPartnerFullName" Type="Edm.String" MaxLength="81" sap:label="Full Name" sap:creatable="false" sap:updatable="false"/>
				<Property Name="CreationDate" Type="Edm.DateTime" Precision="7" sap:label="Created On" sap:creatable="false" sap:updatable="false" sap:display-format="Date"/>
				<NavigationProperty Name="to_BusinessPartnerAddress" Relationship="API_BUSINESS_PARTNER.assoc_BP_Address" FromRole="FromRole_assoc_BP_Address" ToRole="ToRole_assoc_BP_Address"/>
				<NavigationProperty Name="to_BusinessPartnerRole" Relationship="API_BUSINESS_PARTNER.assoc_BP_Role" FromRole="FromRole_assoc_BP_Role" ToRole="ToRole_assoc_BP_Role"/>
				<NavigationProperty Name="to_BusinessPartnerTax" Relationship="API_BUSINESS_PARTNER.assoc_BP_Tax" FromRole="FromRole_assoc_BP_Tax" ToRole="ToRole_assoc_BP_Tax"/>
			</EntityType>

			<EntityType Name="A_BusinessPartnerAddressType" sap:content-version="1" sap:label="BP Address">
				<Key>
					<PropertyRef Name="BusinessPartner"/>
					<PropertyRef Name="AddressID"/>
				</Key>
				<Property Name="BusinessPartner" Type="Edm.String" Nullable="false" MaxLength="10" sap:label="Business Partner"/>
				<Property Name="AddressID" Type="Edm.String" Nullable="false" MaxLength="10" sap:label="Address Number"/>
				<Property Name="Country" Type="Edm.String" MaxLength="3" sap:label="Country"/>
				<Property Name="Region" Type="Edm.String" MaxLength="3" sap:label="Region"/>
				<Property Name="StreetName" Type="Edm.String" MaxLength="60" sap:label="Street"/>
				<Property Name="HouseNumber" Type="Edm.String" MaxLength="10" sap:label="House Number"/>
				<Property Name="PostalCode" Type="Edm.String" MaxLength="10" sap:label="Postal Code"/>
				<Property Name="CityName" Type="Edm.String" MaxLength="40" sap:label="City"/>
				<Property Name="Language" Type="Edm.String" MaxLength="2" sap:label="Language"/>
				<Property Name="CareOfName" Type="Edm.String" MaxLength="40" sap:label="c/o"/>
				<NavigationProperty Name="to_EmailAddress" Relationship="API_BUSINESS_PARTNER.assoc_Addr_Email" FromRole="FromRole_assoc_Addr_Email" ToRole="ToRole_assoc_Addr_Email"/>
				<NavigationProperty Name="to_PhoneNumber" Relationship="API_BUSINESS_PARTNER.assoc_Addr_Phone" FromRole="FromRole_assoc_Addr_Phone" ToRole="ToRole_assoc_Addr_Phone"/>
			</EntityType>

			<EntityType Name="A_BusinessPartnerRoleType" sap:content-version="1" sap:label="BP Role">
				<Key>
					<PropertyRef Name="BusinessPartner"/>
					<PropertyRef Name="BusinessPartnerRole"/>
				</Key>
				<Property Name="BusinessPartner" Type="Edm.String" Nullable="false" MaxLength="10" sap:label="Business Partner"/>
				<Property Name="BusinessPartnerRole" Type="Edm.String" Nullable="false" MaxLength="6" sap:label="BP Role"/>
				<Property Name="ValidFrom" Type="Edm.DateTimeOffset" Precision="0" sap:label="Valid From"/>
				<Property Name="ValidTo" Type="Edm.DateTimeOffset" Precision="0" sap:label="Valid To"/>
			</EntityType>

			<EntityType Name="A_BusinessPartnerTaxNumberType" sap:content-version="1" sap:label="BP Tax Number">
				<Key>
					<PropertyRef Name="BusinessPartner"/>
					<PropertyRef Name="BPTaxType"/>
				</Key>
				<Property Name="BusinessPartner" Type="Edm.String" Nullable="false" MaxLength="10" sap:label="Business Partner"/>
				<Property Name="BPTaxType" Type="Edm.String" Nullable="false" MaxLength="4" sap:label="Tax Number Category"/>
				<Property Name="BPTaxNumber" Type="Edm.String" MaxLength="20" sap:label="Tax Number"/>
				<Property Name="BPTaxLongNumber" Type="Edm.String" MaxLength="60" sap:label="Tax Number Long"/>
			</EntityType>

			<EntityType Name="A_AddressEmailAddressType" sap:content-version="1" sap:label="Email Address">
				<Key>
					<PropertyRef Name="AddressID"/>
					<PropertyRef Name="Person"/>
					<PropertyRef Name="OrdinalNumber"/>
				</Key>
				<Property Name="AddressID" Type="Edm.String" Nullable="false" MaxLength="10" sap:label="Address Number"/>
				<Property Name="Person" Type="Edm.String" Nullable="false" MaxLength="10" sap:label="Person Number"/>
				<Property Name="OrdinalNumber" Type="Edm.String" Nullable="false" MaxLength="3" sap:label="Sequence Number"/>
				<Property Name="IsDefaultEmailAddress" Type="Edm.Boolean" sap:label="Standard"/>
				<Property Name="EmailAddress" Type="Edm.String" MaxLength="241" sap:label="E-Mail Address"/>
			</EntityType>

			<EntityType Name="A_AddressPhoneNumberType" sap:content-version="1" sap:label="Phone Number">
				<Key>
					<PropertyRef Name="AddressID"/>
					<PropertyRef Name="Person"/>
					<PropertyRef Name="OrdinalNumber"/>
				</Key>
				<Property Name="AddressID" Type="Edm.String" Nullable="false" MaxLength="10" sap:label="Address Number"/>
				<Property Name="Person" Type="Edm.String" Nullable="false" MaxLength="10" sap:label="Person Number"/>
				<Property Name="OrdinalNumber" Type="Edm.String" Nullable="false" MaxLength="3" sap:label="Sequence Number"/>
				<Property Name="DestinationLocationCountry" Type="Edm.String" MaxLength="3" sap:label="Country"/>
				<Property Name="IsDefaultPhoneNumber" Type="Edm.Boolean" sap:label="Standard"/>
				<Property Name="PhoneNumber" Type="Edm.String" MaxLength="30" sap:label="Telephone"/>
				<Property Name="PhoneNumberExtension" Type="Edm.String" MaxLength="10" sap:label="Extension"/>
			</EntityType>

			<!-- External CCIAA lookup (NOT part of API_BUSINESS_PARTNER) -->
			<EntityType Name="CompanyRegistryType" sap:content-version="1" sap:label="Company Registry (external)">
				<Key>
					<PropertyRef Name="RegistryId"/>
				</Key>
				<Property Name="RegistryId" Type="Edm.String" Nullable="false" MaxLength="20"/>
				<Property Name="VatNumber" Type="Edm.String" MaxLength="16"/>
				<Property Name="FiscalCode" Type="Edm.String" MaxLength="16"/>
				<Property Name="CompanyName" Type="Edm.String" MaxLength="80"/>
				<Property Name="LegalForm" Type="Edm.String" MaxLength="10"/>
				<Property Name="ReaNumber" Type="Edm.String" MaxLength="20"/>
				<Property Name="CciaaCode" Type="Edm.String" MaxLength="10"/>
				<Property Name="Status" Type="Edm.String" MaxLength="20"/>
				<Property Name="Street" Type="Edm.String" MaxLength="60"/>
				<Property Name="HouseNumber" Type="Edm.String" MaxLength="10"/>
				<Property Name="PostalCode" Type="Edm.String" MaxLength="10"/>
				<Property Name="City" Type="Edm.String" MaxLength="40"/>
				<Property Name="Region" Type="Edm.String" MaxLength="3"/>
				<Property Name="Country" Type="Edm.String" MaxLength="3"/>
				<Property Name="AtecoCode" Type="Edm.String" MaxLength="10"/>
				<Property Name="AtecoText" Type="Edm.String" MaxLength="60"/>
				<Property Name="Pec" Type="Edm.String" MaxLength="241"/>
			</EntityType>

			<Association Name="assoc_BP_Address" sap:content-version="1">
				<End Type="API_BUSINESS_PARTNER.A_BusinessPartnerType" Multiplicity="1" Role="FromRole_assoc_BP_Address"/>
				<End Type="API_BUSINESS_PARTNER.A_BusinessPartnerAddressType" Multiplicity="*" Role="ToRole_assoc_BP_Address"/>
			</Association>
			<Association Name="assoc_BP_Role" sap:content-version="1">
				<End Type="API_BUSINESS_PARTNER.A_BusinessPartnerType" Multiplicity="1" Role="FromRole_assoc_BP_Role"/>
				<End Type="API_BUSINESS_PARTNER.A_BusinessPartnerRoleType" Multiplicity="*" Role="ToRole_assoc_BP_Role"/>
			</Association>
			<Association Name="assoc_BP_Tax" sap:content-version="1">
				<End Type="API_BUSINESS_PARTNER.A_BusinessPartnerType" Multiplicity="1" Role="FromRole_assoc_BP_Tax"/>
				<End Type="API_BUSINESS_PARTNER.A_BusinessPartnerTaxNumberType" Multiplicity="*" Role="ToRole_assoc_BP_Tax"/>
			</Association>
			<Association Name="assoc_Addr_Email" sap:content-version="1">
				<End Type="API_BUSINESS_PARTNER.A_BusinessPartnerAddressType" Multiplicity="1" Role="FromRole_assoc_Addr_Email"/>
				<End Type="API_BUSINESS_PARTNER.A_AddressEmailAddressType" Multiplicity="*" Role="ToRole_assoc_Addr_Email"/>
			</Association>
			<Association Name="assoc_Addr_Phone" sap:content-version="1">
				<End Type="API_BUSINESS_PARTNER.A_BusinessPartnerAddressType" Multiplicity="1" Role="FromRole_assoc_Addr_Phone"/>
				<End Type="API_BUSINESS_PARTNER.A_AddressPhoneNumberType" Multiplicity="*" Role="ToRole_assoc_Addr_Phone"/>
			</Association>

			<EntityContainer Name="API_BUSINESS_PARTNER_Entities" m:IsDefaultEntityContainer="true" sap:supported-formats="atom json xlsx">
				<EntitySet Name="A_BusinessPartner" EntityType="API_BUSINESS_PARTNER.A_BusinessPartnerType" sap:content-version="1" sap:creatable="true" sap:updatable="true" sap:deletable="false"/>
				<EntitySet Name="A_BusinessPartnerAddress" EntityType="API_BUSINESS_PARTNER.A_BusinessPartnerAddressType" sap:content-version="1" sap:creatable="true" sap:updatable="true" sap:deletable="true"/>
				<EntitySet Name="A_BusinessPartnerRole" EntityType="API_BUSINESS_PARTNER.A_BusinessPartnerRoleType" sap:content-version="1" sap:creatable="true" sap:updatable="true" sap:deletable="true"/>
				<EntitySet Name="A_BusinessPartnerTaxNumber" EntityType="API_BUSINESS_PARTNER.A_BusinessPartnerTaxNumberType" sap:content-version="1" sap:creatable="true" sap:updatable="true" sap:deletable="true"/>
				<EntitySet Name="A_AddressEmailAddress" EntityType="API_BUSINESS_PARTNER.A_AddressEmailAddressType" sap:content-version="1" sap:creatable="true" sap:updatable="true" sap:deletable="true"/>
				<EntitySet Name="A_AddressPhoneNumber" EntityType="API_BUSINESS_PARTNER.A_AddressPhoneNumberType" sap:content-version="1" sap:creatable="true" sap:updatable="true" sap:deletable="true"/>
				<EntitySet Name="CompanyRegistrySet" EntityType="API_BUSINESS_PARTNER.CompanyRegistryType" sap:creatable="false" sap:updatable="false" sap:deletable="false"/>
				<AssociationSet Name="assoc_BP_Address_AssocSet" Association="API_BUSINESS_PARTNER.assoc_BP_Address" sap:creatable="false" sap:updatable="false" sap:deletable="false" sap:content-version="1">
					<End EntitySet="A_BusinessPartner" Role="FromRole_assoc_BP_Address"/>
					<End EntitySet="A_BusinessPartnerAddress" Role="ToRole_assoc_BP_Address"/>
				</AssociationSet>
				<AssociationSet Name="assoc_BP_Role_AssocSet" Association="API_BUSINESS_PARTNER.assoc_BP_Role" sap:creatable="false" sap:updatable="false" sap:deletable="false" sap:content-version="1">
					<End EntitySet="A_BusinessPartner" Role="FromRole_assoc_BP_Role"/>
					<End EntitySet="A_BusinessPartnerRole" Role="ToRole_assoc_BP_Role"/>
				</AssociationSet>
				<AssociationSet Name="assoc_BP_Tax_AssocSet" Association="API_BUSINESS_PARTNER.assoc_BP_Tax" sap:creatable="false" sap:updatable="false" sap:deletable="false" sap:content-version="1">
					<End EntitySet="A_BusinessPartner" Role="FromRole_assoc_BP_Tax"/>
					<End EntitySet="A_BusinessPartnerTaxNumber" Role="ToRole_assoc_BP_Tax"/>
				</AssociationSet>
				<AssociationSet Name="assoc_Addr_Email_AssocSet" Association="API_BUSINESS_PARTNER.assoc_Addr_Email" sap:creatable="false" sap:updatable="false" sap:deletable="false" sap:content-version="1">
					<End EntitySet="A_BusinessPartnerAddress" Role="FromRole_assoc_Addr_Email"/>
					<End EntitySet="A_AddressEmailAddress" Role="ToRole_assoc_Addr_Email"/>
				</AssociationSet>
				<AssociationSet Name="assoc_Addr_Phone_AssocSet" Association="API_BUSINESS_PARTNER.assoc_Addr_Phone" sap:creatable="false" sap:updatable="false" sap:deletable="false" sap:content-version="1">
					<End EntitySet="A_BusinessPartnerAddress" Role="FromRole_assoc_Addr_Phone"/>
					<End EntitySet="A_AddressPhoneNumber" Role="ToRole_assoc_Addr_Phone"/>
				</AssociationSet>
			</EntityContainer>
		</Schema>
	</edmx:DataServices>
</edmx:Edmx>
