import 'vacation_response_dto.dart';

class VacationsListResponseDto {
  final int statusCode;
  final bool isSuccess;
  final String? message;
  final VacationsListDataDto? data;

  VacationsListResponseDto({
    required this.statusCode,
    required this.isSuccess,
    this.message,
    this.data,
  });

  factory VacationsListResponseDto.fromJson(Map<String, dynamic> json) {
    return VacationsListResponseDto(
      statusCode: json['statusCode'] ?? 0,
      isSuccess: json['isSuccess'] ?? false,
      message: json['message'],
      data: json['data'] != null ? VacationsListDataDto.fromJson(json['data']) : null,
    );
  }
}

class VacationsListDataDto {
  final List<VacationDataDto> items;
  final int pageNumber;
  final int pageSize;
  final int totalCount;
  final int totalPages;

  VacationsListDataDto({
    required this.items,
    required this.pageNumber,
    required this.pageSize,
    required this.totalCount,
    required this.totalPages,
  });

  factory VacationsListDataDto.fromJson(Map<String, dynamic> json) {
    return VacationsListDataDto(
      items: json['items'] != null
          ? (json['items'] as List)
              .map((item) => VacationDataDto.fromJson(item))
              .toList()
          : [],
      pageNumber: json['pageNumber'] ?? 1,
      pageSize: json['pageSize'] ?? 15,
      totalCount: json['totalCount'] ?? 0,
      totalPages: json['totalPages'] ?? 1,
    );
  }
}
