<commit_before>// ---------------------------------------------------------------------------
// 'External' modules --------------------------------------------------------
// ---------------------------------------------------------------------------
import Promise  from 'bluebird';
import R        from 'ramda';

// ---------------------------------------------------------------------------
// Project modules -----------------------------------------------------------
// ---------------------------------------------------------------------------
import {
  getter
, publisher
} from '../../request';

import {
  baseUrl
, unAuthPostSetup
, postSetup
, putSetup
, getSetup
, listSetup
} from '../util';

import {
  InvoiceExpressCountry
, InvoiceExpressCountryCode
} from '../../../lib/country';

import {
  Address
, Auth
, IdBase
, SendOptions
, SupportedLanguages
, Type
} from '../sharedInterfaces';

// ---------------------------------------------------------------------------
// Types ---------------------------------------------------------------------
// ---------------------------------------------------------------------------
export interface Client extends Address, Partial<IdBase>
  { id?           : number
  , name          : string
  , code          : string
  , language?     : SupportedLanguages
  , country?      : InvoiceExpressCountry
  , website?      : string
  , phone?        : string
  , fax?          : string
  , observations? : string
  , sendOptions?  : SendOptions
  }

export interface TaxName
  { name   : string
  }

export interface TaxBase extends TaxName
  { // %, 0 <= 100
    value       : number
  }

export type TaxRegion
  = 'PT'            // Portugal Continental
  | 'PT-AC'         // Açores
  | 'PT-MA'         // Madeira
  | 'Desconhecido'  // Unknown
  ;

export enum DefaultTaxEnum
  { NonDefaultTax = 0
  , DefaultTax    = 1
  }

export interface TaxCreate extends TaxBase
  { region      : TaxRegion
  , defaultTax? : DefaultTaxEnum
  }

export interface TaxGet extends TaxBase
  { id : string
  }

export interface ItemBase
  { name        : string
  , description : string
    // >= 0.0
  , unitPrice   : number
    // >= 0
  , quantity    : number
  }

export interface ItemCreate extends ItemBase
  {  tax? : TaxName
  }

export interface ItemsCreate
  { '@': Type
  , item: Array<ItemCreate>
  }

export interface ItemGet extends ItemBase
  { tax: TaxGet
  }

export interface ItemsGet
  { '@': Type
  , item: Array<ItemGet>
  }

export type TaxExemption
  = 'M01'
  | 'M02'
  | 'M03'
  | 'M04'
  | 'M05'
  | 'M06'
  | 'M07'
  | 'M08'
  | 'M09'
  | 'M10'
  | 'M11'
  | 'M12'
  | 'M13'<commit_msg>improved type definitions for invoice<commit_after>// ---------------------------------------------------------------------------
// 'External' modules --------------------------------------------------------
// ---------------------------------------------------------------------------
import Promise  from 'bluebird';
import R        from 'ramda';

// ---------------------------------------------------------------------------
// Project modules -----------------------------------------------------------
// ---------------------------------------------------------------------------
import {
  getter
, publisher
} from '../../request';

import {
  baseUrl
, unAuthPostSetup
, postSetup
, putSetup
, getSetup
, listSetup
} from '../util';

import {
  InvoiceExpressCountry
, InvoiceExpressCountryCode
} from '../../../lib/country';

import {
  Address
, Auth
, IdBase
, SendOptions
, SupportedLanguages
, Type
} from '../sharedInterfaces';

// ---------------------------------------------------------------------------
// Types ---------------------------------------------------------------------
// ---------------------------------------------------------------------------
export interface Client extends Address, Partial<IdBase>
  { id?           : number
  , name          : string
  , code          : string
  , language?     : SupportedLanguages
  , country?      : InvoiceExpressCountry
  , website?      : string
  , phone?        : string
  , fax?          : string
  , observations? : string
  , sendOptions?  : SendOptions
  }

export interface TaxName
  { name   : string
  }

export interface TaxBase extends TaxName
  { // %, 0 <= 100
    value       : number
  }

export type TaxRegion
  = 'PT'            // Portugal Continental
  | 'PT-AC'         // Açores
  | 'PT-MA'         // Madeira
  | 'Desconhecido'  // Unknown
  ;

export enum DefaultTaxEnum
  { NonDefaultTax = 0
  , DefaultTax    = 1
  }

export interface TaxCreate extends TaxBase
  { region      : TaxRegion
  , defaultTax? : DefaultTaxEnum
  }

export interface TaxGet extends TaxBase
  { id : string
  }

export interface ItemBase
  { name        : string
  , description : string
    // >= 0.0
  , unitPrice   : number
    // >= 0
  , quantity    : number
  }

export interface ItemCreate extends ItemBase
  {  tax? : TaxName
  }

export interface ItemsCreate
  { '@': Type
  , item: Array<ItemCreate>
  }

export interface ItemGet extends ItemBase
  { tax: TaxGet
  , subtotal : number
  , taxAmount: number
  , total    : number
  }

export interface ItemsGet
  { '@': Type
  , item: Array<ItemGet>
  }

export type TaxExemption
  = 'M01'
  | 'M02'
  | 'M03'
  | 'M04'
  | 'M05'
  | 'M06'
  | 'M07'
  | 'M08'
  | 'M09'
  | 'M10'
  | 'M11'
  | 'M12'
  | 'M13'
{'fraction_non_alphanumeric': 0.32680945347119644, 'fraction_numerical': 0.01292466765140325, 'mean_word_length': 1.1234809878479028, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5910836', 'n_tokens_mistral': 1449, 'n_tokens_neox': 1396, 'n_words': 353}