unit XData.Payload.Factory;

interface

uses
  Classes,
  Bcl.Collections,
  XData.Json.Solver,
  XData.Model.Classes,
  XData.Payload.Reader,
  XData.Payload.Writer;

type
  IJsonReferenceSolver = XData.Json.Solver.IJsonReferenceSolver;

  TXDataPayloadFactory = class
  strict private
    FModel: TXDataModel;
    FBaseUrl: string;
  strict protected
    property Model: TXDataModel read FModel;
    property BaseUrl: string read FBaseUrl;
  public
    constructor Create(const AModel: TXDataModel; const ABaseUrl: string);
    function CreateEntityCollectionWriter(const Stream: TStream): IEntityCollectionWriter; virtual; abstract;
    function CreateEntityWriter(const Stream: TStream): IEntityWriter; virtual; abstract;
    function CreateServiceDocumentWriter(const Stream: TStream): IServiceDocumentWriter; virtual; abstract;
    function CreateErrorWriter(const Stream: TStream): IErrorWriter; virtual; abstract;
    function CreatePropertyWriter(const Stream: TStream): IPropertyWriter; virtual; abstract;
    function CreateResultWriter(const Stream: TStream): IResultWriter; virtual; abstract;

    function CreateEntityReader(const Stream: TStream; Solver: IJsonReferenceSolver; ManagedObjects: THashSet<TObject>): IEntityReader; virtual; abstract;
    function CreateParamsReader(const Stream: TStream; Solver: IJsonReferenceSolver; ManagedObjects: THashSet<TObject>): IParamsReader; virtual; abstract;
    function CreateErrorReader(const Stream: TStream): IErrorReader; virtual; abstract;
  end;

implementation

{ TXDataPayloadFactory }

constructor TXDataPayloadFactory.Create(const AModel: TXDataModel; const ABaseUrl: string);
begin
  FModel := AModel;
  FBaseUrl := ABaseUrl;
end;

end.
