/* Options: Date: 2025-12-23 15:16:11 Version: 10.04 Tip: To override a DTO option, remove "//" prefix before updating BaseUrl: https://vue-spa.web-templates.io //GlobalNamespace: //AddServiceStackTypes: True //AddResponseStatus: False //AddImplicitVersion: //AddDescriptionAsComments: True IncludeTypes: UpdateBooking.* //ExcludeTypes: //DefaultImports: package:servicestack/servicestack.dart */ import 'package:servicestack/servicestack.dart'; enum RoomType { Single, Double, Queen, Twin, Suite, } /** * Booking Details */ class Booking extends AuditBase implements IConvertible { int id = 0; String name = ""; RoomType roomType; int roomNumber = 0; DateTime bookingStartDate = DateTime(0); DateTime? bookingEndDate; double cost = 0; String? notes; bool? cancelled; User employee; Booking({this.id,this.name,this.roomType,this.roomNumber,this.bookingStartDate,this.bookingEndDate,this.cost,this.notes,this.cancelled,this.employee}); 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']); notes = json['notes']; cancelled = json['cancelled']; employee = JsonConverters.fromJson(json['employee'],'User',context!); 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, 'notes': notes, 'cancelled': cancelled, 'employee': JsonConverters.toJson(employee,'User',context!) }); getTypeName() => "Booking"; TypeContext? context = _ctx; } // @ValidateRequest(Validator="HasRole(`Employee`)") class UpdateBooking implements IReturn, IPatchDb, IConvertible, IPatch { int id = 0; String? name; RoomType? roomType; // @Validate(Validator="GreaterThan(0)") int? roomNumber; DateTime? bookingStartDate; DateTime? bookingEndDate; // @Validate(Validator="GreaterThan(0)") double? cost; String? notes; bool? cancelled; UpdateBooking({this.id,this.name,this.roomType,this.roomNumber,this.bookingStartDate,this.bookingEndDate,this.cost,this.notes,this.cancelled}); UpdateBooking.fromJson(Map json) { fromMap(json); } fromMap(Map 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']); notes = json['notes']; cancelled = json['cancelled']; return this; } Map toJson() => { '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, 'notes': notes, 'cancelled': cancelled }; createResponse() => IdResponse(); getResponseTypeName() => "IdResponse"; getTypeName() => "UpdateBooking"; TypeContext? context = _ctx; } TypeContext _ctx = TypeContext(library: 'vue_spa.web_templates.io', types: { 'RoomType': TypeInfo(TypeOf.Enum, enumValues:RoomType.values), 'Booking': TypeInfo(TypeOf.Class, create:() => Booking()), 'User': TypeInfo(TypeOf.Class, create:() => User()), 'UpdateBooking': TypeInfo(TypeOf.Class, create:() => UpdateBooking()), });