422 lines
12 KiB
Dart
422 lines
12 KiB
Dart
class HomeModel {
|
|
final City? city;
|
|
final List<Attraction>? attraction;
|
|
|
|
HomeModel({
|
|
this.city,
|
|
this.attraction,
|
|
});
|
|
|
|
factory HomeModel.fromJson(Map<String, dynamic> json) {
|
|
return HomeModel(
|
|
city: json['city'] != null ? City.fromJson(json['city']) : null,
|
|
attraction: json['attraction'] != null
|
|
? List<Attraction>.from(
|
|
json['attraction'].map((x) => Attraction.fromJson(x)),
|
|
)
|
|
: [],
|
|
);
|
|
}
|
|
}
|
|
|
|
/* -------------------------------------------------------------------------- */
|
|
/* CITY */
|
|
/* -------------------------------------------------------------------------- */
|
|
|
|
class City {
|
|
final int id;
|
|
final String cityName;
|
|
final String urlSlug;
|
|
final String tagLine;
|
|
final String cityIconPath;
|
|
final String description;
|
|
final String metaTitle;
|
|
final String metaDescription;
|
|
final String bestTimeToVisit;
|
|
final String priceRange;
|
|
final int indivisualTicketAmt;
|
|
final int cityCardTicketAmt;
|
|
final String seoTitle;
|
|
final String seoDescription;
|
|
final int displayOrder;
|
|
final bool isActive;
|
|
final String createdAt;
|
|
final String updatedAt;
|
|
final List<CityBanner> cityBanners;
|
|
final List<CardModel> cards;
|
|
final List<CityFeatureCard> cityFeatureCards;
|
|
final List<CityHighlight> cityHighlights;
|
|
|
|
City({
|
|
required this.id,
|
|
required this.cityName,
|
|
required this.urlSlug,
|
|
required this.tagLine,
|
|
required this.cityIconPath,
|
|
required this.description,
|
|
required this.metaTitle,
|
|
required this.metaDescription,
|
|
required this.bestTimeToVisit,
|
|
required this.priceRange,
|
|
required this.indivisualTicketAmt,
|
|
required this.cityCardTicketAmt,
|
|
required this.seoTitle,
|
|
required this.seoDescription,
|
|
required this.displayOrder,
|
|
required this.isActive,
|
|
required this.createdAt,
|
|
required this.updatedAt,
|
|
required this.cityBanners,
|
|
required this.cards,
|
|
required this.cityFeatureCards,
|
|
required this.cityHighlights,
|
|
});
|
|
|
|
factory City.fromJson(Map<String, dynamic> json) {
|
|
return City(
|
|
id: json['id'] ?? 0,
|
|
cityName: json['cityName'] ?? 'N/A',
|
|
urlSlug: json['urlSlug'] ?? 'N/A',
|
|
tagLine: json['tagLine'] ?? 'N/A',
|
|
cityIconPath: json['cityIconPath'] ?? 'N/A',
|
|
description: json['description'] ?? 'N/A',
|
|
metaTitle: json['metaTitle'] ?? 'N/A',
|
|
metaDescription: json['metaDescription'] ?? 'N/A',
|
|
bestTimeToVisit: json['bestTimeToVisit'] ?? 'N/A',
|
|
priceRange: json['priceRange'] ?? 'N/A',
|
|
indivisualTicketAmt: json['indivisualTicketAmt'] ?? 0,
|
|
cityCardTicketAmt: json['cityCardTicketAmt'] ?? 0,
|
|
seoTitle: json['seoTitle'] ?? 'N/A',
|
|
seoDescription: json['seoDescription'] ?? 'N/A',
|
|
displayOrder: json['displayOrder'] ?? 0,
|
|
isActive: json['isActive'] ?? false,
|
|
createdAt: json['createdAt'] ?? 'N/A',
|
|
updatedAt: json['updatedAt'] ?? 'N/A',
|
|
cityBanners: json['cityBanners'] != null
|
|
? List<CityBanner>.from(
|
|
json['cityBanners'].map((x) => CityBanner.fromJson(x)),
|
|
)
|
|
: [],
|
|
cards: json['cards'] != null
|
|
? List<CardModel>.from(
|
|
json['cards'].map((x) => CardModel.fromJson(x)),
|
|
)
|
|
: [],
|
|
cityFeatureCards: json['cityFeatureCards'] != null
|
|
? List<CityFeatureCard>.from(
|
|
json['cityFeatureCards'].map((x) => CityFeatureCard.fromJson(x)),
|
|
)
|
|
: [],
|
|
cityHighlights: json['cityHighlights'] != null
|
|
? List<CityHighlight>.from(
|
|
json['cityHighlights'].map((x) => CityHighlight.fromJson(x)),
|
|
)
|
|
: [],
|
|
);
|
|
}
|
|
}
|
|
|
|
/* -------------------------------------------------------------------------- */
|
|
/* CITY BANNER */
|
|
/* -------------------------------------------------------------------------- */
|
|
|
|
class CityBanner {
|
|
final int id;
|
|
final int cityXid;
|
|
final String title;
|
|
final String highlightWord;
|
|
final String description;
|
|
final String imageFilePath;
|
|
final String ctaLabel;
|
|
final String ctaUrl;
|
|
final bool isActive;
|
|
final String createdAt;
|
|
final String updatedAt;
|
|
|
|
CityBanner({
|
|
required this.id,
|
|
required this.cityXid,
|
|
required this.title,
|
|
required this.highlightWord,
|
|
required this.description,
|
|
required this.imageFilePath,
|
|
required this.ctaLabel,
|
|
required this.ctaUrl,
|
|
required this.isActive,
|
|
required this.createdAt,
|
|
required this.updatedAt,
|
|
});
|
|
|
|
factory CityBanner.fromJson(Map<String, dynamic> json) {
|
|
return CityBanner(
|
|
id: json['id'] ?? 0,
|
|
cityXid: json['cityXid'] ?? 0,
|
|
title: json['title'] ?? 'N/A',
|
|
highlightWord: json['highlightWord'] ?? 'N/A',
|
|
description: json['description'] ?? 'N/A',
|
|
imageFilePath: json['imageFilePath'] ?? 'N/A',
|
|
ctaLabel: json['ctaLabel'] ?? 'N/A',
|
|
ctaUrl: json['ctaUrl'] ?? 'N/A',
|
|
isActive: json['isActive'] ?? false,
|
|
createdAt: json['createdAt'] ?? 'N/A',
|
|
updatedAt: json['updatedAt'] ?? 'N/A',
|
|
);
|
|
}
|
|
}
|
|
|
|
/* -------------------------------------------------------------------------- */
|
|
/* CARD */
|
|
/* -------------------------------------------------------------------------- */
|
|
|
|
class CardModel {
|
|
final int id;
|
|
final int cityXid;
|
|
final String title;
|
|
final String description;
|
|
final int cardTypeXid;
|
|
final int minNumber;
|
|
final int maxNumber;
|
|
final int validityDuration;
|
|
final bool isMultiplyEntry;
|
|
final int adultPrice;
|
|
final int childPrice;
|
|
final String cardStatus;
|
|
final bool isActive;
|
|
final String createdAt;
|
|
final String updatedAt;
|
|
|
|
CardModel({
|
|
required this.id,
|
|
required this.cityXid,
|
|
required this.title,
|
|
required this.description,
|
|
required this.cardTypeXid,
|
|
required this.minNumber,
|
|
required this.maxNumber,
|
|
required this.validityDuration,
|
|
required this.isMultiplyEntry,
|
|
required this.adultPrice,
|
|
required this.childPrice,
|
|
required this.cardStatus,
|
|
required this.isActive,
|
|
required this.createdAt,
|
|
required this.updatedAt,
|
|
});
|
|
|
|
factory CardModel.fromJson(Map<String, dynamic> json) {
|
|
return CardModel(
|
|
id: json['id'] ?? 0,
|
|
cityXid: json['cityXid'] ?? 0,
|
|
title: json['title'] ?? 'N/A',
|
|
description: json['description'] ?? 'N/A',
|
|
cardTypeXid: json['cardTypeXid'] ?? 0,
|
|
minNumber: json['minNumber'] ?? 0,
|
|
maxNumber: json['maxNumber'] ?? 0,
|
|
validityDuration: json['validityDuration'] ?? 0,
|
|
isMultiplyEntry: json['isMultiplyEntry'] ?? false,
|
|
adultPrice: json['adultPrice'] ?? 0,
|
|
childPrice: json['childPrice'] ?? 0,
|
|
cardStatus: json['cardStatus'] ?? 'N/A',
|
|
isActive: json['isActive'] ?? false,
|
|
createdAt: json['createdAt'] ?? 'N/A',
|
|
updatedAt: json['updatedAt'] ?? 'N/A',
|
|
);
|
|
}
|
|
}
|
|
|
|
/* -------------------------------------------------------------------------- */
|
|
/* CITY FEATURE CARD */
|
|
/* -------------------------------------------------------------------------- */
|
|
|
|
class CityFeatureCard {
|
|
final int id;
|
|
final String title;
|
|
final String description;
|
|
final FeatureCardIcon? icon; // ← CHANGED: Now uses FeatureCardIcon object
|
|
|
|
CityFeatureCard({
|
|
required this.id,
|
|
required this.title,
|
|
required this.description,
|
|
this.icon, // ← CHANGED: Now nullable
|
|
});
|
|
|
|
factory CityFeatureCard.fromJson(Map<String, dynamic> json) {
|
|
return CityFeatureCard(
|
|
id: json['id'] ?? 0,
|
|
title: json['title'] ?? 'N/A',
|
|
description: json['description'] ?? 'N/A',
|
|
icon: json['icon'] != null
|
|
? FeatureCardIcon.fromJson(json['icon']) // ← CHANGED: Parse as object
|
|
: null,
|
|
);
|
|
}
|
|
}
|
|
|
|
/* -------------------------------------------------------------------------- */
|
|
/* FEATURE CARD ICON */
|
|
/* -------------------------------------------------------------------------- */
|
|
|
|
class FeatureCardIcon {
|
|
final int id;
|
|
final String iconName;
|
|
final String iconSvg;
|
|
|
|
FeatureCardIcon({
|
|
required this.id,
|
|
required this.iconName,
|
|
required this.iconSvg,
|
|
});
|
|
|
|
factory FeatureCardIcon.fromJson(Map<String, dynamic> json) {
|
|
return FeatureCardIcon(
|
|
id: json['id'] ?? 0,
|
|
iconName: json['iconName'] ?? 'N/A',
|
|
iconSvg: json['iconSvg'] ?? 'N/A',
|
|
);
|
|
}
|
|
}
|
|
|
|
/* -------------------------------------------------------------------------- */
|
|
/* CITY HIGHLIGHTS */
|
|
/* -------------------------------------------------------------------------- */
|
|
|
|
class CityHighlight {
|
|
final int id;
|
|
final int cityXid;
|
|
final String title;
|
|
final int iconXid;
|
|
final bool isActive;
|
|
final String createdAt;
|
|
final String updatedAt;
|
|
final CityHighlightIcon? icon;
|
|
|
|
CityHighlight({
|
|
required this.id,
|
|
required this.cityXid,
|
|
required this.title,
|
|
required this.iconXid,
|
|
required this.isActive,
|
|
required this.createdAt,
|
|
required this.updatedAt,
|
|
this.icon,
|
|
});
|
|
|
|
factory CityHighlight.fromJson(Map<String, dynamic> json) {
|
|
return CityHighlight(
|
|
id: json['id'] ?? 0,
|
|
cityXid: json['cityXid'] ?? 0,
|
|
title: json['title'] ?? 'N/A',
|
|
iconXid: json['iconXid'] ?? 0,
|
|
isActive: json['isActive'] ?? false,
|
|
createdAt: json['createdAt'] ?? 'N/A',
|
|
updatedAt: json['updatedAt'] ?? 'N/A',
|
|
icon: json['icon'] != null ? CityHighlightIcon.fromJson(json['icon']) : null,
|
|
);
|
|
}
|
|
}
|
|
|
|
class CityHighlightIcon {
|
|
final int id;
|
|
final String iconName;
|
|
final String iconSvg;
|
|
final bool isActive;
|
|
final String createdAt;
|
|
final String updatedAt;
|
|
|
|
CityHighlightIcon({
|
|
required this.id,
|
|
required this.iconName,
|
|
required this.iconSvg,
|
|
required this.isActive,
|
|
required this.createdAt,
|
|
required this.updatedAt,
|
|
});
|
|
|
|
factory CityHighlightIcon.fromJson(Map<String, dynamic> json) {
|
|
return CityHighlightIcon(
|
|
id: json['id'] ?? 0,
|
|
iconName: json['iconName'] ?? 'N/A',
|
|
iconSvg: json['iconSvg'] ?? 'N/A',
|
|
isActive: json['isActive'] ?? false,
|
|
createdAt: json['createdAt'] ?? 'N/A',
|
|
updatedAt: json['updatedAt'] ?? 'N/A',
|
|
);
|
|
}
|
|
}
|
|
|
|
/* -------------------------------------------------------------------------- */
|
|
/* ATTRACTION */
|
|
/* -------------------------------------------------------------------------- */
|
|
|
|
class Attraction {
|
|
final int id;
|
|
final String title;
|
|
final String description;
|
|
final String urlSlug;
|
|
final List<AttractionGallery> attractionGalleries;
|
|
|
|
Attraction({
|
|
required this.id,
|
|
required this.title,
|
|
required this.description,
|
|
required this.urlSlug,
|
|
required this.attractionGalleries,
|
|
});
|
|
|
|
factory Attraction.fromJson(Map<String, dynamic> json) {
|
|
return Attraction(
|
|
id: json['id'] ?? 0,
|
|
title: json['title'] ?? 'N/A',
|
|
description: json['description'] ?? 'N/A',
|
|
urlSlug: json['urlSlug'] ?? 'N/A',
|
|
attractionGalleries: json['attractionGalleries'] != null
|
|
? List<AttractionGallery>.from(
|
|
json['attractionGalleries'].map((x) => AttractionGallery.fromJson(x)),
|
|
)
|
|
: [],
|
|
);
|
|
}
|
|
}
|
|
|
|
/* -------------------------------------------------------------------------- */
|
|
/* ATTRACTION GALLERY */
|
|
/* -------------------------------------------------------------------------- */
|
|
|
|
class AttractionGallery {
|
|
final int id;
|
|
final int attractionXid;
|
|
final String fileType;
|
|
final String filePathUrl;
|
|
final String altText;
|
|
final bool isCoverImage;
|
|
final bool isActive;
|
|
final String createdAt;
|
|
final String updatedAt;
|
|
|
|
AttractionGallery({
|
|
required this.id,
|
|
required this.attractionXid,
|
|
required this.fileType,
|
|
required this.filePathUrl,
|
|
required this.altText,
|
|
required this.isCoverImage,
|
|
required this.isActive,
|
|
required this.createdAt,
|
|
required this.updatedAt,
|
|
});
|
|
|
|
factory AttractionGallery.fromJson(Map<String, dynamic> json) {
|
|
return AttractionGallery(
|
|
id: json['id'] ?? 0,
|
|
attractionXid: json['attractionXid'] ?? 0,
|
|
fileType: json['fileType'] ?? 'N/A',
|
|
filePathUrl: json['filePathUrl'] ?? 'N/A',
|
|
altText: json['altText'] ?? 'N/A',
|
|
isCoverImage: json['isCoverImage'] ?? false,
|
|
isActive: json['isActive'] ?? false,
|
|
createdAt: json['createdAt'] ?? 'N/A',
|
|
updatedAt: json['updatedAt'] ?? 'N/A',
|
|
);
|
|
}
|
|
} |