import { UNAddress, UNDirection, UNOrg } from '../types';
import { UNCents, UNPaymentStatus, UNPaymentType, UNRelationshipsAccount, UNRelationshipsCustomer, UNRelationshipsTransaction } from './payments.types';

export type UNWirePayment = {
  type: UNPaymentType.WirePayment
  id: string
  attributes: {
    createdAt: Date
    amount: UNCents
    direction: UNDirection
    description: string
    status: UNPaymentStatus
    counterparty: UNWirePaymentCounterparty
    reason?: string
    tags?: { [key: string]: string }
  }
  relationships: {
    account: {
      data: UNRelationshipsAccount
    }
    customer?: {
      data: UNRelationshipsCustomer
    }
    customers?: {
      data: UNRelationshipsCustomer[]
    }
    transaction?: {
      data: UNRelationshipsTransaction
    }
    counterpartyAccount: {
      data: {
        type: string
        id: number
      }
    }
    org?: {
      data: UNOrg
    }
  }
}

type UNWirePaymentCounterparty = {
  name: string
  routingNumber: string
  accountNumber: string
  address: UNAddress
}
