# coding: utf-8
class PitBase:
    pass


class BalanceSheet(PitBase):
    deferred_expense = "deferred_expense"
    dividend_payable = "dividend_payable"
    short_term_debt = "short_term_debt"
    financial_liabilities = "financial_liabilities"
    equity_parent_company = "equity_parent_company"
    tax_payable = "tax_payable"
    payroll_payable = "payroll_payable"
    intangible_assets = "intangible_assets"
    deferred_revenue = "deferred_revenue"
    total_assets = "total_assets"
    depreciation_reserve = "depreciation_reserve"
    accts_payable = "accts_payable"
    deferred_income_tax_liabilities = "deferred_income_tax_liabilities"
    other_fees_payable = "other_fees_payable"
    financial_asset_hold_to_maturity = "financial_asset_hold_to_maturity"
    construction_in_progress = "construction_in_progress"
    goodwill = "goodwill"
    other_payable = "other_payable"
    long_term_receivables = "long_term_receivables"
    accrued_expense = "accrued_expense"
    capital_reserve = "capital_reserve"
    accumulated_depreciation = "accumulated_depreciation"
    surplus_reserve = "surplus_reserve"
    real_estate_investment = "real_estate_investment"
    engineer_material = "engineer_material"
    minority_interest = "minority_interest"
    provision = "provision"
    oil_and_gas_assets = "oil_and_gas_assets"
    long_term_liabilities_due_one_year = "long_term_liabilities_due_one_year"
    bond_payable = "bond_payable"
    net_fixed_assets = "net_fixed_assets"
    cash_equivalent = "cash_equivalent"
    financial_asset_available_for_sale = "financial_asset_available_for_sale"
    estimated_liabilities = "estimated_liabilities"
    bad_debt_reserve = "bad_debt_reserve"
    other_non_current_liabilities = "other_non_current_liabilities"
    non_current_liability_due_one_year = "non_current_liability_due_one_year"
    non_current_assets = "non_current_assets"
    long_term_deferred_expenses = "long_term_deferred_expenses"
    net_long_term_equity_investment = "net_long_term_equity_investment"
    bill_receivable = "bill_receivable"
    non_current_asset_due_one_year = "non_current_asset_due_one_year"
    total_equity_and_liabilities = "total_equity_and_liabilities"
    long_term_equity_investment = "long_term_equity_investment"
    total_liabilities = "total_liabilities"
    prepaid_tax = "prepaid_tax"
    grants_received = "grants_received"
    paid_in_capital = "paid_in_capital"
    housing_revolving_funds = "housing_revolving_funds"
    notes_payable = "notes_payable"
    long_term_payable = "long_term_payable"
    other_non_current_assets = "other_non_current_assets"
    interest_receivable = "interest_receivable"
    impairment_intangible_assets = "impairment_intangible_assets"
    advance_from_customers = "advance_from_customers"
    deferred_income_tax_assets = "deferred_income_tax_assets"
    other_current_assets = "other_current_assets"
    fixed_asset_to_be_disposed = "fixed_asset_to_be_disposed"
    financial_asset_held_for_trading = "financial_asset_held_for_trading"
    short_term_loans = "short_term_loans"
    inventory = "inventory"
    deferred_income = "deferred_income"
    interest_payable = "interest_payable"
    non_current_liabilities = "non_current_liabilities"
    dividend_receivable = "dividend_receivable"
    other_current_liabilities = "other_current_liabilities"
    current_assets = "current_assets"
    long_term_loans = "long_term_loans"
    capitalized_biological_assets = "capitalized_biological_assets"
    current_liabilities = "current_liabilities"
    contract_work = "contract_work"
    total_equity = "total_equity"
    prepayment = "prepayment"
    net_accts_receivable = "net_accts_receivable"
    undistributed_profit = "undistributed_profit"
    equity_preferred_stock = "equity_preferred_stock"
    other_accts_receivable = "other_accts_receivable"
    other_equity_investment = "other_equity_investment"
    other_illiquidy_financial_assets = "other_illiquidy_financial_assets"
    other_payable_interest_dividend = "other_payable_interest_dividend"


class CashFlowsStatement(PitBase):
    exchange_rate_change_effect = "exchange_rate_change_effect"
    cash_paid_for_other_financing_activities = "cash_paid_for_other_financing_activities"
    cash_received_from_investors = "cash_received_from_investors"
    cash_from_operating_activities = "cash_from_operating_activities"
    cash_paid_to_financing_activities = "cash_paid_to_financing_activities"
    fcff = "fcff"
    cash_paid_for_employee = "cash_paid_for_employee"
    cash_paid_for_goods_and_services = "cash_paid_for_goods_and_services"
    cash_from_other_operating_activities = "cash_from_other_operating_activities"
    cash_received_from_disposal_of_asset = "cash_received_from_disposal_of_asset"
    cash_received_from_sales_of_goods = "cash_received_from_sales_of_goods"
    deferred_expense_amortization = "deferred_expense_amortization"
    cash_paid_for_other_investment_activities = "cash_paid_for_other_investment_activities"
    fcfe = "fcfe"
    cash_flow_from_financing_activities = "cash_flow_from_financing_activities"
    cash_received_from_other_financing_activities = "cash_received_from_other_financing_activities"
    cash_paid_for_dividend_and_interest = "cash_paid_for_dividend_and_interest"
    cash_paid_for_debt = "cash_paid_for_debt"
    fixed_asset_depreciation = "fixed_asset_depreciation"
    cash_paid_for_investment_activities = "cash_paid_for_investment_activities"
    cash_paid_for_asset = "cash_paid_for_asset"
    cash_received_from_financing_activities = "cash_received_from_financing_activities"
    cash_flow_from_investing_activities = "cash_flow_from_investing_activities"
    cash_received_from_investment_activities = "cash_received_from_investment_activities"
    net_inc_cash_and_equivalents = "net_inc_cash_and_equivalents"
    intangible_asset_amortization = "intangible_asset_amortization"
    depreciation_and_amortization = "depreciation_and_amortization"
    cash_paid_for_other_operation_activities = "cash_paid_for_other_operation_activities"
    cash_received_from_financial_institution_borrows = "cash_received_from_financial_institution_borrows"
    cash_received_from_other_investment_activities = "cash_received_from_other_investment_activities"
    cash_paid_to_acquire_investment = "cash_paid_to_acquire_investment"
    cash_flow_from_operating_activities = "cash_flow_from_operating_activities"
    cash_equivalent_increase = "cash_equivalent_increase"
    cash_paid_for_operation_activities = "cash_paid_for_operation_activities"
    cash_paid_for_taxes = "cash_paid_for_taxes"
    refunds_of_taxes = "refunds_of_taxes"
    assets_depreciation_reserves = "assets_depreciation_reserves"
    net_cash_deal_from_sub = "net_cash_deal_from_sub"
    net_cash_payment_from_sub = "net_cash_payment_from_sub"


class IncomeStatement(PitBase):
    total_income_minority = "total_income_minority"
    ga_expense = "ga_expense"
    invest_income_associates = "invest_income_associates"
    profit_from_operation = "profit_from_operation"
    r_n_d = "r_n_d"
    total_income = "total_income"
    other_operating_revenue = "other_operating_revenue"
    total_income_parent_company = "total_income_parent_company"
    other_operating_cost = "other_operating_cost"
    revenue = "revenue"
    net_profit_parent_company = "net_profit_parent_company"
    non_operating_revenue = "non_operating_revenue"
    selling_expense = "selling_expense"
    ebitda = "ebitda"
    minority_profit = "minority_profit"
    disposal_loss_on_asset = "disposal_loss_on_asset"
    non_recurring_pnl = "non_recurring_pnl"
    exchange_gains_or_losses = "exchange_gains_or_losses"
    financing_expense = "financing_expense"
    interest_expense = "interest_expense"
    operating_revenue = "operating_revenue"
    net_profit = "net_profit"
    total_expense = "total_expense"
    fair_value_change_income = "fair_value_change_income"
    other_income = "other_income"
    asset_impairment = "asset_impairment"
    non_operating_expense = "non_operating_expense"
    net_profit_deduct_non_recurring_pnl = "net_profit_deduct_non_recurring_pnl"
    profit_before_tax = "profit_before_tax"
    sales_tax = "sales_tax"
    basic_earnings_per_share = "basic_earnings_per_share"
    ebit = "ebit"
    investment_income = "investment_income"
    income_tax = "income_tax"
    gross_profit = "gross_profit"
    cost_of_goods_sold = "cost_of_goods_sold"
    interest_income = "interest_income"
    unrealised_investment_loss = "unrealised_investment_loss"
    fully_diluted_earnings_per_share = "fully_diluted_earnings_per_share"
    operating_expense = "operating_expense"
    o_n_a_expense = "o_n_a_expense"
    gredit_asset_impairment = "gredit_asset_impairment"
    disposal_income_on_asset = "disposal_income_on_asset"
    financing_interest_income = "financing_interest_income"
    financing_interest_expense = "financing_interest_expense"


class TTM(PitBase):
    operating_expenseTTM = "operating_expenseTTM"
    operating_costTTM = "operating_costTTM"
    net_invest_cashflowTTM = "net_invest_cashflowTTM"
    sale_service_render_cashTTM = "sale_service_render_cashTTM"
    ebitTTM = "ebitTTM"
    operating_revenueTTM = "operating_revenueTTM"
    operating_profitTTM = "operating_profitTTM"
    ni_from_operatingTTM = "ni_from_operatingTTM"
    net_cashflowTTM = "net_cashflowTTM"
    net_finance_cashflowTTM = "net_finance_cashflowTTM"
    net_operate_cashflowTTM = "net_operate_cashflowTTM"
    operating_payoutTTM = "operating_payoutTTM"
    asset_impairment_lossTTM = "asset_impairment_lossTTM"
    non_operating_net_incomeTTM = "non_operating_net_incomeTTM"
    administration_expenseTTM = "administration_expenseTTM"
    gross_profitTTM = "gross_profitTTM"
    total_operating_costTTM = "total_operating_costTTM"
    financial_expenseTTM = "financial_expenseTTM"
    ni_from_value_changeTTM = "ni_from_value_changeTTM"
    np_parent_company_ownersTTM = "np_parent_company_ownersTTM"
    net_profitTTM = "net_profitTTM"
    total_profitTTM = "total_profitTTM"
    total_operating_revenueTTM = "total_operating_revenueTTM"


class MainData(PitBase):
    adjusted_net_profit = "adjusted_net_profit"


class RndExpenditureSheet(PitBase):
    expensed_rnd = "expensed_rnd"
    capitalized_rnd = "capitalized_rnd"
    total_rnd = "total_rnd"
    rnd_to_revenue = "rnd_to_revenue"
    capitalized_rnd_ratio = "capitalized_rnd_ratio"
    rnd_employees = "rnd_employees"
    rnd_employees_ratio = "rnd_employees_ratio"


PIT_TABLES = ('BalanceSheet', 'CashFlowsStatement', 'IncomeStatement', 'TTM', 'MainData')
PIT_FIELDS = (
    {v for k, v in BalanceSheet.__dict__.items() if not k.startswith('_')},
    {v for k, v in CashFlowsStatement.__dict__.items() if not k.startswith('_')},
    {v for k, v in IncomeStatement.__dict__.items() if not k.startswith('_')},
    {v for k, v in TTM.__dict__.items() if not k.startswith('_')},
    {v for k, v in MainData.__dict__.items() if not k.startswith('_')},
    {v for k, v in RndExpenditureSheet.__dict__.items() if not k.startswith('_')},
)
PIT_BASIC_FIELDS = ("order_book_id", "end_date", "if_adjusted", "info_date", "accounting_standards",
                    "info_type", "if_complete", "enterprise_type")
PIT_BASIC_FIELDS_SET = set(PIT_BASIC_FIELDS)
