// withHooks
// noPage

import { LibCarrousel } from 'esoftplay/cache/lib/carrousel/import';
import { LibNavigation } from 'esoftplay/cache/lib/navigation/import';
import { LibStyle } from 'esoftplay/cache/lib/style/import';
import { MarketNotice } from 'esoftplay/cache/market/notice/import';

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


export interface MarketNotice_sliderArgs {

}
export interface MarketNotice_sliderProps {
  data: any[],
}
export default function m(props: MarketNotice_sliderProps): any {

  if (props?.data?.length == 1) {
    return (
      <>
        {
          props?.data?.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 })
                }
              }} />
          ))
        }
      </>
    )
  }

  return (
    <View style={{ marginHorizontal: 17 }}>
      <LibCarrousel
        style={{ height: 60, width: LibStyle.width - 34, alignItem: 'center', borderRadius: 6 }}
        bulletsContainerStyle={{ bottom: -5 }}
        bulletStyle={{ width: 7, height: 7, borderRadius: 3.5, backgroundColor: '#B6BFC4', borderWidth: 0, margin: 2 }}
        chosenBulletStyle={{ width: 7, height: 7, borderRadius: 3.5, backgroundColor: 'white', borderWidth: 0, margin: 2 }}
        autoplay={false}
        swipe
        bullets>
        {
          props?.data?.map((item: any, i: number) => {
            return (
              <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={{ width: LibStyle.width - 34, height: 60, marginHorizontal: 0, marginVertical: 0, borderRadius: 6, paddingHorizontal: 10, paddingVertical: 8, alignItems: 'flex-start', flexDirection: 'row' }}
                textStyle={{ marginTop: 2, lineHeight: 16 }}
              />
            )
          }
          )
        }
      </LibCarrousel>
    </View>
  )
}