<?xml version="1.0" encoding="UTF-8"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements.  See the NOTICE file
distributed with this work for additional information
regarding copyright ownership.  The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License.  You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied.  See the License for the
specific language governing permissions and limitations
under the License.
-->

<entitymodel xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:noNamespaceSchemaLocation="https://ofbiz.apache.org/dtds/entitymodel.xsd">
    <!-- ========================================================= -->
    <!-- ======================== Defaults ======================= -->
    <!-- ========================================================= -->
    <title>Entity of an Apache OFBiz Component</title>
    <description>None</description>
    <version>1.0</version>
    <default-resource-name>ExampleEntityLabels</default-resource-name>

    <!-- ========================================================= -->
    <!-- ======================== Data Model ===================== -->
    <!-- The modules in this file are as follows:                  -->
    <!--  - org.apache.ofbiz.example.example -->
    <!--  - org.apache.ofbiz.example.feature -->
    <!-- ========================================================= -->

    <!-- ========================================================= -->
    <!-- org.apache.ofbiz.example.example -->
    <!-- ========================================================= -->

    <entity entity-name="Example" package-name="org.apache.ofbiz.example.example" title="Example Entity">
        <field name="exampleId" type="id"><description>primary sequenced ID</description></field>
        <field name="exampleTypeId" type="id"></field>
        <field name="statusId" type="id"></field>
        <field name="exampleName" type="name"></field>
        <field name="description" type="description"></field>
        <field name="longDescription" type="very-long"></field>
        <field name="comments" type="comment"></field>
        <field name="exampleSize" type="numeric"></field>
        <field name="exampleDate" type="date-time"></field>
        <field name="anotherDate" type="date-time"></field>
        <field name="anotherText" type="long-varchar"></field>
        <prim-key field="exampleId"/>
        <relation type="one" fk-name="EXMPL_TYP" rel-entity-name="ExampleType">
            <key-map field-name="exampleTypeId"/>
        </relation>
        <relation type="one" fk-name="EXMPL_STTS" rel-entity-name="StatusItem">
            <key-map field-name="statusId"/>
        </relation>
    </entity>
    <entity entity-name="ExampleItem" package-name="org.apache.ofbiz.example.example" title="Example Item Entity">
        <field name="exampleId" type="id"></field>
        <field name="exampleItemSeqId" type="id"><description>secondary sequenced ID</description></field>
        <field name="description" type="description"></field>
        <field name="amount" type="floating-point"></field>
        <field name="amountUomId" type="id"></field>
        <prim-key field="exampleId"/>
        <prim-key field="exampleItemSeqId"/>
        <relation type="one" fk-name="EXMPLIT_UOM" title="Amount" rel-entity-name="Uom">
            <key-map field-name="amountUomId" rel-field-name="uomId"/>
        </relation>
        <relation type="one" fk-name="EXMPLIT_EXMP" rel-entity-name="Example">
            <key-map field-name="exampleId"/>
        </relation>
    </entity>
    <entity entity-name="ExampleStatus" package-name="org.apache.ofbiz.example.example" title="Example Status Entity">
        <field name="exampleId" type="id"></field>
        <field name="statusDate" type="date-time"></field>
        <field name="statusEndDate" type="date-time"></field>
        <field name="changeByUserLoginId" type="id-vlong"></field>
        <field name="statusId" type="id"></field>
        <prim-key field="exampleId"/>
        <prim-key field="statusDate"/>
        <relation type="one" fk-name="EXMPLST_EXMPL" rel-entity-name="Example">
            <key-map field-name="exampleId"/>
        </relation>
        <relation type="one" fk-name="EXMPLST_STTS" rel-entity-name="StatusItem">
            <key-map field-name="statusId"/>
        </relation>
        <relation type="one" fk-name="EXMPLST_STTS_USER" rel-entity-name="UserLogin">
            <key-map field-name="changeByUserLoginId" rel-field-name="userLoginId"/>
        </relation>
    </entity>
    <entity entity-name="ExampleType"
            package-name="org.apache.ofbiz.example.example"
            title="Example Type Entity">
        <field name="exampleTypeId" type="id"></field>
        <field name="parentTypeId" type="id"></field>
        <field name="description" type="description"></field>
        <prim-key field="exampleTypeId"/>
        <relation type="one" fk-name="EXMPLTP_PAR" rel-entity-name="ExampleType">
            <key-map field-name="parentTypeId" rel-field-name="exampleTypeId"/>
        </relation>
    </entity>

    <!-- ========================================================= -->
    <!-- org.apache.ofbiz.example.feature -->
    <!-- ========================================================= -->

    <entity entity-name="ExampleFeature"
        package-name="org.apache.ofbiz.example.feature"
        title="Example Feature Entity">
        <field name="exampleFeatureId" type="id"><description>primary sequenced ID</description></field>
        <field name="featureSourceEnumId" type="id"></field>
        <field name="description" type="description"></field>
        <prim-key field="exampleFeatureId"/>
        <relation type="one" fk-name="EXFT_ENUM" rel-entity-name="Enumeration">
            <key-map field-name="featureSourceEnumId" rel-field-name="enumId"/>
        </relation>
    </entity>
    <entity entity-name="ExampleFeatureAppl"
        package-name="org.apache.ofbiz.example.feature"
        title="Example Feature Application Entity">
        <field name="exampleId" type="id"></field>
        <field name="exampleFeatureId" type="id"></field>
        <field name="fromDate" type="date-time"></field>
        <field name="thruDate" type="date-time"></field>
        <field name="exampleFeatureApplTypeId" type="id"></field>
        <field name="sequenceNum" type="numeric"></field>
        <prim-key field="exampleId"/>
        <prim-key field="exampleFeatureId"/>
        <prim-key field="fromDate"/>
        <relation type="one" fk-name="EXFTAP_EXPL" rel-entity-name="Example">
            <key-map field-name="exampleId"/>
        </relation>
        <relation type="one" fk-name="EXFTAP_EXFT" rel-entity-name="ExampleFeature">
            <key-map field-name="exampleFeatureId"/>
        </relation>
        <relation type="one" fk-name="EXFTAP_TYP" rel-entity-name="ExampleFeatureApplType">
            <key-map field-name="exampleFeatureApplTypeId"/>
        </relation>
    </entity>
    <entity entity-name="ExampleFeatureApplType"
        package-name="org.apache.ofbiz.example.feature"
        title="Example Feature Application Type Entity">
        <field name="exampleFeatureApplTypeId" type="id"></field>
        <field name="parentTypeId" type="id"></field>
        <field name="description" type="description"></field>
        <prim-key field="exampleFeatureApplTypeId"/>
        <relation type="one" fk-name="EXFTAPTP_PAR" rel-entity-name="ExampleFeatureApplType">
            <key-map field-name="parentTypeId" rel-field-name="exampleFeatureApplTypeId"/>
        </relation>
    </entity>
</entitymodel>
