<commit_before>﻿using System;
using System.Collections.Generic;

namespace SilverScreen.Domain
{
	public class Booking : AggregateBase<BookingState>
	{
		public Booking(BookingState state) : base(state) { }
	}

	public class BookingState : State
	{
		public Guid BookableShowId { get; set; }

		public List<Seat> BookedSeats { get; set; }
	}
}<commit_msg>Ability to create a new booking<commit_after>﻿using System;
using System.Collections.Generic;
using Argentum.Core;

namespace SilverScreen.Domain
{
	public class Booking : AggregateBase<BookingState>
	{
		public Booking(BookingState state) : base(state) { }

		private Booking(Guid id, Guid bookableShowId, List<Seat> bookedSeats, DateTime created)
		{
			Apply(new BookingCreated(id, bookableShowId, bookedSeats, created));
		}

		public static Booking Create(Guid bookableShowId, List<Seat> bookedSeats)
		{
			return new Booking(Guid.NewGuid(), bookableShowId, bookedSeats, DateTime.UtcNow);
		}
	}

	public class BookingState : State
	{
		public Guid BookableShowId { get; set; }

		public List<Seat> BookedSeats { get; set; }
		
		public DateTime Created { get; set; }

		public void When(BookingCreated evt)
		{
			Id = evt.Id;
			BookableShowId = evt.BookableShowId;
			BookedSeats = evt.BookedSeats;
			Created = evt.Created;
		}
	}

	public class BookingCreated : IEvent
	{
		public Guid Id { get; private set; }
		public Guid BookableShowId { get; private set; }
		public List<Seat> BookedSeats { get; private set; }
		public DateTime Created { get; private set; }

		public BookingCreated(Guid id, Guid bookableShowId, List<Seat> bookedSeats, DateTime created)
		{
			Id = id;
			BookableShowId = bookableShowId;
			BookedSeats = bookedSeats;
			Created = created;
		}
	}
}
{'fraction_non_alphanumeric': 0.09545715928694652, 'fraction_numerical': 0.0, 'mean_word_length': 4.304878048780488, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1770273', 'n_tokens_mistral': 643, 'n_tokens_neox': 579, 'n_words': 152}