<?xml version="1.0" encoding="UTF-8"?>

<!--

 This file is part of the Sylius package.

 (c) Sylius Sp. z o.o.

 For the full copyright and license information, please view the LICENSE
 file that was distributed with this source code.

-->

<doctrine-mapping xmlns="http://doctrine-project.org/schemas/orm/doctrine-mapping"
                  xmlns:gedmo="http://gediminasm.org/schemas/orm/doctrine-extensions-mapping">

    <mapped-superclass name="Sylius\Component\Addressing\Model\Address" table="sylius_address">
        <id name="id" column="id" type="integer">
            <generator strategy="AUTO" />
        </id>

        <field name="firstName" column="first_name" type="string">
            <gedmo:versioned/>
        </field>
        <field name="lastName" column="last_name" type="string">
            <gedmo:versioned/>
        </field>

        <field name="phoneNumber" column="phone_number" type="string" nullable="true">
            <gedmo:versioned/>
        </field>
        <field name="street" column="street" type="string">
            <gedmo:versioned/>
        </field>
        <field name="company" column="company" type="string" nullable="true">
            <gedmo:versioned/>
        </field>
        <field name="city" column="city" type="string">
            <gedmo:versioned/>
        </field>
        <field name="postcode" column="postcode" type="string">
            <gedmo:versioned/>
        </field>

        <field name="createdAt" column="created_at" type="datetime">
            <gedmo:timestampable on="create"/>
        </field>
        <field name="updatedAt" column="updated_at" type="datetime" nullable="true">
            <gedmo:timestampable on="update"/>
        </field>

        <field name="countryCode" column="country_code" type="string">
            <gedmo:versioned/>
        </field>
        <field name="provinceCode" column="province_code" type="string" nullable="true">
            <gedmo:versioned/>
        </field>
        <field name="provinceName" column="province_name" type="string" nullable="true">
            <gedmo:versioned/>
        </field>

        <gedmo:loggable log-entry-class="Sylius\Component\Addressing\Model\AddressLogEntry"/>
    </mapped-superclass>

</doctrine-mapping>
