<?php

namespace common\logic\Producer\Producer\Service;

use common\logic\AbstractService;
use common\logic\Producer\Producer\Model\Producer;
use common\logic\UtilsInterface;

class ProducerUtils extends AbstractService implements UtilsInterface
{
    public function sendEmailNewProducer(Producer $producer): void
    {
        \Yii::$app->mailer->compose(
            [
                'html' => 'new-producer-html',
                'text' => 'new-producer-text'
            ], [
            'producer' => $producer
        ])
            ->setTo(\Yii::$app->params['adminEmail'])
            ->setFrom([\Yii::$app->params['adminEmail'] => 'distrib'])
            ->setSubject('[Opendistrib] Nouveau producteur')
            ->send();
    }
}