<?php


/**
 * Class TB_Shared_Ent_TeamData_Invoice
 *
 * @property integer $id
 * @property integer $ref_premium_log_id
 * @property string $braintree_customer_id
 * @property string $braintree_subscription_id
 * @property integer $account_id
 * @property integer $team_id
 * @property string $team_name
 * @property string $package_id
 * @property string $package_name
 * @property float $package_price
 * @property float $package_tax
 * @property string $billing_id
 * @property DateTime $billing_date_dt
 * @property DateTime|null $billing_period_start_dt
 * @property DateTime|null $billing_period_end_dt
 * @property string|null $billing_company_name
 * @property string|null $billing_company_tax_id
 * @property string $billing_first_name
 * @property string $billing_last_name
 * @property string $billing_street
 * @property string $billing_zip
 * @property string $billing_city
 * @property string $billing_country
 * @property string $billing_email
 * @property DateTime $last_update_dt
 * @property DateTime $created_dt
 *
 */
class TB_Shared_Ent_TeamData_Invoice extends Francis_Db_Row
{
    /**
     * @param TB_Shared_Ent_Core_Account $account
     *
     * @return array
     */
    public static function getAllForAccount( TB_Shared_Ent_Core_Account $account )
    {
        $sql  = 'SELECT * FROM ' . self::getTable() . ' WHERE ';
        $sql .= 'account_id = :account_id';

        return self::findMany( $sql, array( ':account_id' => $account->id ) );
    }

    /**
     * Return table name
     *
     * @return null|string
     */
    public static function getTable()
    {
        return 'invoice';
    }

    /**
     * Return db handler
     *
     * @return Francis_Db_MySql|null
     */
    public static function getDbh()
    {
        return TB_Shared_Db_TeamData::get();
    }
}