import { DatePipe } from '@angular/common';
import { Title } from '@angular/platform-browser';
import { trigger, state, style, animate, transition } from '@angular/animations';
import { Component, DestroyRef, inject, OnInit } from '@angular/core';
import { MatCardModule } from '@angular/material/card';
import { MatDividerModule } from '@angular/material/divider';
import { MatIconModule } from '@angular/material/icon';

import { ListErrorsComponent } from '@components/shared';
import { Errors } from '@models';
//import { UtilitiesService } from '@services';
//import { UserService } from '@services';
@Component({
    selector: 'app-home',
    imports: [DatePipe, MatCardModule, MatDividerModule, MatIconModule, ListErrorsComponent],
    templateUrl: './home.component.html',
    styleUrl: './home.component.scss',
    animations: [
        trigger('flyInOut', [
            state('in', style({ transform: 'translateY(0)' })),
            transition('void => *', [style({ transform: 'translateY(-100%)' }), animate(200)]),
            transition('* => void', [style({ transform: 'translateY(100%)' }), animate(200)]),
        ]),
    ],
})
export class HomeComponent implements OnInit {
    private _titleService = inject(Title);

    public title = 'Shop bientôt disponible!';
    public description = "Encore un peu de patience, notre shop sera mis en ligne d'ici peu.";
    public errors: Errors = { errors: {} };
    public destroyRef = inject(DestroyRef);
    public now = new Date();

    ngOnInit() {
        this._titleService.setTitle(this.title);
        /*
        type CreateArrayWithLengthX<
            LENGTH extends number,
            ACC extends unknown[] = [],
        > = ACC['length'] extends LENGTH
        ? ACC
        : CreateArrayWithLengthX<LENGTH, [...ACC, 1]>;
    
        type NumericRange<
            START_ARR extends number[],
            END extends number,
            ACC extends number = never>
            = START_ARR['length'] extends END
            ? ACC | END
            : NumericRange<[...START_ARR, 1], END, ACC | START_ARR['length']>;
    
        //type TWENTY_TO_FORTY = NumericRange<CreateArrayWithLengthX<7>, 13, 7>;
        //type TWENTY_TO_FORTY = NumericRange<CreateArrayWithLengthX<13>, 19>;
        type TWENTY_TO_FORTY = NumericRange<CreateArrayWithLengthX<1>, 10>;
        */
    }
}
