/* Options: Date: 2024-12-22 21:30:14 Version: 8.51 Tip: To override a DTO option, remove "//" prefix before updating BaseUrl: https://blazor-gallery.servicestack.net //GlobalNamespace: //AddServiceStackTypes: True //AddResponseStatus: False //AddImplicitVersion: //AddDescriptionAsComments: True IncludeTypes: CreateBooking.* //ExcludeTypes: //DefaultImports: package:servicestack/servicestack.dart,dart:typed_data */ import 'package:servicestack/servicestack.dart'; import 'dart:typed_data'; enum RoomType { Single, Double, Queen, Twin, Suite, } /** * Booking Details */ class Booking extends AuditBase implements IConvertible { int? id; String? name; RoomType? roomType; int? roomNumber; DateTime? bookingStartDate; DateTime? bookingEndDate; double? cost; // @References(typeof(Coupon)) String? couponId; Coupon? discount; String? notes; bool? cancelled; Booking({this.id,this.name,this.roomType,this.roomNumber,this.bookingStartDate,this.bookingEndDate,this.cost,this.couponId,this.discount,this.notes,this.cancelled}); Booking.fromJson(Map json) { fromMap(json); } fromMap(Map json) { super.fromMap(json); id = json['id']; name = json['name']; roomType = JsonConverters.fromJson(json['roomType'],'RoomType',context!); roomNumber = json['roomNumber']; bookingStartDate = JsonConverters.fromJson(json['bookingStartDate'],'DateTime',context!); bookingEndDate = JsonConverters.fromJson(json['bookingEndDate'],'DateTime',context!); cost = JsonConverters.toDouble(json['cost']); couponId = json['couponId']; discount = JsonConverters.fromJson(json['discount'],'Coupon',context!); notes = json['notes']; cancelled = json['cancelled']; return this; } Map toJson() => super.toJson()..addAll({ 'id': id, 'name': name, 'roomType': JsonConverters.toJson(roomType,'RoomType',context!), 'roomNumber': roomNumber, 'bookingStartDate': JsonConverters.toJson(bookingStartDate,'DateTime',context!), 'bookingEndDate': JsonConverters.toJson(bookingEndDate,'DateTime',context!), 'cost': cost, 'couponId': couponId, 'discount': JsonConverters.toJson(discount,'Coupon',context!), 'notes': notes, 'cancelled': cancelled }); getTypeName() => "Booking"; TypeContext? context = _ctx; } /** * Create a new Booking */ // @Route("/bookings", "POST") // @ValidateRequest(Validator="HasRole(`Employee`)") class CreateBooking implements IReturn, ICreateDb, IConvertible, IPost { /** * Name this Booking is for */ // @Validate(Validator="NotEmpty") String? name; String? photo; RoomType? roomType; // @Validate(Validator="GreaterThan(0)") int? roomNumber; // @Validate(Validator="GreaterThan(0)") double? cost; // @required() DateTime? bookingStartDate; DateTime? bookingEndDate; String? notes; String? couponId; CreateBooking({this.name,this.photo,this.roomType,this.roomNumber,this.cost,this.bookingStartDate,this.bookingEndDate,this.notes,this.couponId}); CreateBooking.fromJson(Map json) { fromMap(json); } fromMap(Map json) { name = json['name']; photo = json['photo']; roomType = JsonConverters.fromJson(json['roomType'],'RoomType',context!); roomNumber = json['roomNumber']; cost = JsonConverters.toDouble(json['cost']); bookingStartDate = JsonConverters.fromJson(json['bookingStartDate'],'DateTime',context!); bookingEndDate = JsonConverters.fromJson(json['bookingEndDate'],'DateTime',context!); notes = json['notes']; couponId = json['couponId']; return this; } Map toJson() => { 'name': name, 'photo': photo, 'roomType': JsonConverters.toJson(roomType,'RoomType',context!), 'roomNumber': roomNumber, 'cost': cost, 'bookingStartDate': JsonConverters.toJson(bookingStartDate,'DateTime',context!), 'bookingEndDate': JsonConverters.toJson(bookingEndDate,'DateTime',context!), 'notes': notes, 'couponId': couponId }; createResponse() => IdResponse(); getResponseTypeName() => "IdResponse"; getTypeName() => "CreateBooking"; TypeContext? context = _ctx; } TypeContext _ctx = TypeContext(library: 'blazor_gallery.servicestack.net', types: { 'RoomType': TypeInfo(TypeOf.Enum, enumValues:RoomType.values), 'Booking': TypeInfo(TypeOf.Class, create:() => Booking()), 'Coupon': TypeInfo(TypeOf.Class, create:() => Coupon()), 'CreateBooking': TypeInfo(TypeOf.Class, create:() => CreateBooking()), });