import React from "react";
import InputWithDropDown from "../../../../../ui/inputs/InputWithDropDown";

interface WorkerActionProps {
    loadCapacity: {
        value: string;
        min: number;
        max: number;
        step: number;
        defaultValue: string;
        disabled?: boolean;
        onChange: (value: string) => void;
    };
    loadCount?: {
        value: number;
        min: number;
        max: number;
        step: number;
        defaultValue: string,
        disabled: false,
        onChange: (value: number) => void;
    };
    clearPoints: () => void;
}

const WorkerAction: React.FC<WorkerActionProps> = ({
    loadCapacity,
    loadCount,
    clearPoints,
}) => {
    return (
        <div className="worker-action-container">
            {/* Load Capacity Input */}
            <InputWithDropDown
                label="Load Capacity"
                value={loadCapacity.value}
                min={loadCapacity.min}
                max={loadCapacity.max}
                disabled={loadCapacity.disabled}
                defaultValue={loadCapacity.defaultValue}
                step={loadCapacity.step}
                activeOption="unit"
                onClick={() => { }}
                onChange={loadCapacity.onChange}
            />

            {/* Load Count Input */}
            {loadCount && (
                <InputWithDropDown
                    label="Load Count"
                    value={loadCount.value.toString()}
                    min={loadCount.min}
                    max={loadCount.max}
                    disabled={loadCount.disabled}
                    defaultValue={loadCount.defaultValue}
                    step={loadCount.step}
                    activeOption="unit"
                    onClick={() => { }}
                    onChange={(value) => loadCount.onChange(parseInt(value))}
                />
            )}

            {/* Clear Points Button */}
            <div className="selected-actions-list">
                <div className="value-field-container">
                    <div className="label">Reset Points</div>
                    <button
                        id="reset-button"
                        type="button"
                        className="regularDropdown-container"
                        onClick={clearPoints}
                    >
                        Clear
                    </button>
                </div>
            </div>
        </div>
    );
};

export default WorkerAction;