1<?php
2
3// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the GNU Affero General Public License v3.0.
4// See the LICENCE file in the repository root for full licence text.
5
6declare(strict_types=1);
7
8namespace Database\Factories;
9
10use App\Models\User;
11use App\Models\UserAccountHistory;
12
13class UserAccountHistoryFactory extends Factory
14{
15 protected $model = UserAccountHistory::class;
16
17 public function definition(): array
18 {
19 return [
20 'reason' => fn () => $this->faker->bs(),
21 // 5 minutes (300 seconds) times 2 to the nth power (as in the standard osu silence durations)
22 'period' => fn () => 300 * (2 ** rand(1, 10)),
23 'banner_id' => fn () => User::inRandomOrder()->first(),
24 ];
25 }
26
27 public function note()
28 {
29 return $this->state(['ban_status' => 0]);
30 }
31
32 public function restriction()
33 {
34 return $this->state(['ban_status' => 1]);
35 }
36
37 public function silence()
38 {
39 return $this->state(['ban_status' => 2]);
40 }
41
42 public function tournamentBan()
43 {
44 return $this->state(['ban_status' => 3]);
45 }
46}