<Window xmlns="https://github.com/avaloniaui"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:vm="using:ClaudeDo.Ui.ViewModels.Modals"
        xmlns:ctl="using:ClaudeDo.Ui.Views.Controls"
        xmlns:loc="using:ClaudeDo.Ui.Localization"
        x:Class="ClaudeDo.Ui.Views.Modals.WeeklyReportModalView"
        x:DataType="vm:WeeklyReportModalViewModel"
        Title="{loc:Tr modals.weeklyReport.windowTitle}"
        Width="820" Height="640"
        WindowDecorations="None"
        ExtendClientAreaToDecorationsHint="True"
        WindowStartupLocation="CenterOwner"
        Background="{DynamicResource SurfaceBrush}">
  <Window.KeyBindings>
    <KeyBinding Gesture="Escape" Command="{Binding CloseCommand}"/>
  </Window.KeyBindings>

  <ctl:ModalShell Title="{loc:Tr modals.weeklyReport.title}" CloseCommand="{Binding CloseCommand}">
    <DockPanel Margin="20,16">
      <StackPanel DockPanel.Dock="Top" Orientation="Horizontal" Spacing="8">
        <TextBlock Classes="meta" Text="{loc:Tr modals.weeklyReport.from}" VerticalAlignment="Center"/>
        <ctl:ThemedDatePicker SelectedDate="{Binding StartDate}"/>
        <TextBlock Classes="meta" Text="{loc:Tr modals.weeklyReport.to}" VerticalAlignment="Center"/>
        <ctl:ThemedDatePicker SelectedDate="{Binding EndDate}"/>
        <Button Classes="btn" Content="{loc:Tr modals.weeklyReport.generate}" Command="{Binding GenerateCommand}"
                IsVisible="{Binding EmptyStateVisible}"/>
        <Button Classes="btn" Content="{loc:Tr modals.weeklyReport.regenerate}" Command="{Binding GenerateCommand}"
                IsVisible="{Binding HasReport}"/>
      </StackPanel>

      <TextBlock DockPanel.Dock="Top" Classes="meta" Margin="0,8,0,0"
                 Text="{Binding StatusMessage}"/>

      <TextBlock DockPanel.Dock="Top" Classes="meta" Margin="0,16"
                 Text="{loc:Tr modals.weeklyReport.emptyStateHint}"
                 IsVisible="{Binding EmptyStateVisible}"/>

      <ScrollViewer IsVisible="{Binding HasReport}">
        <ctl:MarkdownView Markdown="{Binding ReportMarkdown}"/>
      </ScrollViewer>
    </DockPanel>
  </ctl:ModalShell>
</Window>
