group InvoiceItemSqlDao: EntitySqlDao;

tableName() ::= "invoice_items"

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 <allTableFields()>
  FROM <tableName()>
  WHERE invoice_id = :invoiceId
  <AND_CHECK_TENANT()>
  ;
>>

getInvoiceItemsBySubscription() ::= <<
  SELECT <allTableFields()>
  FROM <tableName()>
  WHERE subscription_id = :subscriptionId
  <AND_CHECK_TENANT()>
  ;
>>
