// ignore_for_file: non_constant_identifier_names, avoid_init_to_null

import 'package:dart_framework/utils/slack/slack_sender.dart';
import 'package:json_annotation/json_annotation.dart';
import 'package:oto/oto/data/base_data.dart';
import 'package:oto/oto/utils/mattermost/mattermost_sender.dart';

part 'notification_data.g.dart';

//Slack
@JsonSerializable()
class DataSlackSender extends DataParam {
  DataSlackSender();

  late String token;
  late dynamic property; // object created internally by oto
  late Map<String, dynamic>? message; // value declared in YAML
  late String? messageJson; // value declared as JSON string
  late Map<String, String>? idMap;

  factory DataSlackSender.fromJson(Map<String, dynamic> json) =>
      _$DataSlackSenderFromJson(json);
  @override
  Map<String, dynamic> toJson() => _$DataSlackSenderToJson(this);
}

//Slack File
@JsonSerializable()
class DataSlackFile extends DataParam {
  DataSlackFile();

  late String token;
  late String channel;
  late String filePath;
  late String? title;
  late String? initialComment;
  late String? fileName;
  late String? mimeType;

  factory DataSlackFile.fromJson(Map<String, dynamic> json) =>
      _$DataSlackFileFromJson(json);
  @override
  Map<String, dynamic> toJson() => _$DataSlackFileToJson(this);
}

//Slack Build
@JsonSerializable()
class DataSlackBuild extends DataSlackSender {
  DataSlackBuild();

  late String appName;
  late SlackBuildType type;
  late String color;
  late String version;
  late String downloadURL;
  late String? channel;

  factory DataSlackBuild.fromJson(Map<String, dynamic> json) =>
      _$DataSlackBuildFromJson(json);
  @override
  Map<String, dynamic> toJson() => _$DataSlackBuildToJson(this);
}

//Mattermost
@JsonSerializable()
class DataMattermostSender extends DataParam {
  DataMattermostSender();

  late String token;
  late String url;
  late String? channelId;
  late dynamic property;
  late Map<String, dynamic>? message;
  late String? messageJson;
  late Map<String, String>? idMap;

  factory DataMattermostSender.fromJson(Map<String, dynamic> json) =>
      _$DataMattermostSenderFromJson(json);
  @override
  Map<String, dynamic> toJson() => _$DataMattermostSenderToJson(this);
}

//Mattermost Build
@JsonSerializable()
class DataMattermostBuild extends DataMattermostSender {
  DataMattermostBuild();

  late String appName;
  late MattermostBuildType type;
  late String color;
  late String version;
  late String downloadURL;

  factory DataMattermostBuild.fromJson(Map<String, dynamic> json) =>
      _$DataMattermostBuildFromJson(json);
  @override
  Map<String, dynamic> toJson() => _$DataMattermostBuildToJson(this);
}
