import 'package:equatable/equatable.dart'; class FinancialStatementModel extends Equatable { final String periodType; final String endDate; // Income Statement final double? totalRevenue; final double? costOfRevenue; final double? grossProfit; final double? operatingExpenses; final double? operatingIncome; final double? ebitda; final double? netIncome; final double? epsBasic; final double? epsDiluted; // Balance Sheet final double? cashAndCashEquivalents; final double? accountsReceivable; final double? inventory; final double? totalCurrentAssets; final double? totalNonCurrentAssets; final double? currentLiabilities; final double? longTermDebt; final double? totalLiabilities; final double? totalStockholdersEquity; // Cash Flow final double? operatingCashFlow; final double? investingCashFlow; final double? capitalExpenditures; final double? financingCashFlow; final double? freeCashFlow; const FinancialStatementModel({ required this.periodType, required this.endDate, this.totalRevenue, this.costOfRevenue, this.grossProfit, this.operatingExpenses, this.operatingIncome, this.ebitda, this.netIncome, this.epsBasic, this.epsDiluted, this.cashAndCashEquivalents, this.accountsReceivable, this.inventory, this.totalCurrentAssets, this.totalNonCurrentAssets, this.currentLiabilities, this.longTermDebt, this.totalLiabilities, this.totalStockholdersEquity, this.operatingCashFlow, this.investingCashFlow, this.capitalExpenditures, this.financingCashFlow, this.freeCashFlow, }); factory FinancialStatementModel.fromJson(Map json) { double? parseD(dynamic val) { if (val == null) return null; if (val is num) return val.toDouble(); return double.tryParse(val.toString()); } return FinancialStatementModel( periodType: json['periodType']?.toString() ?? '', endDate: json['endDate']?.toString() ?? '', totalRevenue: parseD(json['totalRevenue']), costOfRevenue: parseD(json['costOfRevenue']), grossProfit: parseD(json['grossProfit']), operatingExpenses: parseD(json['operatingExpenses']), operatingIncome: parseD(json['operatingIncome']), ebitda: parseD(json['ebitda']), netIncome: parseD(json['netIncome']), epsBasic: parseD(json['epsBasic']), epsDiluted: parseD(json['epsDiluted']), cashAndCashEquivalents: parseD(json['cashAndCashEquivalents']), accountsReceivable: parseD(json['accountsReceivable']), inventory: parseD(json['inventory']), totalCurrentAssets: parseD(json['totalCurrentAssets']), totalNonCurrentAssets: parseD(json['totalNonCurrentAssets']), currentLiabilities: parseD(json['currentLiabilities']), longTermDebt: parseD(json['longTermDebt']), totalLiabilities: parseD(json['totalLiabilities']), totalStockholdersEquity: parseD(json['totalStockholdersEquity']), operatingCashFlow: parseD(json['operatingCashFlow']), investingCashFlow: parseD(json['investingCashFlow']), capitalExpenditures: parseD(json['capitalExpenditures']), financingCashFlow: parseD(json['financingCashFlow']), freeCashFlow: parseD(json['freeCashFlow']), ); } Map toJson() { return { 'periodType': periodType, 'endDate': endDate, 'totalRevenue': totalRevenue, 'costOfRevenue': costOfRevenue, 'grossProfit': grossProfit, 'operatingExpenses': operatingExpenses, 'operatingIncome': operatingIncome, 'ebitda': ebitda, 'netIncome': netIncome, 'epsBasic': epsBasic, 'epsDiluted': epsDiluted, 'cashAndCashEquivalents': cashAndCashEquivalents, 'accountsReceivable': accountsReceivable, 'inventory': inventory, 'totalCurrentAssets': totalCurrentAssets, 'totalNonCurrentAssets': totalNonCurrentAssets, 'currentLiabilities': currentLiabilities, 'longTermDebt': longTermDebt, 'totalLiabilities': totalLiabilities, 'totalStockholdersEquity': totalStockholdersEquity, 'operatingCashFlow': operatingCashFlow, 'investingCashFlow': investingCashFlow, 'capitalExpenditures': capitalExpenditures, 'financingCashFlow': financingCashFlow, 'freeCashFlow': freeCashFlow, }; } @override List get props => [ periodType, endDate, totalRevenue, costOfRevenue, grossProfit, operatingExpenses, operatingIncome, ebitda, netIncome, epsBasic, epsDiluted, cashAndCashEquivalents, accountsReceivable, inventory, totalCurrentAssets, totalNonCurrentAssets, currentLiabilities, longTermDebt, totalLiabilities, totalStockholdersEquity, operatingCashFlow, investingCashFlow, capitalExpenditures, financingCashFlow, freeCashFlow, ]; }