"""
Forms for signals app.
"""
from django import forms
from .models import Coin, TradingSignal


class CoinForm(forms.ModelForm):
    """
    Form for creating/editing coins.
    """
    class Meta:
        model = Coin
        fields = ('name', 'symbol', 'current_price', 'image', 'description', 'is_active', 'is_featured')
        widgets = {
            'name': forms.TextInput(attrs={'class': 'form-control'}),
            'symbol': forms.TextInput(attrs={'class': 'form-control'}),
            'current_price': forms.NumberInput(attrs={'class': 'form-control', 'step': '0.00000001'}),
            'image': forms.FileInput(attrs={'class': 'form-control'}),
            'description': forms.Textarea(attrs={'class': 'form-control', 'rows': 3}),
            'is_active': forms.CheckboxInput(attrs={'class': 'form-check-input'}),
            'is_featured': forms.CheckboxInput(attrs={'class': 'form-check-input'}),
        }


class TradingSignalForm(forms.ModelForm):
    """
    Form for creating/editing trading signals.
    """
    class Meta:
        model = TradingSignal
        fields = ('coin', 'signal_type', 'entry_price', 'target_price', 'stop_loss', 'description', 'notes')
        widgets = {
            'coin': forms.Select(attrs={'class': 'form-select'}),
            'signal_type': forms.Select(attrs={'class': 'form-select'}),
            'entry_price': forms.NumberInput(attrs={'class': 'form-control', 'step': '0.00000001'}),
            'target_price': forms.NumberInput(attrs={'class': 'form-control', 'step': '0.00000001'}),
            'stop_loss': forms.NumberInput(attrs={'class': 'form-control', 'step': '0.00000001'}),
            'description': forms.Textarea(attrs={'class': 'form-control', 'rows': 3}),
            'notes': forms.Textarea(attrs={'class': 'form-control', 'rows': 2}),
        }
