# forge_client_org

Player organization UI and client integration.

## UI Login Contract

The web UI sends the following request through `A3API.SendAlert`:

```json
{
    "event": "org::login::request",
    "data": {
        "email": "admin@spearnet.mil",
        "password": "secret"
    }
}
```

On success, SQF should call the browser bridge with:

```sqf
private _payload = createHashMapFromArray [
    ["session", createHashMapFromArray [
        ["actorName", name player],
        ["role", "Leader"]
    ]],
    ["portalData", createHashMapFromArray [
        ["org", createHashMapFromArray [
            ["name", "Black Rifle Company"],
            ["tag", "BRC-0160566824"],
            ["type", "Private Military Company"],
            ["status", "Operational"],
            ["headquarters", "Georgetown Command Annex"],
            ["owner", "Jacob Schmidt"]
        ]],
        ["funds", 482750],
        ["reputation", 72],
        ["members", [
            createHashMapFromArray [["name", "Jacob Schmidt"]],
            createHashMapFromArray [["name", "Mara Velez"]]
        ]],
        ["fleet", [
            createHashMapFromArray [
                ["name", "UH-80 Ghost Hawk"],
                ["type", "helicopter"],
                ["status", "Ready"],
                ["damage", "16%"]
            ]
        ]],
        ["assets", [
            createHashMapFromArray [
                ["name", "First Aid Kits"],
                ["type", "items"],
                ["quantity", "36"]
            ]
        ]],
        ["activity", []],
        ["roadmap", []]
    ]]
];

_control ctrlWebBrowserAction [
    "ExecJS",
    format ["OrgUIBridge.receiveLoginSuccess(%1)", toJSON _payload]
];
```

On failure:

```sqf
private _payload = createHashMapFromArray [
    ["message", "Invalid credentials."]
];

_control ctrlWebBrowserAction [
    "ExecJS",
    format ["OrgUIBridge.receiveLoginFailure(%1)", toJSON _payload]
];
```

Current implementation:

- `fnc_handleUIEvents.sqf` now handles `org::login::request`
- success hydrates the portal with `session` + `portalData`
- failure returns a single `message` string for inline UI feedback
