<?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"
                  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                  xsi:schemaLocation="http://doctrine-project.org/schemas/orm/doctrine-mapping
                                      http://doctrine-project.org/schemas/orm/doctrine-mapping.xsd">

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

        <field name="email" column="email" type="string" nullable="false" unique="true" />
        <field name="emailCanonical" column="email_canonical" type="string" nullable="false" unique="true" />

        <field name="firstName" column="first_name" type="string" nullable="true" />
        <field name="lastName" column="last_name" type="string" nullable="true" />
        <field name="birthday" column="birthday" type="datetime" nullable="true" />
        <field name="gender" column="gender" type="string" length="1">
            <options>
                <option name="default">u</option>
            </options>
        </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>

        <many-to-one field="group" target-entity="Sylius\Component\Customer\Model\CustomerGroupInterface">
            <join-column name="customer_group_id" referenced-column-name="id" nullable="true" />
        </many-to-one>

        <field name="phoneNumber" column="phone_number" type="string" nullable="true" />
        <field name="subscribedToNewsletter" column="subscribed_to_newsletter" type="boolean" />

    </mapped-superclass>

</doctrine-mapping>
