import { View } from '@tarojs/components';
import Message, { MessageType } from '../../../../components/Message/Message';
import { FeedbackItem } from '@/api/feedback';

const FeedbackItem = ({
  msgData,
  userData,
}: {
  msgData: FeedbackItem;
  userData: {
    customerHead: null | string;
    customerSex: string;
  };
}) => {
  return (
    <View className='FeedbackItem'>
      {msgData && (
        <Message
          type={MessageType.user}
          content={msgData.content}
          time={msgData.createDate}
          userData={userData}
        />
      )}
      {msgData &&
        msgData.replayList.map(replay => (
          <Message
            key={replay.feedbackId}
            type={MessageType.replay}
            content={replay.replayContent}
            time={replay.replayAt}
            userData={userData}
          />
        ))}
    </View>
  );
};

export default FeedbackItem;
