import 'package:rasadyar_auth/auth.dart';
import 'package:rasadyar_core/core.dart';

part 'user_local_model.g.dart';

@HiveType(typeId: 0)
class UserLocalModel extends HiveObject {
  @HiveField(0)
  String? username;
  @HiveField(1)
  String? password;
  @HiveField(2)
  String? token;
  @HiveField(3)
  String? refreshToken;
  @HiveField(4)
  String? name;

  @HiveField(5)
  Module? module;

  @HiveField(6)
  String? backend;

  @HiveField(7)
  String? apiKey;

  UserLocalModel({
    this.username,
    this.password,
    this.token,
    this.refreshToken,
    this.name,
    this.module,
    this.backend,
    this.apiKey,
  });

  UserLocalModel copyWith({
    String? username,
    String? password,
    String? token,
    String? refreshToken,
    String? name,
    Module? module,
    String? backend,
    String? apiKey,

  }) {
    return UserLocalModel(
      username: username ?? this.username,
      password: password ?? this.password,
      token: token ?? this.token,
      refreshToken: refreshToken ?? this.refreshToken,
      name: name ?? this.name,
      module: module ?? this.module,
      backend: backend ?? this.backend,
      apiKey: apiKey ?? this.apiKey,
    );
  }
}

@HiveType(typeId: 1)
enum Module {
  @HiveField(0)
  liveStocks,
  @HiveField(1)
  inspection,
  @HiveField(2)
  chicken,
}
