// withHooks
// noPage

import { LibNavigation } from 'esoftplay/cache/lib/navigation/import';
import { LibPicture } from 'esoftplay/cache/lib/picture/import';
import { LibTextstyle } from 'esoftplay/cache/lib/textstyle/import';
import { MarketMerchant_detailArgs } from 'esoftplay/cache/market/merchant_detail/import';
import { MarketNotice } from 'esoftplay/cache/market/notice/import';

import React from 'react';
import { TouchableOpacity, View } from 'react-native';

export interface MarketMerchant_itemProps {
  active: string,
  address: string,
  description: string,
  id: string,
  image: string,
  location_id: string,
  location_latlong: string,
  location_name: string,
  publish: string,
  status: string,
  title: string,
  url: string,
  user_id: string,
  info?: any,
  alert?: any
}
export default function m(props: MarketMerchant_itemProps): any {

  if (props.publish != '1' || props.active != '1') {
    return null
  }

  return (
    <TouchableOpacity
      onPress={() => LibNavigation.navigate<MarketMerchant_detailArgs>('market/merchant_detail', { url: props.url })}
      style={styleId_i3rWJ} >
      <LibPicture source={{ uri: props.image }} style={styleId_1pdFyd} />
      <View style={styleId_14tcJb} >
        <LibTextstyle textStyle="body" text={props.title} />
        <LibTextstyle textStyle="footnote" text={props.location_name} style={styleId_ZcFIEN} />
        <View>
          {
            props?.info?.map((item: any, i: number) => (
              <MarketNotice key={i} mode={item.type} text={item.message} canPress={item.module != '' && item.url != ''} onPress={() => {
                if (item?.module != '') {
                  LibNavigation.navigate(item?.module, { url: item?.url })
                }
              }}
                containerStyle={{ marginHorizontal: 0 }}
              />
            ))
          }
        </View>
      </View>
    </TouchableOpacity>
  )
}
const styleId_i3rWJ: any = { paddingHorizontal: 17, paddingVertical: 10, flexDirection: "row", borderBottomWidth: 1, borderBottomColor: "#eee", alignItems: "center" }
const styleId_1pdFyd: any = { height: 30, width: 30, borderRadius: 15 }
const styleId_14tcJb: any = { marginLeft: 10, flex: 1 }
const styleId_ZcFIEN: any = { color: '#888' }