import 'package:fotodocumentation/dto/picture_dto.dart';
import 'package:fotodocumentation/utils/date_time_utils.dart';

class CustomerListDto {
  final int id;
  final String name;
  final String customerNumber;
  final DateTime? lastUpdateDate;

  CustomerListDto({required this.id, required this.name, required this.customerNumber, this.lastUpdateDate});

  /// Create from JSON response
  factory CustomerListDto.fromJson(Map<String, dynamic> json) {
    return CustomerListDto(
      id: json['id'] as int,
      name: json['name'] as String,
      customerNumber: json['customerNumber'] as String,
      lastUpdateDate: DateTimeUtils.toDateTime(json['lastUpdateDate']),
    );
  }
}

class CustomerDto {
  final int id;
  final String name;
  final String customerNumber;
  final List<PictureDto> pictures;

  CustomerDto({required this.id, required this.name, required this.customerNumber, required this.pictures});

  /// Create from JSON response
  factory CustomerDto.fromJson(Map<String, dynamic> json) {
    return CustomerDto(
      id: json['id'] as int,
      name: json['name'] as String,
      customerNumber: json['customerNumber'] as String,
      pictures: List<PictureDto>.from(json["pictures"].map((x) => PictureDto.fromJson(x))),
    );
  }
}


