import React from "react";
import {
  View,
  Text,
  TextInput,
  StyleSheet,
  Platform,
} from "react-native";
import { useI18n } from "@/hooks/use-i18n";
import { useThemeContext } from "@/hooks/use-theme-context";

interface BasicInfoInputProps {
  fishingGroundCodes: string;
  onChange: (value: string) => void;
  disabled?: boolean;
}

export default function BasicInfoInput({
  fishingGroundCodes,
  onChange,
  disabled = false,
}: BasicInfoInputProps) {
  const { t } = useI18n();
  const { colors } = useThemeContext();

  const themedStyles = {
    label: { color: colors.text },
    subLabel: { color: colors.textSecondary },
    input: {
      backgroundColor: disabled ? colors.backgroundSecondary : colors.card,
      borderColor: colors.border,
      color: colors.text,
    },
  };

  return (
    <View style={styles.container}>
      <Text style={[styles.label, themedStyles.label]}>
        {t("diary.fishingGroundCodes")}
      </Text>
      <Text style={[styles.subLabel, themedStyles.subLabel]}>
        {t("diary.fishingGroundCodesHint")}
      </Text>
      <TextInput
        style={[styles.input, themedStyles.input]}
        value={fishingGroundCodes}
        onChangeText={onChange}
        placeholder={t("diary.fishingGroundCodesPlaceholder")}
        placeholderTextColor={colors.textSecondary}
        keyboardType="numeric"
        editable={!disabled}
      />
    </View>
  );
}

const styles = StyleSheet.create({
  container: {
    marginBottom: 20,
  },
  label: {
    fontSize: 16,
    fontWeight: "600",
    marginBottom: 12,
    fontFamily: Platform.select({
      ios: "System",
      android: "Roboto",
      default: "System",
    }),
  },
  subLabel: {
    fontSize: 14,
    marginBottom: 8,
    fontFamily: Platform.select({
      ios: "System",
      android: "Roboto",
      default: "System",
    }),
  },
  input: {
    borderWidth: 1,
    borderRadius: 8,
    paddingHorizontal: 16,
    paddingVertical: 12,
    fontSize: 16,
    fontFamily: Platform.select({
      ios: "System",
      android: "Roboto",
      default: "System",
    }),
  },
});
