namespace PARR.API.Contracts.V1.Requests
{
    public record JobRequest
    {

        public required Guid TnkId { get; init; }

        public required Guid GroupId { get; init; }

        public required string Name { get; init; }

        //public int? MinValueRelationships { get; init; }

        //public int? MaxValueRelationships { get; init; }

        //public bool? IsParentRelationships { get; init; }

        public JobRelationships? Relationships { get; init; }

        public required string TemplateNameMask { get; init; }

        public required string WorkGroupMask { get; init; }

        public required string WorkName { get; init; }

        public required string ResponseAreaMask { get; init; }

        //#region AutoControl

        //public bool IsEnableAutoControl { get; set; }

        //public bool InitUsedTemplateState { get; set; }

        //public bool InitUsedScheduleState { get; set; }

        //#endregion

        public JobAutoControlRequest? AutoControl { get; init; }

        public required List<UnitFilterRequest> UnitFilters { get; init; }
    }

    public record JobRelationships
    {
        public int MinValueRelationships { get; init; }

        public int MaxValueRelationships { get; init; }

        public bool IsParentRelationships { get; init; }
    }

    public record UnitFilterRequest
    {
        ///// <summary>
        ///// Id = null в методе Create, в Update обязателен
        ///// </summary>
        //public Guid? Id { get; set; }

        public required string UnitFilterMask { get; init; }

        public List<FieldFilterRequest>? FieldFilters { get; init; }

        public List<RelationshipFilterRequest>? RelationshipFilters { get; init; }
    }


    public record FieldFilterRequest
    {

        public Guid FieldId { get; init; }

        public string? ValueMask { get; init; }

        public bool IsInverse { get; init; } = false;

    }


    public record RelationshipFilterRequest
    {
        public Guid FieldId { get; init; }

        public bool? IsParent { get; init; }

        public string? ValueMask { get; init; }

        public bool? IsFullMatch { get; init; }

        public bool? IsInverse { get; init; }
    }
}