2023-05-26 21:21:16 +00:00
|
|
|
/*
|
|
|
|
* This file is part of Stack Wallet.
|
|
|
|
*
|
|
|
|
* Copyright (c) 2023 Cypher Stack
|
|
|
|
* All Rights Reserved.
|
|
|
|
* The code is distributed under GPLv3 license, see LICENSE file for details.
|
|
|
|
* Generated by Cypher Stack on 2023-05-26
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2023-02-05 20:32:39 +00:00
|
|
|
import 'package:isar/isar.dart';
|
2022-10-03 15:41:53 +00:00
|
|
|
|
2023-02-05 20:32:39 +00:00
|
|
|
part 'pair.g.dart';
|
|
|
|
|
2023-02-06 14:43:16 +00:00
|
|
|
// embedded enum // no not modify
|
|
|
|
enum SupportedRateType { fixed, estimated, both }
|
|
|
|
|
2023-02-05 20:32:39 +00:00
|
|
|
@collection
|
2022-10-02 19:37:11 +00:00
|
|
|
class Pair {
|
2023-02-06 14:43:16 +00:00
|
|
|
Pair({
|
|
|
|
required this.exchangeName,
|
|
|
|
required this.from,
|
|
|
|
required this.to,
|
|
|
|
required this.rateType,
|
|
|
|
});
|
|
|
|
|
2023-02-05 20:32:39 +00:00
|
|
|
Id? id;
|
|
|
|
|
|
|
|
@Index()
|
|
|
|
final String exchangeName;
|
|
|
|
|
2024-05-27 23:56:22 +00:00
|
|
|
@Index(
|
|
|
|
composite: [
|
|
|
|
CompositeIndex("exchangeName"),
|
|
|
|
CompositeIndex("to"),
|
|
|
|
],
|
|
|
|
)
|
2022-10-02 19:37:11 +00:00
|
|
|
final String from;
|
|
|
|
|
|
|
|
final String to;
|
|
|
|
|
2023-02-06 14:43:16 +00:00
|
|
|
@enumerated
|
|
|
|
final SupportedRateType rateType;
|
2022-10-03 15:41:53 +00:00
|
|
|
|
|
|
|
Map<String, dynamic> toMap() {
|
2022-10-02 19:37:11 +00:00
|
|
|
return {
|
2023-02-05 20:32:39 +00:00
|
|
|
"id": id,
|
|
|
|
"exchangeName": exchangeName,
|
2022-10-02 19:37:11 +00:00
|
|
|
"from": from,
|
|
|
|
"to": to,
|
2023-02-06 14:43:16 +00:00
|
|
|
"rateType": rateType,
|
2022-10-02 19:37:11 +00:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
@override
|
2022-10-03 15:41:53 +00:00
|
|
|
bool operator ==(other) =>
|
|
|
|
other is Pair &&
|
2023-02-05 20:32:39 +00:00
|
|
|
exchangeName == other.exchangeName &&
|
2022-10-03 15:41:53 +00:00
|
|
|
from == other.from &&
|
|
|
|
to == other.to &&
|
2023-02-06 14:43:16 +00:00
|
|
|
rateType == other.rateType;
|
2022-10-03 15:41:53 +00:00
|
|
|
|
|
|
|
@override
|
2023-02-05 20:32:39 +00:00
|
|
|
int get hashCode => Object.hash(
|
|
|
|
exchangeName,
|
2022-10-03 15:41:53 +00:00
|
|
|
from,
|
|
|
|
to,
|
2023-02-06 14:43:16 +00:00
|
|
|
rateType,
|
2022-10-03 15:41:53 +00:00
|
|
|
);
|
|
|
|
|
|
|
|
@override
|
|
|
|
String toString() => "Pair: ${toMap()}";
|
2022-10-02 19:37:11 +00:00
|
|
|
}
|