#nullable enable
using System;
namespace UVC.UIToolkit
{
///
/// 날짜시간 범위 속성 데이터 클래스입니다.
/// UI는 UTKDateTimeRangePropertyItemView에서 담당합니다.
///
public class UTKDateTimeRangePropertyItem : UTKPropertyItemBase
{
#region Fields
private string _dateTimeFormat = "yyyy-MM-dd HH:mm";
#endregion
#region Properties
/// 속성 타입
public override UTKPropertyType PropertyType => UTKPropertyType.DateTimeRange;
/// 날짜시간 표시 형식
public string DateTimeFormat
{
get => _dateTimeFormat;
set => _dateTimeFormat = value ?? "yyyy-MM-dd HH:mm";
}
#endregion
#region Constructor
///
/// 날짜시간 범위 속성을 생성합니다.
///
/// 고유 ID
/// 표시 이름
/// 초기 범위 값
/// 읽기 전용 여부
/// 라벨 표시 여부
public UTKDateTimeRangePropertyItem(string id, string name, UTKDateTimeRange initialValue = default, bool isReadOnly = false, bool showLabel = true)
: base(id, name, initialValue.Start == default ? new UTKDateTimeRange(DateTime.Now, DateTime.Now) : initialValue)
{
_isReadOnly = isReadOnly;
_showLabel = showLabel;
}
///
/// 날짜시간 범위 속성을 생성합니다.
///
/// 고유 ID
/// 표시 이름
/// 시작 날짜시간
/// 종료 날짜시간
/// 읽기 전용 여부
public UTKDateTimeRangePropertyItem(string id, string name, DateTime start, DateTime end, bool isReadOnly = false, bool showLabel = true)
: base(id, name, new UTKDateTimeRange(start, end))
{
_isReadOnly = isReadOnly;
_showLabel = showLabel;
}
#endregion
}
}