<?php

namespace Lc\SovBundle\Definition\Field\Site;

use EasyCorp\Bundle\EasyAdminBundle\Field\AssociationField;
use EasyCorp\Bundle\EasyAdminBundle\Field\DateField;
use EasyCorp\Bundle\EasyAdminBundle\Field\NumberField;
use EasyCorp\Bundle\EasyAdminBundle\Field\TextField;
use Lc\SovBundle\Definition\Field\AbstractFieldDefinition;
use Lc\SovBundle\Field\BooleanField;
use Lc\SovBundle\Field\CKEditorField;
use Lc\SovBundle\Field\ImageManagerField;

class NewsFieldDefinition extends AbstractFieldDefinition
{
    public function configureIndex(): array
    {
        return [
                'id',
                'title',
                'status'
        ];
    }

    public function configurePanels(): array
    {
        return ['main', 'seo', 'opengraph', 'conf'];
    }

    public function configurePanelMain(): array
    {
        return [
                'date',
                'title',
                'newsletter',
                'image',
                'description',
                'isSent',
                'status'
        ];
    }

    public function configureFields(): array
    {
        return [
                'date' => DateField::new('date')
                        ->setFormat('d/MM/y')
                        ->setSortable(true),
                'title' => TextField::new('title')->setSortable(true),
                'newsletter' => AssociationField::new('newsletter')->setSortable(true),
                'image' => ImageManagerField::new('image'),
                'position' => NumberField::new('position'),
                'description' => CKEditorField::new('description'),
                'isSent' => BooleanField::new('isSent')->setSortable(true),
        ];
    }

}
