import { Pipe, PipeTransform } from '@angular/core';
import { DateTransformerService } from '@shared/services/date/date-transformer.service';

@Pipe({
    name: 'aflDate',
})
export class DatePipe implements PipeTransform {
    constructor(private dateTransformerService: DateTransformerService) {}

    transform(date?: Date | string, withTime?: 'with-time'): string {
        return this.dateTransformerService.toDateString(date, !!withTime);
    }
}

@Pipe({
    name: 'aflLocalDate',
})
export class LocalDatePipe implements PipeTransform {
    constructor(private dateTransformerService: DateTransformerService) {}

    transform(date?: Date | string): string {
        return this.dateTransformerService.toLocalDateString(date);
    }
}

@Pipe({
    name: 'textDate',
})
export class TextDatePipe implements PipeTransform {
    constructor(private dateTransformerService: DateTransformerService) {}

    transform(date?: Date): string {
        return this.dateTransformerService.toString(date);
    }
}
