PMU-PIbd-31-Potapov-N-S/lib/data/dtos/user_dto.dart

77 lines
1.6 KiB
Dart
Raw Normal View History

2024-12-11 04:57:28 +04:00
import 'package:json_annotation/json_annotation.dart';
part 'user_dto.g.dart';
@JsonSerializable(createToJson: false)
class UsersDto {
final List<UserDto>? items;
final int? count;
final int? limit;
final int? countAll;
final int? pagesCount;
final int? pageNumber;
final bool? hasPrevPage;
final bool? hasNextPage;
const UsersDto(
{this.items,
this.count,
this.limit,
this.countAll,
this.pagesCount,
this.pageNumber,
this.hasPrevPage,
this.hasNextPage});
factory UsersDto.fromJson(Map<String, dynamic> json) =>
_$UsersDtoFromJson(json);
}
@JsonSerializable(createToJson: false)
class UserDto {
final UserDataDto? model;
final int? age;
final double? distance;
const UserDto({this.model, this.age, this.distance});
factory UserDto.fromJson(Map<String, dynamic> json) =>
_$UserDtoFromJson(json);
}
@JsonSerializable(createToJson: false)
class LocationDto {
final double? lat;
final double? lon;
const LocationDto({this.lat, this.lon});
factory LocationDto.fromJson(Map<String, dynamic> json) =>
_$LocationDtoFromJson(json);
}
@JsonSerializable(createToJson: false)
class UserDataDto {
final int? id;
final String? name;
final String? surname;
final String? description;
final String? image;
final String? gender;
final String? dateOfBirth;
final LocationDto? location;
const UserDataDto(
{this.id,
this.name,
this.surname,
this.description,
this.image,
this.gender,
this.dateOfBirth,
this.location});
factory UserDataDto.fromJson(Map<String, dynamic> json) =>
_$UserDataDtoFromJson(json);
}