Files
Backend-Api/0_Framework/Domain/CustomizeCheckoutShared/ValueObjects/BreakTime.cs

43 lines
1.1 KiB
C#

using System;
using _0_Framework.Domain.CustomizeCheckoutShared.Enums;
namespace _0_Framework.Domain.CustomizeCheckoutShared.ValueObjects;
public record BreakTime
{
public BreakTime()
{
}
public BreakTime(bool hasBreakTimeValue, TimeOnly breakTimeValue)
{
HasBreakTimeValue = hasBreakTimeValue;
if (hasBreakTimeValue)
{
if (breakTimeValue == new TimeOnly())
{
BreakTimeValue = breakTimeValue;
BreakTimeType = BreakTimeType.WithoutTime;
}
else
{
BreakTimeType = BreakTimeType.WithTime;
BreakTimeValue = breakTimeValue;
}
HasBreakTimeValue = true;
}
else
{
BreakTimeType = BreakTimeType.None;
BreakTimeValue = new TimeOnly();
HasBreakTimeValue = false;
}
}
public bool HasBreakTimeValue { get; set; }
public BreakTimeType BreakTimeType { get; private set; }
public TimeOnly BreakTimeValue { get; set; }
}