// withHooks
import esp from 'esoftplay/esp';

import { LibKeyboard_avoid } from 'esoftplay/cache/lib/keyboard_avoid/import';
import { LibNavigation } from 'esoftplay/cache/lib/navigation/import';
import { LibStyle } from 'esoftplay/cache/lib/style/import';
import { LibToastProperty } from 'esoftplay/cache/lib/toast/import';
import { MarketAds_homeProperty } from 'esoftplay/cache/market/ads_home/import';
import { MarketButton } from 'esoftplay/cache/market/button/import';
import { MarketHeader } from 'esoftplay/cache/market/header/import';
import { MarketInput_underline } from 'esoftplay/cache/market/input_underline/import';
import { MarketStyle } from 'esoftplay/cache/market/style/import';
import { UseForm } from 'esoftplay/cache/use/form/import';

import React, { useEffect } from 'react';
import { ScrollView, Text, View } from 'react-native';


export interface MarketAds_product_groupArgs {

}
export interface MarketAds_product_groupProps {

}

export interface MarketAds_product_form {
  id: string,
  products: any[],
  cat_ids: any[]
  keywords: any[],
  title: string,
  description: string,
  price_view: string,
  price_view_each: string,
  price: string,
  periode: any,
  price_limit: string,
  price_daily: string,
}

export default function m(props: MarketAds_product_groupProps): any {
  const advertConfig = MarketAds_homeProperty.state().get()
  const [form, setForm, reForm, delForm] = UseForm<MarketAds_product_form>('market/ads_register')

  useEffect(() => { setForm('price')(advertConfig?.ads_product?.price_suggest) }, [])

  return (
    <View style={styleId_qpkod}>
      <MarketHeader title={esp.lang("market/ads_product_group", "header_title")} onlyBack />
      <ScrollView>
        <LibKeyboard_avoid>

          <View style={styleId_dt7dA}>
            <Text allowFontScaling={false} style={styleId_g3yJj} >{esp.lang("market/ads_product_group", "ad_group")}</Text>
            <Text allowFontScaling={false} style={styleId_1SdHAp} >{esp.lang("market/ads_product_group", "ads_group_info")}</Text>
          </View>

          <MarketInput_underline
            onChangeText={setForm('title')}
            placeholder={esp.lang("market/ads_product_group", "ads_group_placeholder")}
            additionalText={esp.lang("market/ads_product_group", "ads_group_additional")}
          />
        </LibKeyboard_avoid>
      </ScrollView>
      <MarketButton onPress={() => {
        if (form?.title) {
          LibNavigation.navigate('market/ads_product_list')
        } else {
          LibToastProperty.show(esp.lang("market/ads_product_group", "empty_group_name"))
        }
      }} text={esp.lang("market/ads_product_group", "btn_ad_group")} buttonStyle={styleId_dt7dA} colorBackground={form?.title ? MarketStyle.colorPrimaryMarket : LibStyle.colorLightGrey} />
    </View>
  )
}
const styleId_qpkod: any = { flex: 1, backgroundColor: '#fff' }
const styleId_dt7dA: any = { margin: 15 }
const styleId_g3yJj: any = { fontSize: 14, fontWeight: "bold", fontStyle: "normal", letterSpacing: 0 }
const styleId_1SdHAp: any = { marginTop: 5, fontSize: 12, fontWeight: "normal", fontStyle: "normal", letterSpacing: 0, color: "#707070" }