import 'package:json_annotation/json_annotation.dart';

part 'option_select_item.g.dart';

/// 选项选择实体类
@JsonSerializable()
class OptionSelectItem {
  // 名称，只用来渲染
  @JsonKey(name: 'name')
  String name;

  // 数据，用来提交给服务端的数据
  @JsonKey(name: 'value')
  String value;

  // 是否选中
  @JsonKey(name: 'selected')
  bool selected;

  OptionSelectItem(this.name, this.value, {this.selected = false});

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

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