<?php declare(strict_types=1);

namespace Atl\DiscountExtension\Extension\Checkout\Customer;

use Atl\DiscountExtension\Core\System\RepeatDiscount\RepeatDiscountDefinition;
use Shopware\Core\Checkout\Customer\CustomerDefinition;
use Shopware\Core\Framework\DataAbstractionLayer\EntityExtension;
use Shopware\Core\Framework\DataAbstractionLayer\Field\OneToOneAssociationField;
use Shopware\Core\Framework\DataAbstractionLayer\FieldCollection;

class CustomerExtension extends EntityExtension
{
    public function extendFields(FieldCollection $collection): void
    {
        $collection->add(
            (new OneToOneAssociationField('repeatDiscount', 'id', 'customer_id', RepeatDiscountDefinition::class))
        );
    }

    public function getDefinitionClass(): string
    {
        return CustomerDefinition::class;
    }
}