# ACCOUNT MANAGER

The Account Manager is a core module of `17mov_Phone` that handles cross-app user registration, profile data validation, and credential management. It provides a centralized way to create accounts for various integrated social and utility apps.

### Account Data

To create an account via exports, in addition to standard credentials like `username` and `password`, you must provide a dedicated `accountData` table.

{% hint style="warning" %}
AccountData contains app-specific settings and profile details. Each application requires a different data structure. If the data provided does not match the specific app's schema requirements (e.g., missing interests for Swiply or an invalid verification level for Qwuaker), the registration will fail.
{% endhint %}

Below are the classes required for the `accountData` parameter based on the application you are registering for.

<details>

<summary>SwiplyData</summary>

```lua
--- @class SwiplyData
--- @field firstname string Display Name
--- @field lastname string Display Last Name
--- @field aboutme string Profile description
--- @field dateofbirth number Unix Timestamp (seconds or ms)
--- @field gender     0|1|2 = 0: Male, 1: Female, 2: Other
--- @field preference 0|1|2 = 0: Male, 1: Female, 2: Other
--- @field lookingfor 0|1|2 = 0: None, 1: FWB, 2: Relationship
--- @field intrests number[] Array of interest IDs (min 3, max 15)
--- @field photos string[] Array of image URLs (min 2, max 6)
--- @field location {x: number, y: number} Coordinates
```

</details>

<details>

<summary>QwuakerData</summary>

```lua
--- @class QwuakerData
--- @field avatar string URL link to profile picture
--- @field background string URL link to profile background
--- @field name string Display Name
--- @field gender string Display Gender
--- @field verifiedLevel 0|1|2|3 Account verification level (range 0-3)
```

</details>

<details>

<summary>PeargramData</summary>

```lua
--- @class PeargramData
--- @field avatar string URL link to profile picture
--- @field name string Display Name
```

</details>

<details>

<summary>DarkChatData</summary>

```lua
--- @class DarkChatData
--- @field name string Display Name
--- @field avatar string URL link to avatar image
```

</details>

<details>

<summary>EbuyData</summary>

```lua
--- @field name string Display Name
--- @field avatar string URL link to profile image
```

</details>

<details>

<summary>MailData</summary>

```lua
--- @field name string Display Name
--- @field avatar string URL link to profile image
```

</details>

### RegisterAccountBySrc

Creates a new user account for a specific application using the player's Server ID.

```lua
local success = exports["17mov_Phone"]:RegisterAccountBySrc(src, username, password, appName, accountData)
```

Returns:

* `table`: Returns the account object on success, or `object` if validation fails with the error code.

<table><thead><tr><th width="122" align="center">Argument</th><th width="93" align="center">Type</th><th width="103.37109375" align="center">Optional</th><th>Explanation</th></tr></thead><tbody><tr><td align="center">src</td><td align="center"><code>number</code></td><td align="center">❌</td><td>The server ID of the player.</td></tr><tr><td align="center">username</td><td align="center"><code>string</code></td><td align="center">❌</td><td>The desired login/username</td></tr><tr><td align="center">password</td><td align="center"><code>string</code></td><td align="center">❌</td><td>The account password.</td></tr><tr><td align="center">appName</td><td align="center"><code>string</code></td><td align="center">❌</td><td>Name of the app (Full list available in Config.AppDefinitions)</td></tr><tr><td align="center">accountData</td><td align="center"><code>table</code></td><td align="center">❌</td><td>The specific Data Object for the app (see above)</td></tr></tbody></table>

### RegisterAccountByNumber

Creates a new user account using the player's Phone Number. Useful for offline registrations or number based logic

```lua
local success = exports["17mov_Phone"]:RegisterAccountByNumber(number, username, password, appName, accountData)
```

Returns:

* `table`: Returns the account object on success, or `object` if validation fails with the error code.

<table><thead><tr><th width="122" align="center">Argument</th><th width="93" align="center">Type</th><th width="103.37109375" align="center">Optional</th><th>Explanation</th></tr></thead><tbody><tr><td align="center">number</td><td align="center"><code>number</code></td><td align="center">❌</td><td>The target player's phone number</td></tr><tr><td align="center">username</td><td align="center"><code>string</code></td><td align="center">❌</td><td>The desired login/username</td></tr><tr><td align="center">password</td><td align="center"><code>string</code></td><td align="center">❌</td><td>The account password.</td></tr><tr><td align="center">appName</td><td align="center"><code>string</code></td><td align="center">❌</td><td>Name of the app (Full list available in Config.AppDefinitions)</td></tr><tr><td align="center">accountData</td><td align="center"><code>table</code></td><td align="center">❌</td><td>The specific Data Object for the app (see above)</td></tr></tbody></table>
