using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using SpirvNet.Spirv.Enums;

// This file is auto-generated and should not be modified manually.

namespace SpirvNet.Spirv.Ops.Pipe
{
    /// <summary>
    /// OpIsValidReserveId
    /// 
    /// Return true if reserve_id is a valid reservation ID and false otherwise.
    /// 
    /// reserve_id must be a OpTypeReserveId.
    /// 
    /// Result Type must be a OpTypeBool.
    /// </summary>
    [DependsOn(LanguageCapability.Kernel)]
    public sealed class OpIsValidReserveId : PipeInstruction
    {
        public override bool IsPipe => true;
        public override OpCode OpCode => OpCode.IsValidReserveId;
        public override ID? ResultID => Result;
        public override ID? ResultTypeID => ResultType;

        public ID ResultType;
        public ID Result;
        public ID Reserve_id;

        #region Code
        public override string ToString() => "(" + OpCode + "(" + (int)OpCode + ")" + ", " + StrOf(ResultType) + ", " + StrOf(Result) + ", " + StrOf(Reserve_id) + ")";
        public override string ArgString => "Reserve_id: " + StrOf(Reserve_id);

        protected override void FromCode(uint[] codes, int start)
        {
            System.Diagnostics.Debug.Assert((codes[start] & 0x0000FFFF) == (uint)OpCode.IsValidReserveId);
            var i = start + 1;
            ResultType = new ID(codes[i++]);
            Result = new ID(codes[i++]);
            Reserve_id = new ID(codes[i++]);
        }

        protected override void WriteCode(List<uint> code)
        {
            code.Add(ResultType.Value);
            code.Add(Result.Value);
            code.Add(Reserve_id.Value);
        }

        public override IEnumerable<ID> AllIDs
        {
            get
            {
                yield return ResultType;
                yield return Result;
                yield return Reserve_id;
            }
        }
        #endregion
    }
}
