import 'package:rasadyar_core/core.dart';

part 'user_local_model.g.dart';

@HiveType(typeId: authUserLocalModelTypeId)
class UserLocalModel extends HiveObject {
  @HiveField(0)
  String? username;
  @HiveField(1)
  String? password;
  @HiveField(2)
  String? token;
  @HiveField(3)
  String? refreshToken;
  @HiveField(5)
  Module? module;
  @HiveField(6)
  String? backend;

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

  UserLocalModel copyWith({
    String? username,
    String? password,
    String? token,
    String? refreshToken,
    Module? module,
    String? backend,
  }) {
    return UserLocalModel(
      username: username ?? this.username,
      password: password ?? this.password,
      token: token ?? this.token,
      refreshToken: refreshToken ?? this.refreshToken,
      module: module ?? this.module,
      backend: backend ?? this.backend,
    );
  }
}

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