<?php

namespace Database\Seeders;

use App\Models\Plan;
use Illuminate\Database\Seeder;

class RolePlansSeeder extends Seeder
{
    public function run(): void
    {
        $plans = [
            [
                'name'         => 'Beta Tester',
                'sort'         => 990,
                'plan_key'     => 'beta_tester',
                'price'        => 0,
                'credit_limit' => 2000,
                'device_limit' => 3,
                'active'       => true,
                'is_internal'  => true,
                'ai_config'    => [
                    'model'       => 'gpt-4o-mini',
                    'temperature' => 0.5,
                    'max_tokens'  => 1500,
                    'input_cost'  => 0.00015,
                    'output_cost' => 0.0006,
                ],
            ],
            [
                'name'         => 'Affiliate',
                'sort'         => 991,
                'plan_key'     => 'affiliate',
                'price'        => 0,
                'credit_limit' => 1000,
                'device_limit' => 2,
                'active'       => true,
                'is_internal'  => true,
                'ai_config'    => [
                    'model'       => 'gpt-4o-mini',
                    'temperature' => 0.5,
                    'max_tokens'  => 1500,
                    'input_cost'  => 0.00015,
                    'output_cost' => 0.0006,
                ],
            ],
            [
                'name'         => 'Support',
                'sort'         => 992,
                'plan_key'     => 'support',
                'price'        => 0,
                'credit_limit' => 5000,
                'device_limit' => 5,
                'active'       => true,
                'is_internal'  => true,
                'ai_config'    => [
                    'model'       => 'gpt-4o',
                    'temperature' => 0.5,
                    'max_tokens'  => 2000,
                    'input_cost'  => 0.0025,
                    'output_cost' => 0.01,
                ],
            ],
            [
                'name'         => 'Developer',
                'sort'         => 993,
                'plan_key'     => 'developer',
                'price'        => 0,
                'credit_limit' => 0,
                'device_limit' => 99,
                'active'       => true,
                'is_internal'  => true,
                'ai_config'    => [
                    'model'       => 'gpt-4o',
                    'temperature' => 0.5,
                    'max_tokens'  => 2000,
                    'input_cost'  => 0.0025,
                    'output_cost' => 0.01,
                ],
            ],
        ];

        foreach ($plans as $plan) {
            Plan::updateOrCreate(
                ['plan_key' => $plan['plan_key']],
                $plan
            );
        }

        $this->command->info(count($plans) . ' Rollen-Pläne erstellt/aktualisiert.');
    }
}
