@using AIStudio.Settings.DataModel

<MudDialog>
    <DialogContent>
        <TextInfoLine Icon="@Icons.Material.Filled.Tag" Label="Data source name" Value="@this.DataSource.Name" ClipboardTooltipSubject="the data source name"/>
        
        <TextInfoLine Icon="@Icons.Material.Filled.FolderOpen" Label="Path" Value="@this.DataSource.Path" ClipboardTooltipSubject="this path"/>
        @if (!this.IsDirectoryAvailable)
        {
            <MudJustifiedText Typo="Typo.body1" Color="Color.Error" Class="mb-3">
                The directory chosen for the data source does not exist anymore. Please edit the data source and correct the path.
            </MudJustifiedText>
        }
        else
        {
            <MudJustifiedText Typo="Typo.body1" Color="Color.Tertiary" Class="mb-3">
                The directory chosen for the data source exists.
            </MudJustifiedText>
        }

        <TextInfoLine Icon="@Icons.Material.Filled.Layers" Label="Embedding name" Value="@this.embeddingProvider.Name" ClipboardTooltipSubject="the embedding name"/>
        @if (this.IsCloudEmbedding)
        {
            <MudJustifiedText Typo="Typo.body1" Color="Color.Error" Class="mb-3">
                The embedding runs in the cloud. All your data from the folder '@this.DataSource.Path' and all its subdirectories
                will be sent to the cloud.
            </MudJustifiedText>
        }
        else
        {
            <MudJustifiedText Typo="Typo.body1" Color="Color.Tertiary" Class="mb-3">
                The embedding runs locally or in your organization. Your data is not sent to the cloud.
            </MudJustifiedText>
        }

        <TextInfoLines Label="Your security policy" MaxLines="3" Value="@this.DataSource.SecurityPolicy.ToInfoText()" Color="@this.DataSource.SecurityPolicy.GetColor()" ClipboardTooltipSubject="your security policy"/>

        <TextInfoLine Icon="@Icons.Material.Filled.SquareFoot" Label="Number of files" Value="@this.NumberFilesInDirectory" ClipboardTooltipSubject="the number of files in the directory"/>
        <TextInfoLines Label="Files list" MaxLines="14" Value="@this.directoryFiles.ToString()" ClipboardTooltipSubject="the files list"/>
        @if (this.directorySizeNumFiles > 100)
        {
            <MudJustifiedText Typo="Typo.body1" Color="Color.Warning" Class="mb-3">
                For performance reasons, only the first 100 files are shown. The directory contains @this.NumberFilesInDirectory files in total.
            </MudJustifiedText>
        }
        
        <TextInfoLine Icon="@Icons.Material.Filled.SquareFoot" Label="Total directory size" Value="@this.directorySizeBytes.FileSize()" ClipboardTooltipSubject="the total directory size"/>
    </DialogContent>
    <DialogActions>
        @if (this.IsOperationInProgress)
        {
            <MudProgressLinear Color="Color.Primary" Indeterminate="true" Class="ml-5 mr-5"/>
        }
        <MudButton OnClick="@this.Close" Variant="Variant.Filled">Close</MudButton>
    </DialogActions>
</MudDialog>