# `CorvoNfse.Types.Invoice`
[🔗](https://github.com/corvo-technology/corvo-nfse-elixir/blob/main/lib/corvo_nfse/types/invoice.ex#L1)

Wire shape of an NFS-e invoice.

The SDK returns the invoice as a plain map with these string keys.

# `create_params`

```elixir
@type create_params() :: map()
```

Params for `CorvoNfse.Resources.Invoices.create/3` and `calculate/2`
(camelCase wire keys, passed through unchanged):

  * `companyId` or `companyTaxId` (CNPJ) - the issuing company
  * `service` (required) - `%{code?:, municipalityCode?:, description?:}`;
    `code` (6 digits) defaults to the company's, then to `100901`
  * `amount` (required) - BRL, positive, up to 2 decimal places
  * `competenceDate` (required) - `YYYY-MM-DD`
  * `customer` (optional) - `%{taxId:, name?:, email?:, address?:}`; when
    sent, `taxId` (CPF or CNPJ) is required
  * `discount` (optional) - unconditional discount, from 0 up to `amount`
  * `email` (optional) - boolean; `options.email.send` wins when set
  * `options` (optional) - `%{email?: %{send: boolean}, type?: "IMMEDIATE" | "SCHEDULE"}`
  * `externalId` (optional)

# `customer_input`

```elixir
@type customer_input() :: map()
```

Customer input for `create_params`.

# `download`

```elixir
@type download() :: %{
  body: binary(),
  mime_type: String.t() | nil,
  file_name: String.t() | nil
}
```

Raw download body returned by `pdf/2` and `xml/2`.

# `download_format`

```elixir
@type download_format() :: :pdf | :xml | String.t()
```

# `environment`

```elixir
@type environment() :: String.t()
```

Environment wire value: "test" | "live".

# `event`

```elixir
@type event() :: map()
```

A single entry of `Invoices.events/3`.

# `stage`

```elixir
@type stage() :: String.t()
```

Stage wire value: "pending" | "authorized" | "documents_ready" | "completed" | "failed".

# `status`

```elixir
@type status() :: String.t()
```

Invoice status wire value: `"queued" | "processing" | "authorized" |
"rejected" | "retry_pending" | "reconciliation_required" |
"manual_review" | "failed"`.

# `t`

```elixir
@type t() :: %CorvoNfse.Types.Invoice{
  accessKey: String.t() | nil,
  amount: number(),
  authorizedAt: String.t() | nil,
  companyId: String.t(),
  competenceDate: String.t(),
  createdAt: String.t(),
  currency: String.t(),
  customerSnapshot: map(),
  documentKeyVersion: integer(),
  documentsReadyAt: String.t() | nil,
  documentsStatus: String.t(),
  dpsId: String.t() | nil,
  dpsNumber: integer() | nil,
  dpsSeries: String.t() | nil,
  emailSnapshot: map(),
  emailStatus: String.t() | nil,
  environment: environment(),
  externalId: String.t() | nil,
  fiscalProvider: String.t() | nil,
  fiscalSchemaVersion: String.t() | nil,
  id: String.t(),
  idempotencyKey: String.t() | nil,
  issuedAt: String.t() | nil,
  lastEmailSentAt: String.t() | nil,
  lastEmailStatus: String.t() | nil,
  lastErrorCode: String.t() | nil,
  lastErrorMessage: String.t() | nil,
  lastErrorProvider: String.t() | nil,
  nfseNumber: integer() | nil,
  scheduledFor: String.t() | nil,
  serviceSnapshot: map(),
  stage: stage(),
  status: status(),
  taxSnapshot: map(),
  tenantId: String.t(),
  updatedAt: String.t()
}
```

---

*Consult [api-reference.md](api-reference.md) for complete listing*
