<?xml version="1.0" encoding="UTF-8"?>
<model package="sample" baseClass="xPDO\\Om\\xPDOObject" platform="sqlite" version="1.1">
    <object class="Person" table="person" extends="xPDO\\Om\\xPDOSimpleObject">
        <field key="first_name" dbtype="varchar" precision="100" phptype="string" null="false" default="" />
        <field key="last_name" dbtype="varchar" precision="100" phptype="string" null="false" default="" />
        <field key="middle_name" dbtype="varchar" precision="100" phptype="string" null="false" default="" />
        <field key="date_modified" dbtype="timestamp" phptype="timestamp" null="false" default="CURRENT_TIMESTAMP" />
        <field key="dob" dbtype="date" phptype="date" null="true" />
        <field key="gender" dbtype="enum" precision="'','M','F'" phptype="string" null="false" default="" />
        <field key="blood_type" dbtype="varchar" precision="100" phptype="string" null="true" />
        <field key="username" dbtype="varchar" precision="255" phptype="string" null="false" index="unique" />
        <field key="password" dbtype="varchar" precision="255" phptype="password" null="false" default="" />
        <field key="security_level" dbtype="tinyint" precision="4" phptype="integer" null="false" default="1" />

        <alias key="date_of_birth" field="dob" />

        <index alias="PRIMARY" name="PRIMARY" primary="true" unique="true">
            <column key="id" collation="A" null="false" />
        </index>
        <index alias="username" name="username" primary="false" unique="true">
            <column key="username" collation="A" null="false" />
        </index>

        <composite alias="PersonPhone" class="PersonPhone" local="id" foreign="person" cardinality="many" owner="local" />
        <aggregate alias="BloodType" class="BloodType" local="blood_type" foreign="type" cardinality="one" owner="foreign" />

        <validation class="validation.xPDOValidator">
            <rule field="dob" name="date_format" type="preg_match" rule="/\d{4}-\d{2}-\d{2}/" />
            <rule field="password" name="password_length" type="xPDOValidationRule" rule="xPDOMinLengthValidationRule" value="6" />
        </validation>
    </object>
    <object class="PersonPhone" table="person_phone" extends="xPDO\\Om\\xPDOObject">
        <field key="person" dbtype="int" precision="11" phptype="integer" null="false" index="pk" />
        <field key="phone" dbtype="int" precision="11" phptype="integer" null="false" index="pk" />
        <field key="is_primary" dbtype="int" precision="1" phptype="boolean" null="false" default="0" />

        <index alias="PRIMARY" name="PRIMARY" primary="true" unique="true">
            <column key="person" collation="A" null="false" />
            <column key="phone" collation="A" null="false" />
        </index>

        <aggregate alias="Person" class="Person" local="person" foreign="id" cardinality="one" owner="foreign" />
        <composite alias="Phone" class="Phone" local="phone" foreign="id" cardinality="one" owner="foreign" />
    </object>
    <object class="Phone" table="phone" extends="xPDO\\Om\\xPDOSimpleObject">
        <field key="type" dbtype="enum" precision="'','home','work','mobile'" phptype="string" null="false" default="" />
        <field key="number" dbtype="varchar" precision="20" phptype="string" null="false" />
        <field key="date_modified" dbtype="timestamp" phptype="timestamp" null="false" default="CURRENT_TIMESTAMP" />

        <index alias="PRIMARY" name="PRIMARY" primary="true" unique="true">
            <column key="id" collation="A" null="false" />
        </index>

        <composite alias="PersonPhone" class="PersonPhone" local="id" foreign="phone" cardinality="many" owner="local" />
    </object>
    <object class="xPDOSample" table="xpdosample" extends="xPDO\\Om\\xPDOSimpleObject">
        <field key="parent" dbtype="int" phptype="integer" null="false" default="0" />
        <field key="unique_varchar" dbtype="varchar" phptype="string" null="false" index="unique" />
        <field key="varchar" dbtype="varchar" phptype="string" null="false" />
        <field key="text" dbtype="text" phptype="string" null="true" />
        <field key="timestamp" dbtype="timestamp" phptype="timestamp" null="false" default="CURRENT_TIMESTAMP" />
        <field key="unix_timestamp" dbtype="int" phptype="integer" null="false" default="0" />
        <field key="date_time" dbtype="datetime" phptype="datetime" null="true" />
        <field key="date" dbtype="date" phptype="date" null="true" />
        <field key="enum" dbtype="enum" precision="'','T','F'" phptype="string" null="false" />
        <field key="password" dbtype="varchar" phptype="password" null="false" />
        <field key="integer" dbtype="int" phptype="integer" null="false" />
        <field key="float" dbtype="decimal" precision="10,5" phptype="float" null="false" default="1.01230" />
        <field key="boolean" dbtype="tinyint" precision="1" phptype="boolean" null="false" />

        <index alias="PRIMARY" name="PRIMARY" primary="true" unique="true">
            <column key="id" />
        </index>
        <index alias="unique_varchar" name="unique_varchar" primary="false" unique="true">
            <column key="unique_varchar" />
        </index>
    </object>
    <object class="BloodType" table="blood_types" extends="xPDO\\Om\\xPDOObject">
        <field key="type" dbtype="varchar" precision="100" phptype="string" null="false" index="pk" />
        <field key="description" dbtype="text" phptype="string" null="true" />

        <index alias="PRIMARY" name="PRIMARY" primary="true" unique="true">
            <column key="type" collation="A" null="false" />
        </index>

        <aggregate alias="Person" class="Person" local="type" foreign="blood_type" cardinality="many" owner="foreign" />
    </object>
    <object class="Item" table="items" extends="xPDO\\Om\\xPDOSimpleObject">
        <field key="name" dbtype="varchar" precision="255" phptype="string" null="false" default="" index="fk" />
        <field key="color" dbtype="varchar" precision="255" phptype="string" null="false" default="green" index="fk" />
        <field key="description" dbtype="text" phptype="string" null="true" />
        <field key="date_modified" dbtype="timestamp" phptype="timestamp" null="false" default="CURRENT_TIMESTAMP" />

        <index alias="name" name="name" primary="false" unique="true">
            <column key="name" length="" collation="A" null="false" />
        </index>
        <index alias="color" name="color" primary="false" unique="false">
            <column key="color" length="" collation="A" null="false" />
        </index>
    </object>
</model>
