<settings-menu></settings-menu>

<wiki [url]="'https://github.com/tidusjar/Ombi/wiki/User-Importer-Settings'"></wiki>
<fieldset *ngIf="settings">
    <legend>User Importer Settings</legend>

    <div class="col-md-6">
        <div *ngIf="plexEnabled">

            <div class="form-group">
                <div class="checkbox">
                    <input type="checkbox" id="importPlex" [(ngModel)]="settings.importPlexUsers">
                    <label for="importPlex">Import Plex Users</label>
                </div>
            </div>
            
            <div class="form-group">
                <div class="checkbox">
                    <input type="checkbox" id="importAdmin" [(ngModel)]="settings.importPlexAdmin">
                    <label for="importAdmin">Import Plex Admin</label>
                </div>
            </div>
            <div *ngIf="plexUsers">
                <p>Plex Users exclude from Import</p>
                
                <p-autoComplete [(ngModel)]="bannedPlexUsers" [suggestions]="filteredPlexUsers" [multiple]="true" field="username" (completeMethod)="filterPlexList($event)"></p-autoComplete>
            </div>
        </div>

        <div *ngIf="embyEnabled">


            <div class="form-group">
                <div class="checkbox">
                    <input type="checkbox" id="importEmbyUsers" [(ngModel)]="settings.importEmbyUsers">
                    <label for="importEmbyUsers">Import Emby Users</label>
                </div>
            </div>
            
            <div *ngIf="embyUsers">
                <p>Emby Users exclude from Import</p>
                
                <p-autoComplete [(ngModel)]="bannedEmbyUsers" [suggestions]="filteredEmbyUsers" [multiple]="true" field="username" (completeMethod)="filterEmbyList($event)"></p-autoComplete>
            </div>

        </div>
    </div>
    <div class="col-md-6">
        <h4>Default Roles</h4>

        <div *ngFor="let c of claims">
            <div class="form-group">
                <div class="checkbox">
                    <input type="checkbox" [(ngModel)]="c.enabled" [value]="c.value" id="create{{c.value}}" [attr.name]="'create' + c.value" ng-checked="c.enabled">
                    <label for="create{{c.value}}">{{c.value | humanize}}</label>
                </div>
            </div>
        </div>

        <h4>Default Request Limits</h4>
        <div class="form-group">
            <label for="movieRequestLimit" class="control-label">Movie Request Limit</label>
            <div>
                <input type="text" [(ngModel)]="settings.movieRequestLimit" class="form-control form-small form-control-custom " id="movieRequestLimit" name="movieRequestLimit" value="{{settings?.movieRequestLimit}}">
            </div>
        </div>

        <div class="form-group">
            <label for="episodeRequestLimit" class="control-label">Episode Request Limit</label>
            <div>
                <input type="text" [(ngModel)]="settings.episodeRequestLimit" class="form-control form-small form-control-custom " id="episodeRequestLimit" name="episodeRequestLimit" value="{{settings?.episodeRequestLimit}}">
            </div>
        </div>

    </div>
    <div class="col-md-6">
        <div class="form-group">
            <button type="submit" id="save" (click)="submit()" class="btn btn-primary-outline">Submit</button>
            <button type="button" [disabled]="!enableImportButton" (click)="runImporter()" class="btn btn-info-outline">Run Importer</button>
        </div>     
        <div class="form-group">
        </div>
    </div>
</fieldset>