# Registru

8 rute, cu exemplu de cerere pentru fiecare.

Adresa de bază: `https://app.ilustromania.com/nucleu`

### GET /v1/registru

Acces: `sesiune`

**Starea Registrului**

Starea celor 7 colecții ale Registrului pentru firma din sesiune. Citire pentru admin, patron, finanțe; fără cache.

```bash
curl https://app.ilustromania.com/nucleu/v1/registru \
  -H "Cookie: __Host-sesiune=$JETON_SESIUNE"
```

### GET /v1/registru/col

Acces: `sesiune`

**Documentele unei colecții din Registru**

Documentele colecției `?c=`, opțional filtrate `camp=egal`; colecția `acte_data` cere filtru.

```bash
curl https://app.ilustromania.com/nucleu/v1/registru/col \
  -H "Cookie: __Host-sesiune=$JETON_SESIUNE"
```

### POST /v1/registru/col/scrie

Acces: `sesiune`

**Scrie în Registru**

Operații `set`, `update` sau `delete` pe un document al colecției, cu versiune: 409 `versiune_veche`. Schimbarea numerelor de factură cere `REGISTRU_EMITE`; 409 `numar_dublat`.

```bash
curl -X POST https://app.ilustromania.com/nucleu/v1/registru/col/scrie \
  -H "Cookie: __Host-sesiune=$JETON_SESIUNE" \
  -H "Content-Type: application/json" \
  -d '{ … }'
```

### GET /v1/registru/drept-emite

Acces: `sesiune`

**Pot emite din Registru**

`{emite}`: dacă contul din sesiune are dreptul `REGISTRU_EMITE` pe firma activă (`false`, nu 403, pentru cine nu îl are).

```bash
curl https://app.ilustromania.com/nucleu/v1/registru/drept-emite \
  -H "Cookie: __Host-sesiune=$JETON_SESIUNE"
```

### POST /v1/registru/numar

Acces: `sesiune` · acceptă `Idempotency-Key`

**Alocă numărul de proformă sau factură**

Alocă atomic următorul număr pe firmă pentru `proforma`/`factura` și an; 403 fără `REGISTRU_EMITE`.

```bash
curl -X POST https://app.ilustromania.com/nucleu/v1/registru/numar \
  -H "Cookie: __Host-sesiune=$JETON_SESIUNE" \
  -H "Content-Type: application/json" \
  -d '{ … }'
```

### DELETE /v1/registru/oferte

Acces: `sesiune`

**Șterge o ofertă din Registru**

Șterge oferta `?id=`; 204.

```bash
curl -X DELETE https://app.ilustromania.com/nucleu/v1/registru/oferte \
  -H "Cookie: __Host-sesiune=$JETON_SESIUNE"
```

### POST /v1/registru/oferte

Acces: `sesiune` · acceptă `Idempotency-Key`

**Adaugă o ofertă în Registru**

Creează o ofertă pentru un client, cu id și dată puse pe server.

```bash
curl -X POST https://app.ilustromania.com/nucleu/v1/registru/oferte \
  -H "Cookie: __Host-sesiune=$JETON_SESIUNE" \
  -H "Content-Type: application/json" \
  -d '{ … }'
```

### PUT /v1/registru/oferte

Acces: `sesiune`

**Schimbă o ofertă din Registru**

Rescrie o ofertă existentă din Registru.

```bash
curl -X PUT https://app.ilustromania.com/nucleu/v1/registru/oferte \
  -H "Cookie: __Host-sesiune=$JETON_SESIUNE" \
  -H "Content-Type: application/json" \
  -d '{ … }'
```
