import 'package:json_annotation/json_annotation.dart';

part 'job_handwriting.g.dart';

@JsonSerializable()
class JobHandwriting extends Object {
  @JsonKey(name: 'lattices')
  List<Lattices> lattices;

  @JsonKey(name: 'paperPicture')
  String paperPicture;

  @JsonKey(name: 'pageNum')
  int pageNum;

  @JsonKey(name: 'pageCount')
  int pageCount;

  JobHandwriting(this.lattices, this.paperPicture, this.pageNum, this.pageCount);

  factory JobHandwriting.fromJson(Map<String, dynamic> srcJson) => _$JobHandwritingFromJson(srcJson);

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

@JsonSerializable()
class Lattices extends Object {
  @JsonKey(name: 'stroke')
  int stroke;

  @JsonKey(name: 'x')
  double x;

  @JsonKey(name: 'y')
  double y;

  @JsonKey(name: 'time')
  int time;

  @JsonKey(name: 'intervalTime')
  int intervalTime;

  Lattices(this.stroke, this.x, this.y, this.time, [this.intervalTime = 0]);

  factory Lattices.fromJson(Map<String, dynamic> srcJson) => _$LatticesFromJson(srcJson);

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