group InvoiceItemSqlDao: EntitySqlDao;

tableFields(prefix) ::= <<
  <prefix>type
, <prefix>invoice_id
, <prefix>account_id
, <prefix>bundle_id
, <prefix>subscription_id
, <prefix>plan_name
, <prefix>phase_name
, <prefix>start_date
, <prefix>end_date
, <prefix>amount
, <prefix>rate
, <prefix>currency
, <prefix>linked_item_id
, <prefix>created_by
, <prefix>created_date
>>

tableValues() ::= <<
  :type
, :invoiceId
, :accountId
, :bundleId
, :subscriptionId
, :planName
, :phaseName
, :startDate
, :endDate
, :amount
, :rate
, :currency
, :linkedItemId
, :createdBy
, :createdDate
>>


getInvoiceItemsByInvoice() ::= <<
  SELECT <fields()>
  FROM invoice_items
  WHERE invoice_id = :invoiceId
  <AND_CHECK_TENANT()>
  ;
>>

getInvoiceItemsByAccount() ::= <<
  SELECT <fields()>
  FROM invoice_items
  WHERE account_id = :accountId
  <AND_CHECK_TENANT()>
  ;
>>

getInvoiceItemsBySubscription() ::= <<
  SELECT <fields()>
  FROM invoice_items
  WHERE subscription_id = :subscriptionId
  <AND_CHECK_TENANT()>
  ;
>>
