<?php

namespace Blazemedia\Affiliation\Support\Traits;

trait Endpoints {

    protected static function defineApiEndpoints(string $env): void {
        $config = match ($env) {
            'production','newlp' => [
                'BLZ_API_RENDERING_MANAGER' => 'https://rendering-manager.blazemedia.it/api/',
                'BLZ_API_AUTHOR_MANAGER'    => 'https://author-manager.blazemedia.it/wp-json/api/v1/',
                'BLZ_API_LINK_PROVIDER'     => 'https://stored-links-provider.blazemedia.it/wp-json/api/v1/',
                'BLZ_API_FORMAT_PROVIDER'   => 'https://format-provider.blazemedia.it/wp-json/api/v1/',
                'BLZ_FORMAT_PROVIDER'       => 'https://format-provider.blazemedia.it/wp/wp-admin',
                'BLZ_API_BRANDED_CONTENT'   => 'https://branded-content-tracking-manager.blazemedia.it/api/',
            ],
            'local' => [
                'BLZ_API_RENDERING_MANAGER' => 'http://rendering-manager.test/api/',
                'BLZ_API_AUTHOR_MANAGER'    => 'http://author_manager.test/wp-json/api/v1/',
                'BLZ_API_LINK_PROVIDER'     => 'http://stored-links-provider.test/api/',
                'BLZ_API_FORMAT_PROVIDER'   => 'http://format_provider.test/wp-json/api/v1/',
                'BLZ_FORMAT_PROVIDER'       => 'http://format_provider.test/wp/wp-admin',
                'BLZ_API_BRANDED_CONTENT'   => 'http://branded-content-tracking-manager.test/api/',
            ],
            default => [
                'BLZ_API_RENDERING_MANAGER' => 'https://laravel-rendering.test.blazemedia.it/api/',
                'BLZ_API_AUTHOR_MANAGER'    => 'https://authors-manager.test.blazemedia.it/wp-json/api/v1/',
                'BLZ_API_LINK_PROVIDER'     => 'https://stored-links-provider.test.blazemedia.it/api/',
                'BLZ_API_FORMAT_PROVIDER'   => 'https://format-provider.test.blazemedia.it/wp-json/api/v1/',
                'BLZ_FORMAT_PROVIDER'       => 'https://format-provider.test.blazemedia.it/wp/wp-admin',
                'BLZ_API_BRANDED_CONTENT'   => 'https://branded-content-tracking-manager.test.blazemedia.it/api/',
            ],
        };

        foreach ($config as $key => $value) {
            if (!defined($key)) {
                define($key, $value);
            }
        }
    }
}
