import 'package:json_annotation/json_annotation.dart';

import '../global/utils.dart';

part 'tag.g.dart';

enum TagType {
  note,
}

@JsonSerializable()
class Tag {
  const Tag({
    this.id,
    required this.familyId,
    required this.createdByUserId,
    required this.name,
    required this.type,
    this.createdAt,
    this.updatedAt,
    this.hide = false,
  });

  final int? id;
  final int familyId, createdByUserId;
  final String name;
  final TagType type;

  @JsonKey(fromJson: boolFromJson, toJson: boolToJson)
  final bool hide;

  @JsonKey(fromJson: dateFromJson, toJson: dateToJson)
  final DateTime? createdAt;

  @JsonKey(fromJson: dateFromJson, toJson: dateToJson)
  final DateTime? updatedAt;

  factory Tag.fromJson(Map<String, dynamic> json) => _$TagFromJson(json);

  Map<String, dynamic> toJson() => _$TagToJson(this);
}
