import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { RouterModule } from '@angular/router';
import { WatermarkScreenComponent } from './watermark-screen/watermark-screen.component';
import { WatermarksListingScreenComponent } from './watermarks-listing/watermarks-listing-screen.component';
import {
    CircleButtonComponent,
    CompositeRouteGuard,
    HasScrollbarDirective,
    IconButtonComponent,
    IqserAllowDirective,
    IqserHelpModeModule,
    IqserListingModule,
    IqserRoutes,
} from '@iqser/common-ui';
import { RedRoleGuard } from '@users/red-role.guard';
import { WATERMARK_ID } from '@red/domain';
import { watermarkExistsGuard } from '@guards/watermark-exists.guard';
import { TranslateModule } from '@ngx-translate/core';
import { PaginatorComponent } from './paginator/paginator.component';
import { MatIconModule } from '@angular/material/icon';
import { ReactiveFormsModule } from '@angular/forms';
import { MatSliderModule } from '@angular/material/slider';
import { ColorPickerModule } from 'ngx-color-picker';
import { MatTooltipModule } from '@angular/material/tooltip';
import { MatSlideToggleModule } from '@angular/material/slide-toggle';
import { IqserAuthGuard, IqserUsersModule } from '@iqser/common-ui/lib/users';
import { TenantPipe } from '@iqser/common-ui/lib/tenants';

const routes: IqserRoutes = [
    {
        path: '',
        component: WatermarksListingScreenComponent,
        canActivate: [CompositeRouteGuard],
        data: {
            routeGuards: [IqserAuthGuard, RedRoleGuard],
        },
    },
    {
        path: 'create',
        component: WatermarkScreenComponent,
        canActivate: [CompositeRouteGuard],
        data: {
            routeGuards: [IqserAuthGuard, RedRoleGuard],
        },
    },
    {
        path: `:${WATERMARK_ID}`,
        component: WatermarkScreenComponent,
        canActivate: [CompositeRouteGuard, watermarkExistsGuard()],
        data: {
            routeGuards: [IqserAuthGuard, RedRoleGuard],
        },
    },
];

@NgModule({
    declarations: [WatermarkScreenComponent, WatermarksListingScreenComponent, PaginatorComponent],
    imports: [
        RouterModule.forChild(routes),
        CommonModule,
        IqserUsersModule,
        TranslateModule,
        IqserListingModule,
        IqserHelpModeModule,
        MatIconModule,
        IconButtonComponent,
        ReactiveFormsModule,
        MatSliderModule,
        ColorPickerModule,
        MatSlideToggleModule,
        CircleButtonComponent,
        HasScrollbarDirective,
        IqserAllowDirective,
        TenantPipe,
        MatTooltipModule,
    ],
})
export class WatermarkModule {}
