<?php

namespace App\Providers;

use App\Models\Advisories\Advisory;
use App\Models\Advisories\AdvisoryCompany;
use App\Models\Advisories\AdvisoryMember;
use App\Models\Applications\Application;
use App\Models\Applications\Conclusion;
use App\Models\Asset;
use App\Models\Companies\Address;
use App\Models\Companies\BankDetails;
use App\Models\Companies\Company;
use App\Models\Companies\CompanyMember;
use App\Models\Companies\Contact;
use App\Models\Companies\Department;
use App\Models\Dictionaries\Dictionary;
use App\Models\Dictionaries\DictionaryItem;
use App\Models\Objects\Field;
use App\Models\Objects\FieldsGroup;
use App\Models\Objects\NirObject;
use App\Models\Objects\ObjectType;
use App\Models\Pages\Page;
use App\Models\Permission;
use App\Models\Products\Product;
use App\Models\Publications\Publication;
use App\Models\Registries\Category;
use App\Models\Registries\Entry;
use App\Models\Registries\Registry;
use App\Models\Role;
use App\Models\SocialProvider;
use App\Models\User;
use Illuminate\Database\Eloquent\Relations\Relation;
use Illuminate\Support\Carbon;
use Illuminate\Support\Facades\Mail;
use Illuminate\Support\ServiceProvider;

class AppServiceProvider extends ServiceProvider
{
    /**
     * Register any application services.
     *
     * @return void
     */
    public function register()
    {
    }

    /**
     * Bootstrap any application services.
     *
     * @return void
     */
    public function boot() {
        Carbon::setLocale(config('app.locale'));

        if ($this->app->environment('local')) Mail::alwaysTo('test@nirgroup.ru');

        Relation::enforceMorphMap([
            'asset' => Asset::class,
            'permission' => Permission::class,
            'role' => Role::class,
            'social-provider' => SocialProvider::class,
            'user' => User::class,

            'dictionary' => Dictionary::class,
            'dictionary-item' => DictionaryItem::class,

            'object-field' => Field::class,
            'fields-group' => FieldsGroup::class,
            'object' => NirObject::class,
            'object-type' => ObjectType::class,

            'page' => Page::class,
            'publication' => Publication::class,

            'registry' => Registry::class,
            'registry-category' => Category::class,
            'registry-entry' => Entry::class,

            'company' => Company::class,
            'company-address' => Address::class,
            'company-member' => CompanyMember::class,
            'company-contact' => Contact::class,
            'company-department' => Department::class,
            'bank-details' => BankDetails::class,

            'advisory' => Advisory::class,
            'advisory-member' => AdvisoryMember::class,
            'advisory-company' => AdvisoryCompany::class,

            'application' => Application::class,
            'application-conclusion' => Conclusion::class,
            'product' => Product::class
        ]);
    }
}
