import { UNDirection, UNOrg } from '../types';
import { UNAchCounterparty, UNCents, UNCounterpartyVerificationMethod, UNPaymentStatus, UNPaymentType, UNRelationshipsAccount, UNRelationshipsCounterparty, UNRelationshipsCustomer, UNRelationshipsRecurringPayment, UNRelationshipsTransaction } from './payments.types';

export type UNACHPayment = {
  type: UNPaymentType.AchPayment
  id: string
  attributes: UNAchPaymentAttributes
  relationships: {
    account: {
      data: UNRelationshipsAccount
    }
    customer?: {
      data: UNRelationshipsCustomer
    }
    customers?: {
      data: UNRelationshipsCustomer[]
    }
    transaction?: {
      data: UNRelationshipsTransaction
    }
    counterparty?: {
      data: UNRelationshipsCounterparty
    }
    recurringPayment?: {
      data: UNRelationshipsRecurringPayment
    }
    org?: {
      data: UNOrg
    }
  }
}

export type UNAchPaymentAttributes = {
  createdAt: Date
  amount: UNCents
  direction: UNDirection
  description: string
  status: UNPaymentStatus
  settlementDate?: Date
  reason?: string
  tags?: { [key: string]: string }
  addenda?: string
  counterparty: UNAchCounterparty
  expectedCompletionDate?: Date
  counterpartyVerificationMethod?: keyof typeof UNCounterpartyVerificationMethod
  sameDay?: boolean
}