import 'package:json_annotation/json_annotation.dart';
import 'directional_screen.dart';

part 'button_config_model.g.dart';
@JsonSerializable()
class ButtonConfigModel {
  final String? text;
  final String? color;
  @JsonKey(name: "click_action_type")
  final String? clickActionType;
  @JsonKey(name: "click_action_param")
  final String? clickActionParam;
  final bool? hiden;

  ButtonConfigModel({
    this.text,
    this.color,
    this.clickActionType,
    this.clickActionParam,
    this.hiden,
  });

  factory ButtonConfigModel.fromJson(Map<String, dynamic> json) => _$ButtonConfigModelFromJson(json);
  Map<String, dynamic> toJson() => _$ButtonConfigModelToJson(this);

  DirectionalScreen? get directionScreen {
    if (clickActionType != null || clickActionParam != null) {
      return DirectionalScreen(
        clickActionType: clickActionType,
        clickActionParam: clickActionParam,
      );
    }
    return null;
  }
}
