Skip to content

Commit

Permalink
Changed Status to enum
Browse files Browse the repository at this point in the history
  • Loading branch information
nm.suvorov committed Sep 2, 2024
1 parent 262b9c1 commit 8f23fa6
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 8 deletions.
9 changes: 8 additions & 1 deletion proto/PowersOfAttorney/PowerOfAttorneyValidation.proto
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,14 @@ message ValidationProtocol {
}

message ValidationCheckResult {
required string Status = 1;
required PowerOfAttorneyValidationCheckStatus Status = 1;
required string Name = 2;
optional PowerOfAttorneyValidationError Error = 3;
}

enum PowerOfAttorneyValidationCheckStatus {
UnknownCheckStatus = 0; //reserved for backward compatibility
Ok = 1;
Warning = 2;
Error = 3;
}
22 changes: 19 additions & 3 deletions src/Com/PowersOfAttorney.cs
Original file line number Diff line number Diff line change
Expand Up @@ -319,10 +319,10 @@ public partial class PowerOfAttorneyValidationError : SafeComObject, IPowerOfAtt
[Guid("AC2185A0-5D6D-4371-A487-A75EC0627897")]
public interface IValidationCheckResult
{
string Status { get; set; }
string Name { get; set; }
Com.PowerOfAttorneyValidationCheckStatus Status { get; }
string Name { get; }

PowerOfAttorneyValidationError Error { get; set; }
PowerOfAttorneyValidationError Error { get; }
}

[ComVisible(true)]
Expand All @@ -332,6 +332,10 @@ public interface IValidationCheckResult
[ComDefaultInterface(typeof(IValidationCheckResult))]
public partial class ValidationCheckResult : SafeComObject, IValidationCheckResult
{
Com.PowerOfAttorneyValidationCheckStatus IValidationCheckResult.Status
{
get { return (Com.PowerOfAttorneyValidationCheckStatus) Status; }
}
}

[ComVisible(true)]
Expand Down Expand Up @@ -649,4 +653,16 @@ public enum PowerOfAttorneySendingType
File = 2,
DocumentContent = 3
}

[ComVisible(true)]
[Guid("097F4C55-AB9A-4571-8A8E-3F1B0022CBF9")]
//NOTE: Это хотели, чтобы можно было использовать XML-сериализацию для классов
[XmlType(TypeName = "PowerOfAttorneyValidationCheckStatus", Namespace = "https://diadoc-api.kontur.ru")]
public enum PowerOfAttorneyValidationCheckStatus
{
UnknownCheckStatus = 0,
Ok = 1,
Warning = 2,
Error = 3
}
}
25 changes: 21 additions & 4 deletions src/Proto/PowersOfAttorney/PowerOfAttorneyValidation.proto.cs
Original file line number Diff line number Diff line change
Expand Up @@ -182,9 +182,9 @@ public partial class ValidationCheckResult : global::ProtoBuf.IExtensible
{
public ValidationCheckResult() {}

private string _Status;
[global::ProtoBuf.ProtoMember(1, IsRequired = true, Name=@"Status", DataFormat = global::ProtoBuf.DataFormat.Default)]
public string Status
private Diadoc.Api.Proto.PowersOfAttorney.PowerOfAttorneyValidationCheckStatus _Status;
[global::ProtoBuf.ProtoMember(1, IsRequired = true, Name=@"Status", DataFormat = global::ProtoBuf.DataFormat.TwosComplement)]
public Diadoc.Api.Proto.PowersOfAttorney.PowerOfAttorneyValidationCheckStatus Status
{
get { return _Status; }
set { _Status = value; }
Expand Down Expand Up @@ -236,4 +236,21 @@ public enum PowerOfAttorneyValidationStatusNamedId
HasWarnings = 6
}

}
[global::ProtoBuf.ProtoContract(Name=@"PowerOfAttorneyValidationCheckStatus")]
public enum PowerOfAttorneyValidationCheckStatus
{

[global::ProtoBuf.ProtoEnum(Name=@"UnknownCheckStatus", Value=0)]
UnknownCheckStatus = 0,

[global::ProtoBuf.ProtoEnum(Name=@"Ok", Value=1)]
Ok = 1,

[global::ProtoBuf.ProtoEnum(Name=@"Warning", Value=2)]
Warning = 2,

[global::ProtoBuf.ProtoEnum(Name=@"Error", Value=3)]
Error = 3
}

}

0 comments on commit 8f23fa6

Please sign in to comment.