<?php

namespace Database\Seeders;

use Illuminate\Database\Seeder;
use App\Models\User;
use App\Models\Order;
use App\Models\Service;
use Illuminate\Support\Facades\Hash;
use \Stripe\Stripe;
use \Stripe\Customer;

class DatabaseSeeder extends Seeder
{
    /**
     * Seed the application's database.
     *
     * @return void
     */
    public function run()
    {
		Stripe::setApiKey(env('STRIPE_SECRET'));
		Service::create([
			'name' => 'Unique Views with Engagements',
			'type' => 'views',
			'site' => 'youtube',
			'minimum' => 1000,
			'maximum' => 500000,
			'price' => 11,
			'available' => true,
		]);
		Service::create([
			'name' => 'Language Targeted Views',
			'type' => 'views',
			'site' => 'youtube',
			'modifier' => 'language',
			'minimum' => 1000,
			'maximum' => 100000,
			'price' => 20,
			'available' => true,
		]);
		Service::create([
			'name' => 'Location Targeted Views',
			'type' => 'views',
			'site' => 'youtube',
			'modifier' => 'location',
			'minimum' => 1000,
			'maximum' => 100000,
			'price' => 25,
			'available' => true,
		]);
		Service::create([
			'name' => 'Random Comments',
			'type' => 'comments',
			'site' => 'youtube',
			'minimum' => 100,
			'maximum' => 10000,
			'price' => 55,
			'available' => true,
		]);
		Service::create([
			'name' => 'Subscribers',
			'type' => 'subscribers',
			'site' => 'youtube',
			'minimum' => 100,
			'maximum' => 10000,
			'price' => 50,
			'available' => true,
		]);
		Service::create([
			'name' => 'Likes',
			'type' => 'likes',
			'site' => 'youtube',
			'minimum' => 1000,
			'maximum' => 100000,
			'price' => 30,
			'available' => true,
		]);
		Service::create([
			'name' => 'Likes',
			'type' => 'likes',
			'site' => 'instagram',
			'minimum' => 200,
			'maximum' => 10000,
			'price' => 15,
			'available' => true,
		]);
		Service::create([
			'name' => 'Impressions With Profile Visits',
			'type' => 'impressions',
			'site' => 'instagram',
			'minimum' => 200,
			'maximum' => 20000,
			'price' => 35,
			'available' => true,
		]);
		Service::create([
			'name' => 'Post Impressions',
			'type' => 'impressions',
			'site' => 'instagram',
			'minimum' => 1000,
			'maximum' => 1000000,
			'price' => 6,
			'available' => true,
		]);
		Service::create([
			'name' => 'Profile Visits',
			'type' => 'profile',
			'site' => 'instagram',
			'minimum' => 1000,
			'maximum' => 100000,
			'price' => 6,
			'available' => true,
		]);
		Service::create([
			'name' => 'Followers',
			'type' => 'followers',
			'site' => 'twitter',
			'minimum' => 100,
			'maximum' => 10000,
			'price' => 12,
			'available' => true,
		]);
		Service::create([
			'name' => 'Video Views',
			'type' => 'views',
			'site' => 'twitter',
			'minimum' => 1000,
			'maximum' => 100000,
			'price' => 15,
			'available' => true,
		]);
		Service::create([
			'name' => 'Impressions',
			'type' => 'impressions',
			'site' => 'twitter',
			'minimum' => 1000,
			'maximum' => 100000,
			'price' => 15,
			'available' => true,
		]);
		Service::create([
			'name' => 'Followers',
			'type' => 'followers',
			'site' => 'twitter',
			'minimum' => 100,
			'maximum' => 100000,
			'price' => 15,
			'available' => true,
		]);
		Service::create([
			'name' => 'Likes',
			'type' => 'likes',
			'site' => 'tiktok',
			'minimum' => 100,
			'maximum' => 100000,
			'price' => 13,
			'available' => true,
		]);
		Service::create([
			'name' => 'Shares',
			'type' => 'shares',
			'site' => 'tiktok',
			'minimum' => 100,
			'maximum' => 100000,
			'price' => 15,
			'available' => true,
		]);
		Service::create([
			'name' => 'Followers',
			'type' => 'followers',
			'site' => 'tiktok',
			'minimum' => 100,
			'maximum' => 100000,
			'price' => 12,
			'available' => true,
		]);
		 User::create([
			'name' => 'test_user_unverified',
			'email' => 'unverified@example.com',
			'role' => 'client',
			'customer_id' => Customer::create(['email' => 'unverified@example.com'])->id,
			'active' => true,
			'password' => Hash::make("test123")
		]);
		$test_user = User::create([
			'name' => 'test_user_verified',
			'email' => 'verified@example.com',
			'email_verified_at' => now(),
			'credits' => 250,
			'customer_id' => Customer::create(['email' => 'verified@example.com'])->id,
			'role' => 'client',
			'active' => true,
			'password' => Hash::make("test123")
		]);
		User::create([
			'name' => 'test_admin_verified',
			'email' => 'admin_verified@example.com',
			'email_verified_at' => now(),
			'customer_id' => Customer::create(['email' => 'admin_verified@example.com'])->id,
			'role' => 'admin',
			'active' => true,
			'password' => Hash::make("test123")
		]);

		Order::factory()->count(15)->for($test_user)->create();
		Order::factory()->count(25)->create();
    }
}
