interface EnvUser {
    USER: DurableObjectNamespace,
}

import type { Faisan } from './faisan-types'
export { Faisan } from './faisan-types'
export { SimulationCommunaute } from './simulation_communaute.js'

export async function userForm(env: EnvUser, id: DurableObjectId, body: Faisan.CreateProjet): Promise<Faisan.CreateProjetResp>
export async function userForm(env: EnvUser, id: DurableObjectId, body: Faisan.SaveProjet): Promise<null>
export async function userForm(env: EnvUser, id: DurableObjectId, body: Faisan.ListProjets): Promise<Faisan.ListProjetsResp>
export async function userForm(env: EnvUser, id: DurableObjectId, body: Faisan.DelProjet): Promise<null>
export async function userForm(env: EnvUser, id: DurableObjectId, body: Faisan.GetProjet): Promise<Faisan.GetProjetResp>
export async function userForm(env: EnvUser, id: DurableObjectId, body: Faisan.Cmd): Promise<any> {
    let headers = new Headers();
    headers.set("Content-Type", "application/json");
    let stub = env.USER.get(id);
    let x = await (await stub.fetch(
        "https://y.coturnix.fr",
        {
            method: "POST",
            body: JSON.stringify(body),
            headers,
        }
    )).text()
    console.log("userForm json", x)
    return JSON.parse(x)
}