import 'package:json_annotation/json_annotation.dart';
import 'package:krow/core/data/models/event/skill.dart';

part 'business_skill_model.g.dart';

@JsonSerializable(fieldRename: FieldRename.snake)
class BusinessSkillModel {
  final String? id;
  final Skill? skill;
  final double? price;
  final bool? isActive;

  BusinessSkillModel({
    required this.id,
    required this.skill,
     this.price = 0,
     this.isActive = true,
  });

  factory BusinessSkillModel.fromJson(Map<String, dynamic> json) {
    try {
      return _$BusinessSkillModelFromJson(json);
    } catch (e) {
      return BusinessSkillModel(
        id: '',
        skill: null,
        price: 0.0,
        isActive: false,
      );
    }
  }

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