/* 
 * 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
 *
 */

import 'package:hive/hive.dart';

part 'type_adaptors/epicbox_server_model.g.dart';

// @HiveType(typeId: 71)
class EpicBoxServerModel {
  // @HiveField(0)
  final String id;
  // @HiveField(1)
  final String host;
  // @HiveField(2)
  final int? port;
  // @HiveField(3)
  final String name;
  // @HiveField(4)
  final bool? useSSL;
  // @HiveField(5)
  final bool? enabled;
  // @HiveField(6)
  final bool? isFailover;
  // @HiveField(7)
  final bool? isDown;

  EpicBoxServerModel({
    required this.id,
    required this.host,
    this.port,
    required this.name,
    this.useSSL,
    this.enabled,
    this.isFailover,
    this.isDown,
  });

  EpicBoxServerModel copyWith({
    String? host,
    int? port,
    String? name,
    bool? useSSL,
    bool? enabled,
    bool? isFailover,
    bool? isDown,
  }) {
    return EpicBoxServerModel(
      id: id,
      host: host ?? this.host,
      port: port ?? this.port,
      name: name ?? this.name,
      useSSL: useSSL ?? this.useSSL,
      enabled: enabled ?? this.enabled,
      isFailover: isFailover ?? this.isFailover,
      isDown: isDown ?? this.isDown,
    );
  }

  Map<String, dynamic> toMap() {
    Map<String, dynamic> map = {};
    map['id'] = id;
    map['host'] = host;
    map['port'] = port;
    map['name'] = name;
    map['useSSL'] = useSSL;
    map['enabled'] = enabled;
    map['isFailover'] = isFailover;
    map['isDown'] = isDown;
    return map;
  }

  bool get isDefault => id.startsWith("default_");

  Map<String, dynamic> toJson() {
    return {
      'id': id,
      'host': host,
      'port': port,
      'name': name,
      'useSSL': useSSL,
      'enabled': enabled,
      'isFailover': isFailover,
      'isDown': isDown,
    };
  }
}