added new models

This commit is contained in:
llsajjad
2025-08-17 13:48:02 +03:30
parent 09032cf5bf
commit 57c7b1e38d
9 changed files with 847 additions and 95 deletions
@@ -1,6 +1,8 @@
// ignore_for_file: invalid_annotation_target
import 'package:freezed_annotation/freezed_annotation.dart';
import 'package:tm_app/data/services/model/error/error_model.dart';
import 'package:tm_app/data/services/model/tender_data/tender_data.dart';
part 'tender_model.freezed.dart';
part 'tender_model.g.dart';
@@ -8,21 +10,14 @@ part 'tender_model.g.dart';
@freezed
abstract class TenderModel with _$TenderModel {
const factory TenderModel({
@JsonKey(name: 'created_time') required String? createdTime,
@JsonKey(name: 'tender_id') required String? tenderId,
required String? status,
required String? title,
required String? description,
required String? location,
required String? type,
required String? deadline,
required bool? liked,
required bool? disliked,
required bool? rejected,
required bool? submitted,
required bool? success,
required String? message,
required TenderData? data,
required ErrorModel? error,
@JsonKey(name: 'profile_match') required double? profileMatch,
}) = _TenderModel;
factory TenderModel.fromJson(Map<String, Object?> json) =>
_$TenderModelFromJson(json);
}
}
@@ -15,7 +15,7 @@ T _$identity<T>(T value) => value;
/// @nodoc
mixin _$TenderModel {
@JsonKey(name: 'created_time') String? get createdTime;@JsonKey(name: 'tender_id') String? get tenderId; String? get status; String? get title; String? get description; String? get location; String? get type; String? get deadline; bool? get liked; bool? get disliked; bool? get rejected; bool? get submitted;@JsonKey(name: 'profile_match') double? get profileMatch;
bool? get success; String? get message; TenderData? get data; ErrorModel? get error;@JsonKey(name: 'profile_match') double? get profileMatch;
/// Create a copy of TenderModel
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@@ -28,16 +28,16 @@ $TenderModelCopyWith<TenderModel> get copyWith => _$TenderModelCopyWithImpl<Tend
@override
bool operator ==(Object other) {
return identical(this, other) || (other.runtimeType == runtimeType&&other is TenderModel&&(identical(other.createdTime, createdTime) || other.createdTime == createdTime)&&(identical(other.tenderId, tenderId) || other.tenderId == tenderId)&&(identical(other.status, status) || other.status == status)&&(identical(other.title, title) || other.title == title)&&(identical(other.description, description) || other.description == description)&&(identical(other.location, location) || other.location == location)&&(identical(other.type, type) || other.type == type)&&(identical(other.deadline, deadline) || other.deadline == deadline)&&(identical(other.liked, liked) || other.liked == liked)&&(identical(other.disliked, disliked) || other.disliked == disliked)&&(identical(other.rejected, rejected) || other.rejected == rejected)&&(identical(other.submitted, submitted) || other.submitted == submitted)&&(identical(other.profileMatch, profileMatch) || other.profileMatch == profileMatch));
return identical(this, other) || (other.runtimeType == runtimeType&&other is TenderModel&&(identical(other.success, success) || other.success == success)&&(identical(other.message, message) || other.message == message)&&(identical(other.data, data) || other.data == data)&&(identical(other.error, error) || other.error == error)&&(identical(other.profileMatch, profileMatch) || other.profileMatch == profileMatch));
}
@JsonKey(includeFromJson: false, includeToJson: false)
@override
int get hashCode => Object.hash(runtimeType,createdTime,tenderId,status,title,description,location,type,deadline,liked,disliked,rejected,submitted,profileMatch);
int get hashCode => Object.hash(runtimeType,success,message,data,error,profileMatch);
@override
String toString() {
return 'TenderModel(createdTime: $createdTime, tenderId: $tenderId, status: $status, title: $title, description: $description, location: $location, type: $type, deadline: $deadline, liked: $liked, disliked: $disliked, rejected: $rejected, submitted: $submitted, profileMatch: $profileMatch)';
return 'TenderModel(success: $success, message: $message, data: $data, error: $error, profileMatch: $profileMatch)';
}
@@ -48,11 +48,11 @@ abstract mixin class $TenderModelCopyWith<$Res> {
factory $TenderModelCopyWith(TenderModel value, $Res Function(TenderModel) _then) = _$TenderModelCopyWithImpl;
@useResult
$Res call({
@JsonKey(name: 'created_time') String? createdTime,@JsonKey(name: 'tender_id') String? tenderId, String? status, String? title, String? description, String? location, String? type, String? deadline, bool? liked, bool? disliked, bool? rejected, bool? submitted,@JsonKey(name: 'profile_match') double? profileMatch
bool? success, String? message, TenderData? data, ErrorModel? error,@JsonKey(name: 'profile_match') double? profileMatch
});
$TenderDataCopyWith<$Res>? get data;$ErrorModelCopyWith<$Res>? get error;
}
/// @nodoc
@@ -65,25 +65,41 @@ class _$TenderModelCopyWithImpl<$Res>
/// Create a copy of TenderModel
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline') @override $Res call({Object? createdTime = freezed,Object? tenderId = freezed,Object? status = freezed,Object? title = freezed,Object? description = freezed,Object? location = freezed,Object? type = freezed,Object? deadline = freezed,Object? liked = freezed,Object? disliked = freezed,Object? rejected = freezed,Object? submitted = freezed,Object? profileMatch = freezed,}) {
@pragma('vm:prefer-inline') @override $Res call({Object? success = freezed,Object? message = freezed,Object? data = freezed,Object? error = freezed,Object? profileMatch = freezed,}) {
return _then(_self.copyWith(
createdTime: freezed == createdTime ? _self.createdTime : createdTime // ignore: cast_nullable_to_non_nullable
as String?,tenderId: freezed == tenderId ? _self.tenderId : tenderId // ignore: cast_nullable_to_non_nullable
as String?,status: freezed == status ? _self.status : status // ignore: cast_nullable_to_non_nullable
as String?,title: freezed == title ? _self.title : title // ignore: cast_nullable_to_non_nullable
as String?,description: freezed == description ? _self.description : description // ignore: cast_nullable_to_non_nullable
as String?,location: freezed == location ? _self.location : location // ignore: cast_nullable_to_non_nullable
as String?,type: freezed == type ? _self.type : type // ignore: cast_nullable_to_non_nullable
as String?,deadline: freezed == deadline ? _self.deadline : deadline // ignore: cast_nullable_to_non_nullable
as String?,liked: freezed == liked ? _self.liked : liked // ignore: cast_nullable_to_non_nullable
as bool?,disliked: freezed == disliked ? _self.disliked : disliked // ignore: cast_nullable_to_non_nullable
as bool?,rejected: freezed == rejected ? _self.rejected : rejected // ignore: cast_nullable_to_non_nullable
as bool?,submitted: freezed == submitted ? _self.submitted : submitted // ignore: cast_nullable_to_non_nullable
as bool?,profileMatch: freezed == profileMatch ? _self.profileMatch : profileMatch // ignore: cast_nullable_to_non_nullable
success: freezed == success ? _self.success : success // ignore: cast_nullable_to_non_nullable
as bool?,message: freezed == message ? _self.message : message // ignore: cast_nullable_to_non_nullable
as String?,data: freezed == data ? _self.data : data // ignore: cast_nullable_to_non_nullable
as TenderData?,error: freezed == error ? _self.error : error // ignore: cast_nullable_to_non_nullable
as ErrorModel?,profileMatch: freezed == profileMatch ? _self.profileMatch : profileMatch // ignore: cast_nullable_to_non_nullable
as double?,
));
}
/// Create a copy of TenderModel
/// with the given fields replaced by the non-null parameter values.
@override
@pragma('vm:prefer-inline')
$TenderDataCopyWith<$Res>? get data {
if (_self.data == null) {
return null;
}
return $TenderDataCopyWith<$Res>(_self.data!, (value) {
return _then(_self.copyWith(data: value));
});
}/// Create a copy of TenderModel
/// with the given fields replaced by the non-null parameter values.
@override
@pragma('vm:prefer-inline')
$ErrorModelCopyWith<$Res>? get error {
if (_self.error == null) {
return null;
}
return $ErrorModelCopyWith<$Res>(_self.error!, (value) {
return _then(_self.copyWith(error: value));
});
}
}
@@ -165,10 +181,10 @@ return $default(_that);case _:
/// }
/// ```
@optionalTypeArgs TResult maybeWhen<TResult extends Object?>(TResult Function(@JsonKey(name: 'created_time') String? createdTime, @JsonKey(name: 'tender_id') String? tenderId, String? status, String? title, String? description, String? location, String? type, String? deadline, bool? liked, bool? disliked, bool? rejected, bool? submitted, @JsonKey(name: 'profile_match') double? profileMatch)? $default,{required TResult orElse(),}) {final _that = this;
@optionalTypeArgs TResult maybeWhen<TResult extends Object?>(TResult Function( bool? success, String? message, TenderData? data, ErrorModel? error, @JsonKey(name: 'profile_match') double? profileMatch)? $default,{required TResult orElse(),}) {final _that = this;
switch (_that) {
case _TenderModel() when $default != null:
return $default(_that.createdTime,_that.tenderId,_that.status,_that.title,_that.description,_that.location,_that.type,_that.deadline,_that.liked,_that.disliked,_that.rejected,_that.submitted,_that.profileMatch);case _:
return $default(_that.success,_that.message,_that.data,_that.error,_that.profileMatch);case _:
return orElse();
}
@@ -186,10 +202,10 @@ return $default(_that.createdTime,_that.tenderId,_that.status,_that.title,_that.
/// }
/// ```
@optionalTypeArgs TResult when<TResult extends Object?>(TResult Function(@JsonKey(name: 'created_time') String? createdTime, @JsonKey(name: 'tender_id') String? tenderId, String? status, String? title, String? description, String? location, String? type, String? deadline, bool? liked, bool? disliked, bool? rejected, bool? submitted, @JsonKey(name: 'profile_match') double? profileMatch) $default,) {final _that = this;
@optionalTypeArgs TResult when<TResult extends Object?>(TResult Function( bool? success, String? message, TenderData? data, ErrorModel? error, @JsonKey(name: 'profile_match') double? profileMatch) $default,) {final _that = this;
switch (_that) {
case _TenderModel():
return $default(_that.createdTime,_that.tenderId,_that.status,_that.title,_that.description,_that.location,_that.type,_that.deadline,_that.liked,_that.disliked,_that.rejected,_that.submitted,_that.profileMatch);case _:
return $default(_that.success,_that.message,_that.data,_that.error,_that.profileMatch);case _:
throw StateError('Unexpected subclass');
}
@@ -206,10 +222,10 @@ return $default(_that.createdTime,_that.tenderId,_that.status,_that.title,_that.
/// }
/// ```
@optionalTypeArgs TResult? whenOrNull<TResult extends Object?>(TResult? Function(@JsonKey(name: 'created_time') String? createdTime, @JsonKey(name: 'tender_id') String? tenderId, String? status, String? title, String? description, String? location, String? type, String? deadline, bool? liked, bool? disliked, bool? rejected, bool? submitted, @JsonKey(name: 'profile_match') double? profileMatch)? $default,) {final _that = this;
@optionalTypeArgs TResult? whenOrNull<TResult extends Object?>(TResult? Function( bool? success, String? message, TenderData? data, ErrorModel? error, @JsonKey(name: 'profile_match') double? profileMatch)? $default,) {final _that = this;
switch (_that) {
case _TenderModel() when $default != null:
return $default(_that.createdTime,_that.tenderId,_that.status,_that.title,_that.description,_that.location,_that.type,_that.deadline,_that.liked,_that.disliked,_that.rejected,_that.submitted,_that.profileMatch);case _:
return $default(_that.success,_that.message,_that.data,_that.error,_that.profileMatch);case _:
return null;
}
@@ -221,21 +237,13 @@ return $default(_that.createdTime,_that.tenderId,_that.status,_that.title,_that.
@JsonSerializable()
class _TenderModel implements TenderModel {
const _TenderModel({@JsonKey(name: 'created_time') required this.createdTime, @JsonKey(name: 'tender_id') required this.tenderId, required this.status, required this.title, required this.description, required this.location, required this.type, required this.deadline, required this.liked, required this.disliked, required this.rejected, required this.submitted, @JsonKey(name: 'profile_match') required this.profileMatch});
const _TenderModel({required this.success, required this.message, required this.data, required this.error, @JsonKey(name: 'profile_match') required this.profileMatch});
factory _TenderModel.fromJson(Map<String, dynamic> json) => _$TenderModelFromJson(json);
@override@JsonKey(name: 'created_time') final String? createdTime;
@override@JsonKey(name: 'tender_id') final String? tenderId;
@override final String? status;
@override final String? title;
@override final String? description;
@override final String? location;
@override final String? type;
@override final String? deadline;
@override final bool? liked;
@override final bool? disliked;
@override final bool? rejected;
@override final bool? submitted;
@override final bool? success;
@override final String? message;
@override final TenderData? data;
@override final ErrorModel? error;
@override@JsonKey(name: 'profile_match') final double? profileMatch;
/// Create a copy of TenderModel
@@ -251,16 +259,16 @@ Map<String, dynamic> toJson() {
@override
bool operator ==(Object other) {
return identical(this, other) || (other.runtimeType == runtimeType&&other is _TenderModel&&(identical(other.createdTime, createdTime) || other.createdTime == createdTime)&&(identical(other.tenderId, tenderId) || other.tenderId == tenderId)&&(identical(other.status, status) || other.status == status)&&(identical(other.title, title) || other.title == title)&&(identical(other.description, description) || other.description == description)&&(identical(other.location, location) || other.location == location)&&(identical(other.type, type) || other.type == type)&&(identical(other.deadline, deadline) || other.deadline == deadline)&&(identical(other.liked, liked) || other.liked == liked)&&(identical(other.disliked, disliked) || other.disliked == disliked)&&(identical(other.rejected, rejected) || other.rejected == rejected)&&(identical(other.submitted, submitted) || other.submitted == submitted)&&(identical(other.profileMatch, profileMatch) || other.profileMatch == profileMatch));
return identical(this, other) || (other.runtimeType == runtimeType&&other is _TenderModel&&(identical(other.success, success) || other.success == success)&&(identical(other.message, message) || other.message == message)&&(identical(other.data, data) || other.data == data)&&(identical(other.error, error) || other.error == error)&&(identical(other.profileMatch, profileMatch) || other.profileMatch == profileMatch));
}
@JsonKey(includeFromJson: false, includeToJson: false)
@override
int get hashCode => Object.hash(runtimeType,createdTime,tenderId,status,title,description,location,type,deadline,liked,disliked,rejected,submitted,profileMatch);
int get hashCode => Object.hash(runtimeType,success,message,data,error,profileMatch);
@override
String toString() {
return 'TenderModel(createdTime: $createdTime, tenderId: $tenderId, status: $status, title: $title, description: $description, location: $location, type: $type, deadline: $deadline, liked: $liked, disliked: $disliked, rejected: $rejected, submitted: $submitted, profileMatch: $profileMatch)';
return 'TenderModel(success: $success, message: $message, data: $data, error: $error, profileMatch: $profileMatch)';
}
@@ -271,11 +279,11 @@ abstract mixin class _$TenderModelCopyWith<$Res> implements $TenderModelCopyWith
factory _$TenderModelCopyWith(_TenderModel value, $Res Function(_TenderModel) _then) = __$TenderModelCopyWithImpl;
@override @useResult
$Res call({
@JsonKey(name: 'created_time') String? createdTime,@JsonKey(name: 'tender_id') String? tenderId, String? status, String? title, String? description, String? location, String? type, String? deadline, bool? liked, bool? disliked, bool? rejected, bool? submitted,@JsonKey(name: 'profile_match') double? profileMatch
bool? success, String? message, TenderData? data, ErrorModel? error,@JsonKey(name: 'profile_match') double? profileMatch
});
@override $TenderDataCopyWith<$Res>? get data;@override $ErrorModelCopyWith<$Res>? get error;
}
/// @nodoc
@@ -288,26 +296,42 @@ class __$TenderModelCopyWithImpl<$Res>
/// Create a copy of TenderModel
/// with the given fields replaced by the non-null parameter values.
@override @pragma('vm:prefer-inline') $Res call({Object? createdTime = freezed,Object? tenderId = freezed,Object? status = freezed,Object? title = freezed,Object? description = freezed,Object? location = freezed,Object? type = freezed,Object? deadline = freezed,Object? liked = freezed,Object? disliked = freezed,Object? rejected = freezed,Object? submitted = freezed,Object? profileMatch = freezed,}) {
@override @pragma('vm:prefer-inline') $Res call({Object? success = freezed,Object? message = freezed,Object? data = freezed,Object? error = freezed,Object? profileMatch = freezed,}) {
return _then(_TenderModel(
createdTime: freezed == createdTime ? _self.createdTime : createdTime // ignore: cast_nullable_to_non_nullable
as String?,tenderId: freezed == tenderId ? _self.tenderId : tenderId // ignore: cast_nullable_to_non_nullable
as String?,status: freezed == status ? _self.status : status // ignore: cast_nullable_to_non_nullable
as String?,title: freezed == title ? _self.title : title // ignore: cast_nullable_to_non_nullable
as String?,description: freezed == description ? _self.description : description // ignore: cast_nullable_to_non_nullable
as String?,location: freezed == location ? _self.location : location // ignore: cast_nullable_to_non_nullable
as String?,type: freezed == type ? _self.type : type // ignore: cast_nullable_to_non_nullable
as String?,deadline: freezed == deadline ? _self.deadline : deadline // ignore: cast_nullable_to_non_nullable
as String?,liked: freezed == liked ? _self.liked : liked // ignore: cast_nullable_to_non_nullable
as bool?,disliked: freezed == disliked ? _self.disliked : disliked // ignore: cast_nullable_to_non_nullable
as bool?,rejected: freezed == rejected ? _self.rejected : rejected // ignore: cast_nullable_to_non_nullable
as bool?,submitted: freezed == submitted ? _self.submitted : submitted // ignore: cast_nullable_to_non_nullable
as bool?,profileMatch: freezed == profileMatch ? _self.profileMatch : profileMatch // ignore: cast_nullable_to_non_nullable
success: freezed == success ? _self.success : success // ignore: cast_nullable_to_non_nullable
as bool?,message: freezed == message ? _self.message : message // ignore: cast_nullable_to_non_nullable
as String?,data: freezed == data ? _self.data : data // ignore: cast_nullable_to_non_nullable
as TenderData?,error: freezed == error ? _self.error : error // ignore: cast_nullable_to_non_nullable
as ErrorModel?,profileMatch: freezed == profileMatch ? _self.profileMatch : profileMatch // ignore: cast_nullable_to_non_nullable
as double?,
));
}
/// Create a copy of TenderModel
/// with the given fields replaced by the non-null parameter values.
@override
@pragma('vm:prefer-inline')
$TenderDataCopyWith<$Res>? get data {
if (_self.data == null) {
return null;
}
return $TenderDataCopyWith<$Res>(_self.data!, (value) {
return _then(_self.copyWith(data: value));
});
}/// Create a copy of TenderModel
/// with the given fields replaced by the non-null parameter values.
@override
@pragma('vm:prefer-inline')
$ErrorModelCopyWith<$Res>? get error {
if (_self.error == null) {
return null;
}
return $ErrorModelCopyWith<$Res>(_self.error!, (value) {
return _then(_self.copyWith(error: value));
});
}
}
// dart format on
@@ -7,34 +7,24 @@ part of 'tender_model.dart';
// **************************************************************************
_TenderModel _$TenderModelFromJson(Map<String, dynamic> json) => _TenderModel(
createdTime: json['created_time'] as String?,
tenderId: json['tender_id'] as String?,
status: json['status'] as String?,
title: json['title'] as String?,
description: json['description'] as String?,
location: json['location'] as String?,
type: json['type'] as String?,
deadline: json['deadline'] as String?,
liked: json['liked'] as bool?,
disliked: json['disliked'] as bool?,
rejected: json['rejected'] as bool?,
submitted: json['submitted'] as bool?,
success: json['success'] as bool?,
message: json['message'] as String?,
data:
json['data'] == null
? null
: TenderData.fromJson(json['data'] as Map<String, dynamic>),
error:
json['error'] == null
? null
: ErrorModel.fromJson(json['error'] as Map<String, dynamic>),
profileMatch: (json['profile_match'] as num?)?.toDouble(),
);
Map<String, dynamic> _$TenderModelToJson(_TenderModel instance) =>
<String, dynamic>{
'created_time': instance.createdTime,
'tender_id': instance.tenderId,
'status': instance.status,
'title': instance.title,
'description': instance.description,
'location': instance.location,
'type': instance.type,
'deadline': instance.deadline,
'liked': instance.liked,
'disliked': instance.disliked,
'rejected': instance.rejected,
'submitted': instance.submitted,
'success': instance.success,
'message': instance.message,
'data': instance.data,
'error': instance.error,
'profile_match': instance.profileMatch,
};