<?php

// config/minimax.php

$accounts = [];
$accountKeys = array_filter(explode(',', env('MINIMAX_ACCOUNTS', '')));

foreach ($accountKeys as $key) {
    $key = trim($key);
    $prefix = 'MINIMAX_' . strtoupper($key) . '_';
    $accounts[$key] = [
        'client_id' => env($prefix . 'CLIENT_ID'),
        'client_secret' => env($prefix . 'CLIENT_SECRET'),
        'organization_id' => env($prefix . 'ORGANIZATION_ID'),
        'username' => env($prefix . 'USERNAME'),
        'password' => env($prefix . 'PASSWORD'),
        'url' => env($prefix . 'URL', 'https://moj.minimax.hr/HR'),
        'scope' => env($prefix . 'SCOPE', 'minimax.'),
        'grant_type' => 'password',
    ];
}

return [
    'accounts' => $accounts,
];
