#import '../fragments/evo_regions_fields.graphql'
#import '../fragments/evo_addproduct_types_fields.graphql'

query GetMainOptions(
  $statecode: Int
  $currentDate: DateTime
  $dealer_account_type: [Int!]
  $dealer_legal_form: Int
  $product_relation: [Int!]
  $registration_product_type: Int
  $nsib_product_type: Int
  $tracker_product_type: Int
  $telematic_product_type: Int
  $fuelcard_product_type: Int
  $techcard_product_type: Int
  $leasing_without_kasko_product_type: Int
) {
  selectSupplierCurrency: transactioncurrencies(statecode: $statecode) {
    transactioncurrencyid
    isocurrencycode
  }
  selectClientRisk: evo_client_risks(statecode: $statecode) {
    evo_name
    evo_client_riskid
    evo_id
  }
  selectClientType: evo_client_types(statecode: $statecode) {
    evo_name
    evo_client_typeid
  }
  selectDealer: accounts(
    evo_account_type: $dealer_account_type
    statecode: $statecode
    evo_legal_form: $dealer_legal_form
  ) {
    name
    accountid
    evo_return_leasing_dealer
  }
  selectGPSBrand: evo_gps_brands(statecode: $statecode) {
    evo_name
    evo_gps_brandid
  }
  selectRegionRegistration: evo_regions(statecode: $statecode) {
    ...evo_region_fields
  }
  selectLegalClientRegion: evo_regions(statecode: $statecode) {
    ...evo_region_fields
  }
  selectBrand: evo_brands(statecode: $statecode) {
    evo_id
    evo_name
    evo_brandid
    evo_brand_owner
    evo_importer_reward_perc
    evo_importer_reward_rub
    evo_vehicle_type
  }
  selectProduct: evo_baseproducts(
    statecode: $statecode
    evo_relation: $product_relation
    evo_datefrom_param: { lte: $currentDate }
    evo_dateto_param: { gte: $currentDate }
  ) {
    evo_name
    evo_baseproductid
    evo_id
    evo_leasingobject_types {
      evo_name
      evo_leasingobject_typeid
      evo_id
    }
    evo_brands {
      evo_name
      evo_brandid
    }
    systemusers {
      systemuserid
    }
    evo_sale_without_nds
    evo_cut_proportion_bonus_director
    evo_cut_irr_with_bonus
    evo_calculation_method
    evo_baseproducts {
      evo_id
      evo_name
      evo_baseproductid
    }
  }
  selectRegistration: evo_addproduct_types(
    statecode: $statecode
    evo_product_type: $registration_product_type
    evo_datefrom_param: { lte: $currentDate }
    evo_dateto_param: { gte: $currentDate }
  ) {
    ...evo_addproduct_types_fields
    evo_towtruck
    evo_pts_type
    evo_description
    evo_gibdd_region
    evo_whom_register
    evo_leasingobject_types {
      evo_leasingobject_typeid
    }
  }
  selectInsNSIB: evo_addproduct_types(
    statecode: $statecode
    evo_product_type: $nsib_product_type
    evo_datefrom_param: { lte: $currentDate }
    evo_dateto_param: { gte: $currentDate }
  ) {
    ...evo_addproduct_types_fields
  }
  selectTracker: evo_addproduct_types(
    statecode: $statecode
    evo_product_type: $tracker_product_type
    evo_datefrom_param: { lte: $currentDate }
    evo_dateto_param: { gte: $currentDate }
  ) {
    ...evo_addproduct_types_fields
    evo_visible_calc
    evo_planpayments {
      evo_name
      evo_cost_equipment_withoutnds
      evo_cost_price_telematics_withoutnds
      evo_cost_telematics_withoutnds
    }
  }
  selectTelematic: evo_addproduct_types(
    statecode: $statecode
    evo_product_type: $telematic_product_type
    evo_datefrom_param: { lte: $currentDate }
    evo_dateto_param: { gte: $currentDate }
  ) {
    ...evo_addproduct_types_fields
    evo_visible_calc
    evo_planpayments {
      evo_name
      evo_cost_equipment_withoutnds
      evo_cost_price_telematics_withoutnds
      evo_cost_telematics_withoutnds
    }
  }
  selectTechnicalCard: evo_addproduct_types(
    statecode: $statecode
    evo_product_type: $techcard_product_type
    evo_datefrom_param: { lte: $currentDate }
    evo_dateto_param: { gte: $currentDate }
  ) {
    ...evo_addproduct_types_fields
    evo_helpcard_type
    evo_leasingobject_types {
      evo_leasingobject_typeid
    }
  }
  selectTarif: evo_tarifs(
    statecode: $statecode
    evo_datefrom_param: { lte: $currentDate }
    evo_dateto_param: { gte: $currentDate }
  ) {
    evo_name
    evo_tarifid
    evo_baseproductid
    evo_irr
    evo_max_irr
    evo_min_profit
    evo_min_irr
    evo_irr_plan
    evo_ins_type
    evo_min_period
    evo_max_period
    evo_client_risks {
      evo_name
      evo_client_riskid
    }
    evo_client_types {
      evo_name
      evo_client_typeid
    }
    evo_leasingobject_types {
      evo_name
      evo_id
      evo_leasingobject_typeid
    }
    evo_delivery_time
    evo_graphtype_exception
    evo_seasons_type_exception
    evo_min_decreasing_perc
    evo_min_first_payment
    evo_max_first_payment
    evo_min_last_payment
    evo_max_last_payment
    evo_margin_min
    evo_cut_irr_with_bonus_coefficient
    evo_used
  }
  selectRate: evo_rates(
    statecode: $statecode
    evo_datefrom_param: { lte: $currentDate }
    evo_dateto_param: { gte: $currentDate }
  ) {
    createdon
    evo_id
    evo_rateid
    evo_name
    evo_base_rate
    evo_coeff_12_23
    evo_coeff_24_35
    evo_coeff_36_47
    evo_coeff_7_11
    evo_coeff_48_60
    evo_tarifs {
      evo_tarifid
      evo_name
    }
    evo_credit_period
  }
  selectLeaseObjectType: evo_leasingobject_types(statecode: $statecode) {
    evo_name
    evo_id
    evo_leasingobject_typeid
    evo_depreciation_rate1
    evo_depreciation_rate2
    evo_expluatation_period1
    evo_expluatation_period2
    evo_type_code
    evo_category
    evo_category_tr
    evo_vehicle_type_tax
    evo_vehicle_type
  }
  selectObjectRegionRegistration: evo_regions(statecode: $statecode) {
    ...evo_region_fields
    accounts {
      accountid
    }
  }
  selectSubsidy: evo_subsidies(
    statecode: $statecode
    evo_datefrom_param: { lte: $currentDate }
    evo_dateto_param: { gte: $currentDate }
  ) {
    evo_name
    evo_subsidyid
    evo_percent_subsidy
    evo_subsidy_summ
    evo_max_subsidy_summ
    evo_get_subsidy_payment
    evo_brands {
      evo_brandid
    }
    evo_models {
      evo_modelid
    }
    evo_leasingobject_types {
      evo_leasingobject_typeid
    }
    accounts {
      accountid
    }
    evo_subsidy_type
  }
  selectFuelCard: evo_addproduct_types(
    statecode: $statecode
    evo_product_type: $fuelcard_product_type
    evo_datefrom_param: { lte: $currentDate }
    evo_dateto_param: { gte: $currentDate }
  ) {
    ...evo_addproduct_types_fields
    evo_helpcard_type
    evo_leasingobject_types {
      evo_leasingobject_typeid
    }
  }
  selectImportProgram: evo_subsidies(
    statecode: $statecode
    evo_datefrom_param: { lte: $currentDate }
    evo_dateto_param: { gte: $currentDate }
  ) {
    evo_name
    evo_subsidyid
    evo_percent_subsidy
    evo_subsidy_summ
    evo_max_subsidy_summ
    evo_get_subsidy_payment
    evo_brands {
      evo_brandid
    }
    evo_models {
      evo_modelid
    }
    evo_leasingobject_types {
      evo_leasingobject_typeid
    }
    accounts {
      accountid
    }
    evo_subsidy_type
  }
  selectLeasingWithoutKasko: evo_addproduct_types(
    statecode: $statecode
    evo_product_type: $leasing_without_kasko_product_type
    evo_datefrom_param: { lte: $currentDate }
    evo_dateto_param: { gte: $currentDate }
  ) {
    ...evo_addproduct_types_fields
    evo_leasingobject_types {
      evo_leasingobject_typeid
    }
    evo_visible_calc
    evo_min_price
    evo_max_price
    evo_loss_kv
    evo_min_first_payment_perc
    evo_max_first_payment_perc
    evo_models {
      evo_modelid
    }
    evo_evokasko_calc_type
  }
}
