<?php

return [
    'name' => 'Core',

    'use_email_as_username' => true,

    'google' => [
        'analytics' => [
            'tracking' => env('GOOGLE_ANALYTICS_TRACKING_ID', ''),
            'tracking_g4' => env('GOOGLE_ANALYTICS4_TRACKING_ID', ''),
            'view' => env('GOOGLE_ANALYTICS_VIEW_ID', env('GOOGLE_ANALYTICS_CODE', '')),
            'key_file' => base_path(env('GOOGLE_KEY_FILE', 'vendor/ignite/modules/Core/resources/services/ignite-platform-3-4fcc58082a35.json'))
        ]
    ],

    // The program type determines the content and features displayed to the
    // participant on certain pages. Currently, the recognized/understood
    // types are: redemption, payout. Otherwise default to redemption.
    'program_type' => 'redemption',

    'locale' => [
        'money' => 'en_US.UTF-8'
    ],

    'auth' => [
        'drivers' => [
            env('APP_AUTH_SSO_DEFAULT', null)
        ]
    ],

    // Ignite 3 Core supports "demo mode" where the system will generate some
    // sample demoable data for participants, claims and catalog. The next
    // step is to move the code from Core to a dedicated Demo module.
    'demo' => [
        'allow_events_in_console' => false
    ],

    // The Ignite 3 admin account is added during the seeding process via the
    // command line. In order to dynamically change the admin credentials
    // at install time, you can set the following via environment vars.
    'admin' => [
        'email' => env('ADMIN_EMAIL', 'it@brightspot.email'),
        'password' => env('ADMIN_PASSWORD', 'br1ght3r1d34s!')
    ],

    /**
     * Source models implement the Source interface and provide a toDropdown method which can be used to
     * retrieve select dropdown values in a polymorphic way for use in forms.
     *
     * @see Ignite\Core\Contracts\Source
     */
    'source' => [
        'models' => [
            'countries' => Ignite\Core\Models\Options\Countries::class,
            'states' => Ignite\Core\Models\Options\States::class,
            'canada_states' => Ignite\Core\Models\Options\CanadaStates::class,
            'user_states' => Ignite\Core\Models\Options\UserStates::class,
            'participant_types' => Ignite\Core\Models\Options\ParticipantTypes::class,
            'user_statuses' => Ignite\Core\Models\Options\UserStatuses::class,
            'user_types' => Ignite\Core\Models\Options\UserTypes::class,
        ]
    ],

    // At certain points in the Ignite 3 Core, HTML is saved to the database,
    // in order to protect our sites from XSS attacks we purify the html
    // before storing it, so we are safe to render it to the template.
    'html' => [
        // HTML Purifier Options - http://htmlpurifier.org/live/configdoc/plain.html
        'options' => [
            'Core.Encoding' => 'UTF-8',
            'HTML.Doctype' => 'XHTML 1.0 Strict',
            'HTML.Allowed' => 'h1[class],h2[class],h3[class],h4[class],h5[class],h6[class],div[class|style],blockquote[class],ul[class|style],ol[class|style],li[class],p[style|class],b[class|style],strong[class|style],i[class|style],em[class|style],a[class|style|href|title|target],br[class|style],span[class|style],img[class|style|width|height|alt|src],table[class|style|summary],hr[class|style],tbody[class|style],thead[class|style],td[class|style|abbr],tr[class|style],th[class|style|abbr],tfoot',
            'HTML.MaxImgLength' => null,
            'CSS.MaxImgLength' => null,
            'CSS.AllowedProperties' => 'font-size,font-weight,float,font-style,text-align,text-decoration,padding,margin,color,background-color,text-align,max-width,max-height,height,width',
            'CSS.AllowTricky' => true,
            'AutoFormat.AutoParagraph' => true,
            'AutoFormat.RemoveEmpty' => false,
            'AutoFormat.RemoveSpansWithoutAttributes' => true,
        ]
    ],

    'participant' => [
        'states' => [
            'map' => [
                'US' => Ignite\Core\Models\Options\States::class,
                'CA' => Ignite\Core\Models\Options\CanadaStates::class,
            ],
            'default' => Ignite\Core\Models\Options\States::class,
        ],

        'types' => [
            'Account Executive' => 'Account Executive',
            'Sales Engineer' => 'Sales Engineer',
            'Sales Manager' => 'Sales Manager',
            'Sales Engineer Manager' => 'Sales Engineer Manager',
        ],

        'factory' => [
            'strategy' => Ignite\Core\Services\Participant\Strategy\DefaultStrategy::class,
        ],

        'emails' => [
            'enrollment' => [
                'active' => true,
                'template' => 'emails.auth.registered',
                'subject' => 'Activate your Registration - Enrollment Confirmation'
            ]
        ],
    ],

    'dashboard' => [
        'default' => 'Core',
        'autolocate' => true,
        'startCurrent' => now()->startOfMonth()->format('Y-m-d'),
        'endCurrent' => now()->endOfMonth()->format('Y-m-d'),
        'startPrevious' => now()->subMonth()->startOfMonth()->format('Y-m-d'),
        'endPrevious' => now()->subMonth()->endOfMonth()->format('Y-m-d'),
    ],

    'cms' => [
        'disk' => env('CMS_STORAGE_DISK', 'public'),
        'folder' => env('CMS_STORAGE_FOLDER', 'uploads'),
        'templates' => [
            'default' => 'Default',
        ],
    ],

    'transaction' => [
        'resource' => [
            'identifier' => 'email',
            'resolvers' => [
                'user' => Ignite\Core\Models\Import\Resolvers\UserResolver::class
            ]
        ]
    ],

    'report' => [
        'filters' => [
            Ignite\Core\Models\Report\EnrollmentReport::class => [
                [
                    'view' => 'Core::admin.report.filters.daterange',
                    'scope' => Ignite\Core\Models\Grid\Scopes\DateScope::class,
                    'request' => ['field', 'value', 'startDate', 'endDate'],
                    'field' => 'participant.created_at',
                    'label' => 'Sign Up Date',
                ],
                [
                    'view' => 'Core::admin.report.filters.daterange',
                    'scope' => Ignite\Core\Models\Grid\Scopes\DateScope::class,
                    'request' => ['field', 'value', 'startDate', 'endDate'],
                    'field' => 'participant.approved_at',
                    'label' => 'Enroll Date',
                ],
                [
                    'view' => 'Core::admin.report.filters.country',
                    'scope' => Ignite\Core\Models\Grid\Scopes\CountryScope::class,
                    'request' => ['field', 'value'],
                    'label' => 'Country',
                    'field' => 'participant.country',
                    'options' => ['US' => 'US', 'CA' => 'Canada']
                ]
            ],
            Ignite\Core\Models\Report\TaxReport::class => [
                [
                    [
                        'view' => 'Core::admin.report.filters.daterange',
                        'scope' => Ignite\Core\Models\Grid\Scopes\DateScope::class,
                        'request' => ['field', 'value', 'startDate', 'endDate'],
                        'field' => 'transaction.transaction_date',
                        'label' => 'Transaction Date'
                    ],
                    [
                        'view' => 'Core::admin.report.filters.daterange',
                        'scope' => Ignite\Core\Models\Grid\Scopes\DateScope::class,
                        'request' => ['field', 'value', 'startDate', 'endDate'],
                        'field' => 'transaction.transaction_date',
                        'label' => 'Transaction Date',
                    ],
                    [
                        'view' => 'Core::admin.report.filters.country',
                        'scope' => Ignite\Core\Models\Grid\Scopes\CountryScope::class,
                        'request' => ['field', 'value'],
                        'field' => 'participant.country',
                        'label' => 'Country',
                        'options' => ['US' => 'US', 'CA' => 'Canada']
                    ]
                ]
            ],
            Ignite\Core\Models\Report\TotalEarnedReport::class => [
                [
                    'view' => 'Core::admin.report.filters.daterange',
                    'scope' => Ignite\Core\Models\Grid\Scopes\DateScope::class,
                    'request' => ['field', 'value', 'startDate', 'endDate'],
                    'field' => 'transaction.transaction_date',
                    'label' => 'Transaction Date'
                ],
                [
                    'view' => 'Core::admin.report.filters.daterange',
                    'scope' => Ignite\Core\Models\Grid\Scopes\DateScope::class,
                    'request' => ['field', 'value', 'startDate', 'endDate'],
                    'field' => 'participant.created_at',
                    'label' => 'Enrolled Date'
                ],
                [
                    'view' => 'Core::admin.report.filters.country',
                    'scope' => Ignite\Core\Models\Grid\Scopes\CountryScope::class,
                    'request' => ['field', 'value'],
                    'field' => 'participant.country',
                    'label' => 'Country',
                    'options' => ['US' => 'US', 'CA' => 'Canada']
                ]
            ],
            Ignite\Core\Models\Report\TotalRedeemedReport::class => [
                [
                    'view' => 'Core::admin.report.filters.daterange',
                    'scope' => Ignite\Core\Models\Grid\Scopes\DateScope::class,
                    'request' => ['field', 'value', 'startDate', 'endDate'],
                    'field' => 'transaction.transaction_date',
                    'label' => 'Transaction Date'
                ],
                [
                    'view' => 'Core::admin.report.filters.daterange',
                    'scope' => Ignite\Core\Models\Grid\Scopes\DateScope::class,
                    'request' => ['field', 'value', 'startDate', 'endDate'],
                    'field' => 'participant.created_at',
                    'label' => 'Enrolled Date',
                ],
                [
                    'view' => 'Core::admin.report.filters.country',
                    'scope' => Ignite\Core\Models\Grid\Scopes\CountryScope::class,
                    'request' => ['field', 'value'],
                    'field' => 'participant.country',
                    'label' => 'Country',
                    'options' => ['US' => 'US', 'CA' => 'Canada']
                ]
            ],
            Ignite\Core\Models\Report\TotalBalanceReport::class => [
                [
                    'view' => 'Core::admin.report.filters.daterange',
                    'scope' => Ignite\Core\Models\Grid\Scopes\DateScope::class,
                    'request' => ['field', 'value', 'startDate', 'endDate'],
                    'field' => 'transaction.transaction_date',
                    'label' => 'Transaction Date'
                ],
                [
                    'view' => 'Core::admin.report.filters.daterange',
                    'scope' => Ignite\Core\Models\Grid\Scopes\DateScope::class,
                    'request' => ['field', 'value', 'startDate', 'endDate'],
                    'field' => 'participant.created_at',
                    'label' => 'Enrolled Date',
                ],
                [
                    'view' => 'Core::admin.report.filters.country',
                    'scope' => Ignite\Core\Models\Grid\Scopes\CountryScope::class,
                    'request' => ['field', 'value'],
                    'field' => 'participant.country',
                    'label' => 'Country',
                    'options' => ['US' => 'US', 'CA' => 'Canada']
                ]
            ]
        ]
    ],

    'seeder' => [
        // the path to your seeder files, like 'modules/Program/database/data'
        // if left blank, defaults to 'vendor/ignite/modules/Core/database/data'
        'path' => null,
    ],

    'import' => [
        'queue' => true,

        // if your imports needs more time, you should set this to 'long-running'
        // and create configurations for it in config/horizon.php (timeout parameter)
        // and in config/queue.php (retry_after parameter)
        'queue_connection' => '',

        'timeout' => 300,

        'reader' => [
            'pattern' => '/\[(?P<date>.*)\] (?P<logger>\w+).(?P<level>\w+): (?P<message>[^\[\{]+) (?P<context>[\[\{].*[\]\}]) (?P<extra>[\[\{].*[\]\}])/',
        ],

        'types' => [
            'participant' => [
                'class' => Ignite\Core\Services\Importers\Participants::class,
                'label' => 'Participant'
            ],
            'transaction' => [
                'class' => Ignite\Core\Services\Importers\Transactions::class,
                'label' => 'Transaction'
            ],
        ],
    ],
];
