import React, {ChangeEvent} from 'react';
import {Trash2} from 'lucide-react';
import InputField from '@/components/form/InputField';
import TextAreaInput from '@/components/form/TextAreaInput';
import {useTranslations} from '@/lib/i18n';

interface ActDescriptionProps {
    actId: number;
    summary: string;
    onUpdateSummary: (actId: number, summary: string) => void;
}

export default function ActDescription({actId, summary, onUpdateSummary}: ActDescriptionProps) {
    const t = useTranslations('actComponent');
    
    function getActSummaryTitle(actId: number): string {
        switch (actId) {
            case 1:
                return t('act1Summary');
            case 4:
                return t('act4Summary');
            case 5:
                return t('act5Summary');
            default:
                return t('actSummary');
        }
    }
    
    function getActSummaryPlaceholder(actId: number): string {
        switch (actId) {
            case 1:
                return t('act1SummaryPlaceholder');
            case 4:
                return t('act4SummaryPlaceholder');
            case 5:
                return t('act5SummaryPlaceholder');
            default:
                return t('actSummaryPlaceholder');
        }
    }
    
    return (
        <div className="mb-4">
            <InputField
                fieldName={getActSummaryTitle(actId)}
                input={
                    <TextAreaInput
                        value={summary || ''}
                        setValue={(e: ChangeEvent<HTMLTextAreaElement>) =>
                            onUpdateSummary(actId, e.target.value)
                        }
                        placeholder={getActSummaryPlaceholder(actId)}
                    />
                }
                actionIcon={Trash2}
                actionLabel={t('delete')}
            />
        </div>
    );
}
