import { Component, EventEmitter, Input, Output } from '@angular/core';
import { CommonModule } from '@angular/common';
import { FormsModule } from '@angular/forms';
import { CustomSelectComponent } from '../../../../components/custom-select/custom-select';

export type MonthOption = { value: number; label: string };

export type ParcelamentosFiltersModel = {
  anoRef: string;
  linha: string;
  cliente: string;
  competenciaAno: string;
  competenciaMes: number | '';
  search: string;
};

export type FilterChip = { label: string; value: string };

@Component({
  selector: 'app-parcelamentos-filters',
  standalone: true,
  imports: [CommonModule, FormsModule, CustomSelectComponent],
  templateUrl: './parcelamentos-filters.html',
  styleUrls: ['./parcelamentos-filters.scss'],
})
export class ParcelamentosFiltersComponent {
  @Input() filters!: ParcelamentosFiltersModel;
  @Input() monthOptions: MonthOption[] = [];
  @Input() loading = false;
  @Input() competenciaInvalid = false;
  @Input() activeChips: FilterChip[] = [];

  @Output() apply = new EventEmitter<void>();
  @Output() clear = new EventEmitter<void>();
  @Output() searchChange = new EventEmitter<string>();
}
