// TODO - I have the feeling this file is outdated and not used anymore
import 'package:anyway/domain/entities/landmark.dart';
import 'package:anyway/domain/entities/landmark_description.dart';
import 'package:anyway/domain/entities/landmark_type.dart';
import 'package:freezed_annotation/freezed_annotation.dart';
part 'landmark_model.freezed.dart';
part 'landmark_model.g.dart';

@freezed
abstract class LandmarkModel with _$LandmarkModel {
  const factory LandmarkModel({
    required String uuid,
    required String name,
    required List<double> location,
    required String type,
    required bool isSecondary,
    required String description,
  }) = _LandmarkModel;

  const LandmarkModel._();

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

  Landmark toEntity() => Landmark(
    uuid: uuid,
    name: name,
    location: location,
    type: LandmarkType(type: LandmarkTypeEnum.values.firstWhere((e) => e.value == type)),
    isSecondary: isSecondary,
    description: LandmarkDescription(description: description, tags: []),
  );
}
