<UserControl x:Class="OPSAgentDialer.View.SettingsUC"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             mc:Ignorable="d" 
             d:DesignHeight="500" d:DesignWidth="300" Background="WhiteSmoke" Height="500" Width="610">
    <Grid>
        <Grid.ColumnDefinitions>
            <ColumnDefinition/>
            <ColumnDefinition />
        </Grid.ColumnDefinitions>
        <Grid.RowDefinitions>
            <RowDefinition Height="325*"/>
            <RowDefinition Height="100*"/>
            <RowDefinition Height="100*"/>
            <RowDefinition Height="50*"/>
        </Grid.RowDefinitions>
        <GroupBox Header="Agents">
            <StackPanel>
                <Label>Please select your agents from the list below.</Label>
                <ListBox x:Name="AgentList" ItemsSource="{Binding Agents}" Margin="0,15,0,0" SelectionMode="Single" Height="220">
                    <ListBox.ItemTemplate>
                        <DataTemplate>
                            <DockPanel>
                                <CheckBox IsChecked="{Binding Operational}"/>
                                <TextBlock Text="{Binding AgentInfo.Name}"/>
                            </DockPanel>
                        </DataTemplate>
                    </ListBox.ItemTemplate>
                </ListBox>
            </StackPanel>
        </GroupBox>
        <GroupBox Grid.Column="1" Header="Retry Settings">
            <StackPanel>
                <Label Height="41">
                    <TextBlock>Please select the states where the agent dialer<LineBreak/> should retry the call.</TextBlock>
                </Label>
                <ListBox ItemsSource="{Binding RetryStates}" Height="220" SelectionMode="Single">
                    <ListBox.ItemTemplate>
                        <DataTemplate>
                            <DockPanel>
                                <CheckBox  IsChecked="{Binding Enabled}"/>
                                <TextBlock Text="{Binding ProgressState}"/>
                            </DockPanel>
                        </DataTemplate>
                    </ListBox.ItemTemplate>
                </ListBox>
            </StackPanel>
        </GroupBox>
        <GroupBox Grid.Column="0" Grid.Row="1" Header="Concurrent Calls">
            <StackPanel>
                <Label>
                    <TextBlock>Please specify the number of concurrent calls<LineBreak/> the program should make.</TextBlock>
                </Label>
                <StackPanel Orientation="Horizontal">
                    <Label>Concurrent Calls:</Label>
                    <TextBox Height="22" Width="40" TextWrapping="Wrap" Text="{Binding MaxConcurrentCalls}" Margin="10,0,0,0"/>
                </StackPanel>
            </StackPanel>
        </GroupBox>
        <GroupBox Grid.Column="1" Grid.Row="1" Header="Agent selection">
            <StackPanel>
                <Label>
                    <TextBlock>Please select the behaviour of selecting agents.</TextBlock>
                </Label>
                <RadioButton GroupName="AgentSelection" Margin="5,3,0,0" IsChecked="{Binding ChooseByOccupation}">First available</RadioButton>
                <RadioButton GroupName="AgentSelection" Margin="5,3,0,0" IsChecked="{Binding ChooseByStatistics}">Least called</RadioButton>
            </StackPanel>
        </GroupBox>
        <GroupBox Grid.Row="2" Grid.ColumnSpan="2" Header="API extension">
            <StackPanel>

                <TextBlock Margin="5,5,5,5" TextWrapping="Wrap">Extension on the Ozeki Phone System need to be configured. Sending SMS and emails, making calls will go through this extension.</TextBlock>
                <StackPanel Orientation="Horizontal">
                    <StackPanel Orientation="Horizontal">
                        <Label>Extension ID:</Label>
                        <TextBox Width="60" Height="20" Text="{Binding ApiExtensionId}"></TextBox>
                    </StackPanel>
                </StackPanel>
            </StackPanel>
        </GroupBox>
        <Button Content="Cancel" HorizontalAlignment="Left" Margin="220,10,0,0" Grid.Row="3" VerticalAlignment="Top" Width="75" Grid.Column="1" Command="{Binding Cancel}" Height="22"/>
        <Button Content="OK" HorizontalAlignment="Left" Margin="128,10,0,0" Grid.Row="3" VerticalAlignment="Top" Width="75" RenderTransformOrigin="4.16,0.045" Grid.Column="1"  Command="{Binding Ok}" Height="22"/>
    </Grid>
</UserControl>
