/// Created by @Haoyi on 2020/12/4
///

part of "app_property.dart";

class PropertyUsage {
  static const int general = 0;
  static const int setting = 1;
}

class PropertyKey {
  static const defaultGroup = "guru";

  final String name;
  final String group;
  final String tag;
  final int usage;

  final String key;

  const PropertyKey.general(this.name, {this.group = defaultGroup, this.tag = ''})
      : key = "$group@$name",
        usage = PropertyUsage.general;

  const PropertyKey.setting(this.name, {this.group = defaultGroup, this.tag = ''})
      : key = "$group@$name",
        usage = PropertyUsage.setting;

  const PropertyKey(
      {required this.name, required this.usage, required this.group, required this.tag})
      : key = "$group@$name";

  @override
  bool operator ==(Object other) =>
      identical(this, other) ||
      other is PropertyKey &&
          runtimeType == other.runtimeType &&
          name == other.name &&
          group == other.group &&
          tag == other.tag &&
          usage == other.usage &&
          key == other.key;

  @override
  int get hashCode => name.hashCode ^ group.hashCode ^ tag.hashCode ^ usage.hashCode ^ key.hashCode;

  @override
  String toString() {
    return '#$tag#[$key]($usage)';
  }
}
