<?xml version="1.0" encoding="UTF-8"?>
<doctrine-mapping xmlns="http://doctrine-project.org/schemas/orm/doctrine-mapping"
                  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                  xsi:schemaLocation="http://doctrine-project.org/schemas/orm/doctrine-mapping
                          https://www.doctrine-project.org/schemas/orm/doctrine-mapping.xsd">
    <entity
            name="Basango\FeedManagement\Domain\Model\Entity\Comment"
            repository-class="Basango\FeedManagement\Infrastructure\Persistence\Doctrine\ORM\CommentOrmRepository"
            table="comment"
    >
        <id name="id" type="comment_id">
            <generator strategy="NONE"/>
        </id>

        <many-to-one field="user" target-entity="Basango\IdentityAndAccess\Domain\Model\Entity\User">
            <join-column nullable="false" on-delete="CASCADE" />
        </many-to-one>
        <many-to-one field="article" target-entity="Basango\Aggregator\Domain\Model\Entity\Article">
            <join-column nullable="false" on-delete="CASCADE" />
        </many-to-one>

        <field name="content" length="512" />
        <field name="sentiment" enum-type="Basango\Aggregator\Domain\Model\ValueObject\Scoring\Sentiment" length="30">
            <options>
                <option name="default">neutral</option>
            </options>
        </field>
        <field name="isSpam" type="boolean">
            <options>
                <option name="default">0</option>
            </options>
        </field>

        <field name="createdAt" type="datetime_immutable"/>
    </entity>
</doctrine-mapping>
