package com.tt.honeyDue.fixtures

import kotlin.random.Random

/**
 * Test user fixture mirroring `TestFixtures.TestUser` in Swift.
 *
 * `seededTestUser()` yields the known-good backend account that
 * `AAA_SeedTests` ensures exists before the parallel suites run.
 */
data class TestUser(
    val username: String,
    val email: String,
    val password: String,
    val firstName: String = "Test",
    val lastName: String = "User",
) {
    companion object {
        /** Pre-existing user seeded against the dev backend. */
        fun seededTestUser(): TestUser = TestUser(
            username = "testuser",
            email = "testuser@honeydue.com",
            password = "TestPass123!",
        )

        /** Admin account used by admin-gated flows. */
        fun seededAdminUser(): TestUser = TestUser(
            username = "admin",
            email = "admin@honeydue.com",
            password = "Test1234",
        )

        /**
         * Unique, ephemeral user used for registration flows that cannot
         * re-use an existing account. Cleaned up by `SuiteZZ_CleanupTests`.
         */
        fun ephemeralUser(suffix: String = randomSuffix()): TestUser = TestUser(
            username = "uitest_$suffix",
            email = "uitest_$suffix@test.com",
            password = "TestPassword123!",
            firstName = "Test",
            lastName = "User",
        )

        private fun randomSuffix(): String =
            Random.nextInt(100_000, 999_999).toString()
    }
}
